8000 Proper JPMS support and Java 18 DNS SPI · dnsjava/dnsjava@1f222f5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1f222f5

Browse files
committed
Proper JPMS support and Java 18 DNS SPI
Closes #245
1 parent 7f7b577 commit 1f222f5

File tree

18 files changed

+542
-49
lines changed

18 files changed

+542
-49
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ indent_size = 2
66
insert_final_newline = true
77
charset = utf-8
88
end_of_line = lf
9+
trim_trailing_whitespace = true
910

1011
[{pom.xml,*.md}]
1112
indent_style = space

.github/actions/prepare-analysis/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ runs:
3838
echo "check_name<<EOF"$'\n'"${check_name}EOF" >> $GITHUB_OUTPUT
3939
4040
- name: Publish Test Report
41-
uses: mikepenz/action-junit-report@v3
41+
uses: mikepenz/action-junit-report@v4
4242
with:
4343
commit: ${{ github.event.workflow_run.head_sha }}
4444
report_paths: ${{ steps.junit_paths.outputs.report_paths }}

.github/workflows/analyze.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ permissions:
1313
checks: write
1414

1515
env:
16-
BUILD_JAVA_VERSION: '20'
16+
BUILD_JAVA_VERSION: '21'
1717

1818
jobs:
1919
analyze:
@@ -48,7 +48,7 @@ jobs:
4848
number: ${{ steps.pr_number.outputs.pr_number }}
4949

5050
- name: Checkout PR
51-
uses: actions/checkout@v3
51+
uses: actions/checkout@v4
5252
with:
5353
repository: ${{ github.event.workflow_run.head_repository.full_name }}
5454
ref: ${{ github.event.workflow_run.head_sha }}
@@ -60,7 +60,7 @@ jobs:
6060
run: rm -rf base
6161

6262
- name: Checkout base
63-
uses: actions/checkout@v3
63+
uses: actions/checkout@v4
6464
with:
6565
repository: ${{ github.event.repository.full_name }}
6666
ref: ${{ fromJson(steps.get_pr_data.outputs.data).base.ref }}

.github/workflows/build.yml

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232

3333
steps:
3434
- name: Checkout
35-
uses: actions/checkout@v3
35+
uses: actions/checkout@v4
3636

3737
- name: Set up JDK ${{ matrix.java }}
3838
uses: actions/setup-java@v3
@@ -56,6 +56,18 @@ jobs:
5656
mv jacoco.exec jacoco-${{ matrix.java }}-${{ matrix.arch }}-${{ matrix.os }}.exec
5757
mv surefire-reports surefire-reports-${{ matrix.java }}-${{ matrix.arch }}-${{ matrix.os }}
5858
59+
- name: Verify that the main classes are really compiled for Java 8
60+
shell: bash
61+
env:
62+
LC_ALL: "en_US:utf8"
63+
run: |
64+
class_file_version=$(javap -v target/classes/org/xbill/DNS/SimpleResolver.class | grep -oP "major version: \K\d+")
65+
echo "::notice file=SimpleResolver.class::Class file version ${class_file_version}"
66+
if [ "${class_file_version}" != "52" ]; then
67+
echo "::error file=SimpleResolver.class::Class file version is not Java 8"
68+
exit 1
69+
fi
70+
5971
- name: Upload classes
6072
uses: ./.github/actions/upload-artifact
6173
if: always() && matrix.java == env.BUILD_JAVA_VERSION && matrix.arch == 'x64' && matrix.os == 'ubuntu-latest'
@@ -85,7 +97,7 @@ jobs:
8597
needs: test
8698
steps:
8799
- name: Checkout
88-
uses: actions/checkout@v3
100+
uses: actions/checkout@v4
89101

90102
- name: Set up JDK
91103
uses: actions/setup-java@v3
@@ -133,7 +145,7 @@ jobs:
133145
if: github.event_name == 'push' || github.event.pull_request.head.repo.owner.login == 'dnsjava'
134146
steps:
135147
- name: Checkout
136-
uses: actions/checkout@v3
148+
uses: actions/checkout@v4
137149
with:
138150
# for Sonar
139151
fetch-depth: 0
@@ -160,12 +172,12 @@ jobs:
160172
needs: test
161173
runs-on: ubuntu-latest
162174
steps:
163-
- uses: actions/checkout@v3
175+
- uses: actions/checkout@v4
164176

165-
- name: Set up JDK 8
177+
- name: Set up JDK ${env.BUILD_JAVA_VERSION}
166178
uses: actions/setup-java@v3
167179
with:
168-
java-version: '8'
180+
java-version: env.BUILD_JAVA_VERSION
169181
architecture: 'x64'
170182
distribution: temurin
171183
cache: maven
@@ -183,6 +195,23 @@ jobs:
183195
mvn \
184196
--no-transfer-progress \
185197
--batch-mode \
186-
-Dgpg.passphrase="${{ secrets.GPG_PW }}" \
187-
-DperformRelease=true \
188-
deploy
198+
compile
199+
# Verify that the main classes are really compiled for Java 8
200+
class_file_version=$(javap -v target/classes/org/xbill/DNS/SimpleResolver.class | grep -oP "major version: \K\d+")
201+
echo "::notice file=SimpleResolver.class::Class file version ${class_file_version}"
202+
if [ "${class_file_version}" == "52" ]; then
203+
mvn \
204+
--no-transfer-progress \
205+
--batch-mode \
206+
-Dgpg.passphrase="${{ secrets.GPG_PW }}" \
207+
-DperformRelease=true \
208+
-DskipTests \
209+
-Dmaven.test.skip.exec \
210+
-Dcheckstyle.skip \
211+
-Dspotless.check.skip=true \
212+
-Danimal.sniffer.skip=true
213+
deploy
214+
else
215+
echo "::error file=SimpleResolver.class::Class file version is not Java 8"
216+
exit 1
217+
fi

.github/workflows/codeql-analysis.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,36 @@ jobs:
2525

2626
steps:
2727
- name: Checkout repository
28-
uses: actions/checkout@v3
28+
uses: actions/checkout@v4
2929

3030
# Initializes the CodeQL tools for scanning.
3131
- name: Initialize CodeQL
3232
uses: github/codeql-action/init@v2
3333
with:
3434
languages: java
3535

36-
- name: Set up JDK 11
36+
- name: Set up JDK 21
3737
uses: actions/setup-java@v3
3838
with:
39-
java-version: 11
39+
java-version: 21
4040
distribution: temurin
4141
check-latest: true
4242
cache: maven
4343

4444
- name: Build with Maven
45-
run: mvn verify -B -"Dgpg.skip"
45+
# Skip tests, code style, etc. This is handled in the regular CI workflows.
46+
run: |
47+
mvn clean package -B -V \
48+
-DskipTests \
49+
-Dmaven.test.skip.exec \
50+
-Dgpg.skip \
51+
-Dcheckstyle.skip \
52+
-Denforcer.skip \
53+
-Dmaven.javadoc.skip \
54+
-Dspotless.check.skip=true \
55+
-Danimal.sniffer.skip=true \
56+
compile \
57+
test-compile
4658
4759
- name: Perform CodeQL Analysis
4860
uses: github/codeql-action/analyze@v2

.github/workflows/report.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: report
2+
on:
3+
workflow_run:
4+
workflows: [ build ]
5+
types: [ completed ]
6+
7+
permissions:
8+
checks: write
9+
10+
jobs:
11+
checks:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Download Test Report
15+
uses: dawidd6/action-download-artifact@v2
16+
with:
17+
name: junit-test-results
18+
workflow: ${{ github.event.workflow.id }}
19+
run_id: ${{ github.event.workflow_run.id }}
20+
- name: Publish Test Report
21+
uses: mikepenz/action-junit-report@v3
22+
with:
23+
commit: ${{ github.event.workflow_run.head_sha }}
24+
report_paths: 'target/surefire-reports/TEST-*.xml'

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Copyright (c) 1998-2019, Brian Wellington
22
Copyright (c) 2005 VeriSign. All rights reserved.
3-
Copyright (c) 2019-2021, dnsjava authors
3+
Copyright (c) 2019-2023, dnsjava authors
44

55
All rights reserved.
66

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ The servers can either be IP addresses or hostnames (which are resolved using Ja
317317
- On Windows, if https://github.com/java-native-access/jna[JNA] is available on the classpath, the `GetAdaptersAddresses` API is used.
318318
- On Android the `ConnectivityManager` is used (requires initialization using `org.xbill.DNS.config.AndroidResolverConfigProvider.setContext`).
319319
- The `sun.net.dns.ResolverConfiguration` class is queried if enabled.
320-
As of Java 16 the JVM flag `--add-opens java.base/sun.net.dns=ALL-UNNAMED` is also required.
320+
As of Java 16 the JVM flag `--add-opens java.base/sun.net.dns=ALL-UNNAMED` (classpath) or `--add-opens java.base/sun.net.dns=org.dnsjava` (modules) is also required.
321321
- If available and no servers have been found yet, https://docs.oracle.com/javase/8/docs/technotes/guides/jndi/jndi-dns.html[JNDI-DNS] is used.
322322
- If still no servers have been found yet, use the fallback properties.
323323
This can be used to query e.g. a well-known public DNS server instead of localhost.

checkstyle/checkstyle-config.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@
99
<property name="headerFile" value="checkstyle/header.template.txt"/>
1010
<property name="fileExtensions" value="java"/>
1111
</module>
12+
<!-- Excludes all 'module-info.java' files, see https://github.com/checkstyle/checkstyle/issues/8240 -->
13+
<module name="BeforeExecutionExclusionFileFilter">
14+
<property name="fileNamePattern" value="module\-info\.java$"/>
15+
</module>
1216
</module>

0 commit comments

Comments
 (0)
0