Skip to content

Commit 19b9210

Browse files
committed
Initial simplification of build.
Updated README.md
1 parent bc84e87 commit 19b9210

File tree

18 files changed

+289
-358
lines changed

18 files changed

+289
-358
lines changed

.gitlab-ci.yml

Lines changed: 2 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ ant-build:
3131
- "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/build_1_8.sh\""
3232

3333

34-
test-code-8:
34+
test-code:
3535
stage: test
3636
needs: [ "check-code" ]
3737
script:
3838
- "ecr_login"
3939
- "ecr_pull vm_base_intel latest"
40-
- "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/test_8.sh\""
40+
- "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/test.sh\""
4141
artifacts:
4242
when: always
4343
reports:
@@ -51,67 +51,6 @@ test-code-8:
5151
- "tls/build/test-results/**/*.xml"
5252
- "mls/build/test-results/**/*.xml"
5353

54-
test-code-11:
55-
stage: test
56-
needs: [ "check-code" ]
57-
script:
58-
- "ecr_login"
59-
- "ecr_pull vm_base_intel latest"
60-
- "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/test_11.sh\""
61-
artifacts:
62-
when: always
63-
reports:
64-
junit:
65-
- "core/build/test-results/**/*.xml"
66-
- "prov/build/test-results/**/*.xml"
67-
- "pg/build/test-results/**/*.xml"
68-
- "pkix/build/test-results/**/*.xml"
69-
- "mail/build/test-results/**/*.xml"
70-
- "util/build/test-results/**/*.xml"
71-
- "tls/build/test-results/**/*.xml"
72-
- "mls/build/test-results/**/*.xml"
73-
74-
75-
test-code-17:
76-
stage: test
77-
needs: [ "check-code" ]
78-
script:
79-
- "ecr_login"
80-
- "ecr_pull vm_base_intel latest"
81-
- "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/test_17.sh\""
82-
artifacts:
83-
when: always
84-
reports:
85-
junit:
86-
- "core/build/test-results/**/*.xml"
87-
- "prov/build/test-results/**/*.xml"
88-
- "pg/build/test-results/**/*.xml"
89-
- "pkix/build/test-results/**/*.xml"
90-
- "mail/build/test-results/**/*.xml"
91-
- "util/build/test-results/**/*.xml"
92-
- "tls/build/test-results/**/*.xml"
93-
- "mls/build/test-results/**/*.xml"
94-
95-
96-
test-code-21:
97-
stage: test
98-
needs: [ "check-code" ]
99-
script:
100-
- "ecr_login"
101-
- "ecr_pull vm_base_intel latest"
102-
- "ci_docker_run \"vm_base_intel:latest\" \"bc-java\" \"/workspace/bc-java/ci/test_21.sh\""
103-
artifacts:
104-
when: always
105-
reports:
106-
junit:
107-
- "core/build/test-results/**/*.xml"
108-
- "prov/build/test-results/**/*.xml"
109-
- "pg/build/test-results/**/*.xml"
110-
- "pkix/build/test-results/**/*.xml"
111-
- "mail/build/test-results/**/*.xml"
112-
- "util/build/test-results/**/*.xml"
113-
- "tls/build/test-results/**/*.xml"
114-
- "mls/build/test-results/**/*.xml"
11554

11655

11756
spongycastle:

README.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,23 @@ Except where otherwise stated, this software is distributed under a license base
1010

1111
**Note**: this source tree is not the FIPS version of the APIs - if you are interested in our FIPS version please contact us directly at [[email protected]](mailto:[email protected]).
1212

13+
## Building overview
14+
15+
This project can now be built and tested with JDK21.
16+
17+
If the build script detects BC_JDK8, BC_JDK11, BC_JDK17 it will add to the usual test task a dependency on test tasks
18+
that specifically use the JVMs addressed by those environmental variables.
19+
20+
We support testing on specific JVMs as it is the only way to be certain the library is compatible.
1321

1422
## Environmental Variables
1523

16-
Before invoking gradlew you need to ensure the following environmental variables are defined and point
17-
to valid JAVA_HOMEs for each JVM version:
24+
The following environmental variables can optionally point to the JAVA_HOME for each JVM version.
1825

1926
```
2027
export BC_JDK8=/path/to/java8
2128
export BC_JDK11=/path/to/java11
2229
export BC_JDK17=/path/to/java17
23-
export BC_JDK21=/path/to/java21
2430
```
2531

2632
## Building
@@ -30,7 +36,8 @@ The project now uses ```gradlew``` which can be invoked for example:
3036
```
3137
# from the root of the project
3238
33-
# Ensure JAVA_HOME points to JDK 17 or higher JAVA_HOME
39+
# Ensure JAVA_HOME points to JDK 21 or higher JAVA_HOME or that
40+
# gradlew can find a java 21 installation to use.
3441
3542
3643
./gradlew clean build
@@ -41,19 +48,17 @@ The gradle script will endeavour to verify their existence but not the correctne
4148

4249

4350
## Multi-release jars and testing
44-
Some subprojects produce multi-release jars and these jars are tested in different jvm versions.
45-
Default testing on these projects is done on java 1.8 and there are specific test tasks for other versions.
46-
47-
1. test11 test on java 11 JVM
48-
2. test17 test on java 17 JVM
49-
3. test21 test on java 21 JVM
50-
51-
To run all of them:
51+
Some subprojects produce multi-release jars and these jars are can be tested on different jvm versions specifically.
5252

53+
If the env vars are defined:
5354
```
54-
./gradlew clean build test11 test17 test21
55+
export BC_JDK8=/path/to/java8
56+
export BC_JDK11=/path/to/java11
57+
export BC_JDK17=/path/to/java17
5558
```
5659

60+
If only a Java 21 JDK is present then the normal test task and test21 are run only.
61+
5762

5863
## Code Organisation
5964

build.gradle

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ plugins {
1515
}
1616

1717
println("Environment setup:")
18-
["BC_JDK8", "BC_JDK11", "BC_JDK17", "BC_JDK21"].each({ it ->
18+
["BC_JDK8", "BC_JDK11", "BC_JDK17"].each({ it ->
1919
println("Looking for JDK ENV '${it}' found ${System.getenv(it)}");
20-
if (System.getenv(it) == null) {
21-
throw new RuntimeException("Looking for JDK ENV '${it}' but found null, see README 'Environmental variables'");
22-
}
20+
// if (System.getenv(it) == null) {
21+
// throw new RuntimeException("Looking for JDK ENV '${it}' but found null, see README 'Environmental variables'");
22+
// }
2323
})
2424

2525

@@ -178,25 +178,25 @@ ext {
178178
ext.vmrange = 'jdk18on'
179179
}
180180

181-
bc_prov = "${rootProject.projectDir}/prov/build/libs/bcprov-${vmrange}-${version}.jar"
182-
bc_util = "${rootProject.projectDir}/util/build/libs/bcutil-${vmrange}-${version}.jar"
183-
bc_pkix = "${rootProject.projectDir}/pkix/build/libs/bcpkix-${vmrange}-${version}.jar"
184-
185181
}
186182

187183

188-
189-
190184
subprojects {
191185
apply plugin: 'eclipse'
192186

187+
193188
JavaVersion current = JavaVersion.current();
189+
int releaseVersion = 8;
194190
if (current.compareTo(JavaVersion.VERSION_1_8) <= 0) {
195-
sourceCompatibility = 1.5
196-
targetCompatibility = 1.5
197-
} else {
198-
sourceCompatibility = 1.8
199-
targetCompatibility = 1.8
191+
releaseVersion = 5
192+
}
193+
194+
compileJava {
195+
options.release = releaseVersion;
196+
}
197+
198+
compileTestJava {
199+
options.release = 8;
200200
}
201201

202202

@@ -220,7 +220,7 @@ subprojects {
220220
maxParallelForks = 1;
221221
systemProperty 'bc.test.data.home', bcTestDataHome
222222
maxHeapSize = "1536m"
223-
testLogging.showStandardStreams = true
223+
testLogging.showStandardStreams = false
224224

225225
javaLauncher = javaToolchains.launcherFor {
226226
languageVersion = JavaLanguageVersion.of(8)
@@ -270,6 +270,13 @@ subprojects {
270270
junitXml.outputLocation = layout.buildDirectory.dir("test-results")
271271
}
272272
}
273+
274+
tasks.withType(JavaCompile).configureEach {
275+
javaCompiler = javaToolchains.compilerFor {
276+
languageVersion = JavaLanguageVersion.of(21)
277+
}
278+
}
273279
}
274280

275-
test.dependsOn([':core:test', ':prov:test', ':prov:test11', ':prov:test17', ':prov:test21', ':pkix:test', 'pg:test', ':tls:test', 'mls:test', 'mail:test', 'jmail:test'])
281+
282+
test.dependsOn([':core:test', ':prov:test', ':prov:test11', ':prov:test15', ':prov:test21', ':pkix:test', 'pg:test', ':tls:test', 'mls:test', 'mail:test', 'jmail:test'])

ci/check_java.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,9 @@ set -e
99
cd /workspace/bc-java
1010
source ci/common.sh
1111

12-
export BC_JDK8=`openjdk_8`
13-
export BC_JDK11=`openjdk_11`
14-
export BC_JDK15=`openjdk_15`
15-
export BC_JDK17=`openjdk_17`
16-
export BC_JDK21=`openjdk_21`
1712

18-
export JAVA_HOME=`openjdk_17`
13+
14+
export JAVA_HOME=`openjdk_21`
1915
export PATH=$JAVA_HOME/bin:$PATH
2016

2117
# Checkstyle

ci/test_11.sh renamed to ci/test.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ source ci/common.sh
1212
export BC_JDK8=`openjdk_8`
1313
export BC_JDK11=`openjdk_11`
1414
export BC_JDK17=`openjdk_17`
15-
export BC_JDK21=`openjdk_21`
1615

17-
18-
export JAVA_HOME=`openjdk_17`
16+
export JAVA_HOME=`openjdk_21`
1917
export PATH=$JAVA_HOME/bin:$PATH
2018

21-
./gradlew -stacktrace clean build test11 -x test
19+
./gradlew -stacktrace clean build
2220

2321

2422

ci/test_17.sh

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

ci/test_21.sh

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

ci/test_8.sh

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

core/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ test {
1414
forkEvery = 1;
1515
maxParallelForks = 8;
1616
}
17+

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
org.gradle.jvmargs=-Xmx2g
22
version=1.79-SNAPSHOT
33
maxVersion=1.80
4-
org.gradle.java.installations.auto-detect=false
4+
org.gradle.java.installations.auto-detect=true
55
org.gradle.java.installations.auto-download=false
6-
org.gradle.java.installations.fromEnv=BC_JDK8,BC_JDK11,BC_JDK17,BC_JDK21
6+
org.gradle.java.installations.fromEnv=BC_JDK8,BC_JDK11,BC_JDK17

0 commit comments

Comments
 (0)