Skip to content

Commit 1a5dfc2

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

File tree

18 files changed

+538
-49
lines changed

18 files changed

+538
-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: 34 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,15 @@ 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+
run: |
62+
class_file_version=$(javap -v target/classes/org/xbill/DNS/SimpleResolver.class | grep -oP "major version: \K\d+")
63+
if [ "${class_file_version}" != "52" ]; then
64+
echo "::error file=SimpleResolver.class::Class file version is not Java 8 (${class_file_version})"
65+
exit 1
66+
fi
67+
5968
- name: Upload classes
6069
uses: ./.github/actions/upload-artifact
6170
if: always() && matrix.java == env.BUILD_JAVA_VERSION && matrix.arch == 'x64' && matrix.os == 'ubuntu-latest'
@@ -85,7 +94,7 @@ jobs:
8594
needs: test
8695
steps:
8796
- name: Checkout
88-
uses: actions/checkout@v3
97+
uses: actions/checkout@v4
8998

9099
- name: Set up JDK
91100
uses: actions/setup-java@v3
@@ -133,7 +142,7 @@ jobs:
133142
if: github.event_name == 'push' || github.event.pull_request.head.repo.owner.login == 'dnsjava'
134143
steps:
135144
- name: Checkout
136-
uses: actions/checkout@v3
145+
uses: actions/checkout@v4
137146
with:
138147
# for Sonar
139148
fetch-depth: 0
@@ -160,12 +169,12 @@ jobs:
160169
needs: test
161170
runs-on: ubuntu-latest
162171
steps:
163-
- uses: actions/checkout@v3
172+
- uses: actions/checkout@v4
164173

165-
- name: Set up JDK 8
174+
- name: Set up JDK ${env.BUILD_JAVA_VERSION}
166175
uses: actions/setup-java@v3
167176
with:
168-
java-version: '8'
177+
java-version: env.BUILD_JAVA_VERSION
169178
architecture: 'x64'
170179
distribution: temurin
171180
cache: maven
@@ -183,6 +192,22 @@ jobs:
183192
mvn \
184193
--no-transfer-progress \
185194
--batch-mode \
186-
-Dgpg.passphrase="${{ secrets.GPG_PW }}" \
187-
-DperformRelease=true \
188-
deploy
195+
compile
196+
# Verify that the main classes are really compiled for Java 8
197+
class_file_version=$(javap -v target/classes/org/xbill/DNS/SimpleResolver.class | grep -oP "major version: \K\d+")
198+
if [ "${class_file_version}" == "52" ]; then
199+
mvn \
200+
--no-transfer-progress \
201+
--batch-mode \
202+
-Dgpg.passphrase="${{ secrets.GPG_PW }}" \
203+
-DperformRelease=true \
204+
-DskipTests \
205+
-Dmaven.test.skip.exec \
206+
-Dcheckstyle.skip \
207+
-Dspotless.check.skip=true \
208+
-Danimal.sniffer.skip=true
209+
deploy
210+
else
211+
echo "::error file=SimpleResolver.class::Class file version is not Java 8 (${class_file_version})"
212+
exit 1
213+
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)