Skip to content

Commit 6c293b1

Browse files
committed
chore: simplify integration-test.sh since use java 8
1 parent f006b15 commit 6c293b1

File tree

8 files changed

+39
-239
lines changed

8 files changed

+39
-239
lines changed

appveyor.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ for:
5959
- cmd: echo JAVA_HOME=%JAVA_HOME%, HOMEPATH=%HOMEPATH%, PATH=%PATH%
6060

6161
test_script:
62-
# test under java 8
63-
- cmd: set JAVA_HOME=C:\Program Files\Java\jdk1.8.0
64-
- ./mvnw.cmd -V clean install --no-transfer-progress
6562
# test under java 11
6663
- cmd: set JAVA_HOME=C:\Program Files\Java\jdk11
67-
- ./mvnw.cmd -V clean install --no-transfer-progress
64+
- ./mvnw.cmd -V --no-transfer-progress clean install
65+
# test under java 8
66+
- cmd: set JAVA_HOME=C:\Program Files\Java\jdk1.8.0
67+
- ./mvnw.cmd -V --no-transfer-progress surefire:test
6868

6969
after_test:
7070
- ps: Remove-Item -r -fo $home\.m2\repository\com\alibaba\dns-cache-manipulator*

library/pom.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,21 @@
533533
</plugins>
534534
</build>
535535
</profile>
536+
<profile>
537+
<id>add-java-open-options-for-jdk17</id>
538+
<activation>
539+
<jdk>[17,)</jdk>
540+
</activation>
541+
<!--
542+
Maven Surefire Plugin – surefire:test
543+
https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#argLine
544+
Append the value of argLine param in maven-surefire-plugin
545+
https://stackoverflow.com/questions/46489455
546+
-->
547+
<properties>
548+
<argLine>--add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/sun.net=ALL-UNNAMED</argLine>
549+
</properties>
550+
</profile>
536551
<profile>
537552
<id>gen-code-cov</id>
538553
<build>

library/scripts/lib_common_build.sh

Lines changed: 0 additions & 79 deletions
This file was deleted.

library/scripts/run-junit.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

scripts/common_build.sh

Lines changed: 7 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -35,64 +35,23 @@ JAVA_CMD() {
3535
)
3636

3737
logAndRun "$JAVA_HOME/bin/java" -Xmx128m -Xms128m -server -ea -Duser.language=en -Duser.country=US \
38-
${ENABLE_JAVA_RUN_VERBOSE_CLASS+ -verbose:class} \
39-
${ENABLE_JAVA_RUN_DEBUG+ -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005} \
40-
${additionalOptionsForJava12Plus[@]:+"${additionalOptionsForJava12Plus[@]}"} \
41-
"$@"
38+
${ENABLE_JAVA_RUN_VERBOSE_CLASS+ -verbose:class} \
39+
${ENABLE_JAVA_RUN_DEBUG+ -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005} \
40+
${additionalOptionsForJava12Plus[@]:+"${additionalOptionsForJava12Plus[@]}"} \
41+
"$@"
4242
}
4343

4444
#################################################################################
4545
# maven operation functions
4646
#################################################################################
4747

48-
4948
MVN_CMD() {
50-
logAndRun "$ROOT_PROJECT_DIR/mvnw" -V --no-transfer-progress "$@"
51-
}
52-
53-
mvnClean() {
54-
checkNecessityForCallerFunction || return 0
55-
5649
(
5750
cd "$ROOT_PROJECT_DIR"
58-
MVN_CMD clean || die "fail to mvn clean!"
59-
)
60-
}
6151

62-
mvnBuildJar() {
63-
checkNecessityForCallerFunction || return 0
64-
65-
(
66-
cd "$ROOT_PROJECT_DIR"
67-
if [ -n "${CI_TEST_MODE+YES}" ]; then
68-
# Build jar action should have used package instead of install
69-
# here use install intended to check release operations.
70-
#
71-
# De-activate a maven profile from command line
72-
# https://stackoverflow.com/questions/25201430
73-
MVN_CMD install -DperformRelease -P '!gen-sign' || die "fail to build jar!"
74-
else
75-
MVN_CMD install -Dmaven.test.skip=true || die "fail to build jar!"
76-
fi
77-
)
78-
}
79-
80-
mvnCompileTest() {
81-
checkNecessityForCallerFunction || return 0
82-
83-
(
84-
cd "$ROOT_PROJECT_DIR"
85-
MVN_CMD test-compile || die "fail to compile test!"
86-
)
87-
}
88-
89-
mvnCopyDependencies() {
90-
checkNecessityForCallerFunction || return 0
91-
92-
(
93-
cd "$ROOT_PROJECT_DIR"
94-
# https://maven.apache.org/plugins/maven-dependency-plugin/copy-dependencies-mojo.html
95-
MVN_CMD dependency:copy-dependencies -DincludeScope=test -DexcludeArtifactIds=jsr305,spotbugs-annotations || die "fail to mvn copy-dependencies!"
52+
logAndRun "$ROOT_PROJECT_DIR/mvnw" -V --no-transfer-progress \
53+
${SKIP_GIT_DIRTY_CHECK+ -Dgit.dirty=false} \
54+
"$@"
9655
)
9756
}
9857

scripts/integration-test.sh

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,25 @@ source ./common_build.sh
1212
switch_to_jdk 11
1313

1414
if [ "${1:-}" != "skipClean" ]; then
15-
mvnClean
16-
17-
mvnBuildJar
18-
19-
mvnCopyDependencies
15+
MVN_CMD clean
2016
fi
2117

18+
# Build jar action should have used package instead of install
19+
# here use install intended to check release operations.
20+
#
21+
# De-activate a maven profile from command line
22+
# https://stackoverflow.com/questions/25201430
23+
headInfo "test with Java: $JAVA_HOME"
24+
MVN_CMD -DperformRelease -P '!gen-sign' install
25+
2226
# test multi-version java home env
2327
# shellcheck disable=SC2154
2428
for jhome in "${java_home_var_names[@]}"; do
29+
# already tested by above `mvn install`
30+
[ "JDK11_HOME" = "$jhome" ] && continue
31+
2532
export JAVA_HOME=${!jhome}
2633

2734
headInfo "test with Java: $JAVA_HOME"
28-
logAndRun ../library/scripts/run-junit.sh skipClean
29-
logAndRun ../tool/scripts/run-junit.sh skipClean
35+
MVN_CMD surefire:test
3036
done

tool/scripts/run-junit.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

tool/scripts/tool_common_build.sh

Lines changed: 0 additions & 79 deletions
This file was deleted.

0 commit comments

Comments
 (0)