Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Search Domains and DNS Resolver on Windows (#13022)
Motivation: On Windows with JDK 9+ the search domain and dns servers are missing. Modification: This PR uses JNI to fetch the DNS Servers from the operating system. Result: Fixes #12712 #11885. Co-authored-by: Norman Maurer <norman_maurer@apple.com>
- Loading branch information
1 parent
27b21ad
commit 9426e14
Showing
14 changed files
with
973 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright 2023 The Netty Project | ||
~ | ||
~ The Netty Project licenses this file to you under the Apache License, | ||
~ version 2.0 (the "License"); you may not use this file except in compliance | ||
~ with the License. You may obtain a copy of the License at: | ||
~ | ||
~ https://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
~ License for the specific language governing permissions and limitations | ||
~ under the License. | ||
--> | ||
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.netty</groupId> | ||
<artifactId>netty-parent</artifactId> | ||
<version>4.1.88.Final-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>netty-resolver-dns-native-windows</artifactId> | ||
|
||
<name>Netty/Resolver/DNS/Native/Windows</name> | ||
<packaging>jar</packaging> | ||
|
||
<profiles> | ||
<profile> | ||
<id>windows</id> | ||
<activation> | ||
<os> | ||
<family>windows</family> | ||
</os> | ||
</activation> | ||
<properties> | ||
<skipTests>false</skipTests> | ||
</properties> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<executions> | ||
<!-- unpack netty-jni-util files --> | ||
<execution> | ||
<id>unpack</id> | ||
<phase>generate-sources</phase> | ||
<goals> | ||
<goal>unpack-dependencies</goal> | ||
</goals> | ||
<configuration> | ||
<includeGroupIds>io.netty</includeGroupIds> | ||
<includeArtifactIds>netty-jni-util</includeArtifactIds> | ||
<classifier>sources</classifier> | ||
<outputDirectory>${combinedSources}</outputDirectory> | ||
<includes>**.h,**.c</includes> | ||
<overWriteReleases>false</overWriteReleases> | ||
<overWriteSnapshots>true</overWriteSnapshots> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.fusesource.hawtjni</groupId> | ||
<artifactId>hawtjni-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>build-native-lib</id> | ||
<phase>compile</phase> | ||
<configuration> | ||
<name>netty_resolver_dns_native_windows_${os.detected.arch}</name> | ||
<nativeSourceDirectory>${combinedSources}</nativeSourceDirectory> | ||
<libDirectory>${project.build.directory}/native-build</libDirectory> | ||
<windowsBuildTool>msbuild</windowsBuildTool> | ||
<windowsPlatformToolset>v142</windowsPlatformToolset> | ||
<windowsTargetPlatformVersion>10.0.19041.0</windowsTargetPlatformVersion> | ||
</configuration> | ||
<goals> | ||
<goal>generate</goal> | ||
<goal>build</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>copy-sources</id> | ||
<phase>generate-sources</phase> | ||
<goals> | ||
<goal>copy-resources</goal> | ||
</goals> | ||
<configuration> | ||
<outputDirectory>${combinedSources}</outputDirectory> | ||
<resources> | ||
<resource> | ||
<directory>${project.basedir}/src/main/c/src</directory> | ||
</resource> | ||
</resources> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>copy-windows-dll</id> | ||
<phase>process-classes</phase> | ||
<goals> | ||
<goal>copy-resources</goal> | ||
</goals> | ||
<configuration> | ||
<outputDirectory>${project.build.outputDirectory}/META-INF/native/</outputDirectory> | ||
<resources> | ||
<resource> | ||
<directory>${project.build.directory}/native-build/META-INF/native/windows${os.detected.bitness}</directory> | ||
<includes> | ||
<include>netty_resolver_dns_native_windows_${os.detected.arch}.dll</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<executions> | ||
<!-- Generate the JAR that contains the native library in it. --> | ||
<execution> | ||
<id>native-jar</id> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries> | ||
</manifest> | ||
<manifestEntries> | ||
<Bundle-NativeCode>META-INF/native/netty_resolver_dns_native_windows_${os.detected.arch}.dll; osname=Windows; processor=${os.detected.arch}</Bundle-NativeCode> | ||
<Fragment-Host>io.netty.resolver-dns-classes-windows</Fragment-Host> | ||
<Automatic-Module-Name>${javaModuleName}</Automatic-Module-Name> | ||
</manifestEntries> | ||
<index>true</index> | ||
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> | ||
</archive> | ||
<classifier>${jni.classifier}</classifier> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
|
||
<properties> | ||
<javaModuleNameClassifier>${os.detected.name}.${os.detected.arch}</javaModuleNameClassifier> | ||
<javaModuleName>io.netty.resolver.dns.windows.${javaModuleNameClassifier}</javaModuleName> | ||
<combinedSources>${project.build.directory}/native-src</combinedSources> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.netty</groupId> | ||
<artifactId>netty-common</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.netty</groupId> | ||
<artifactId>netty-jni-util</artifactId> | ||
<classifier>sources</classifier> | ||
<optional>true</optional> | ||
</dependency> | ||
</dependencies> | ||
</project> | ||
|
Oops, something went wrong.