@@ -6,6 +6,21 @@ import org.asciidoctor.gradle.jvm.AsciidoctorTask
66/*
77 Gradle build script for Jaybird - Firebird JDBC driver.
88
9+ Define target Java version:
10+ - -PbuildProfile=17 : Java 17 (supported)
11+ or not specified
12+ - -PbuildProfile=NN : Java NN (not publishable)
13+ with NN > 17
14+
15+ Build profiles other than 17 will not be published to Maven.
16+
17+ Define (other) Java version to test:
18+ - -PtestProfile=NN with NN >= 17
19+
20+ If not specified, the test profile is the same as buildProfile.
21+
22+ For historic reasons, both buildProfile and testProfile also accept javaNN.
23+
924 Uploading archives:
1025
1126 publish -PcredentialsPassphrase=<credentials password>
@@ -29,9 +44,22 @@ version = project.'version.maven'
2944allprojects {
3045 tasks. withType(JavaCompile ). configureEach {
3146 options. encoding = ' UTF-8'
47+ int buildProfile = project. buildProfile
48+ options. release = buildProfile
49+ javaCompiler = javaToolchains. compilerFor {
50+ languageVersion = JavaLanguageVersion . of((int ) buildProfile)
51+ }
3252 }
3353 tasks. withType(Test ). configureEach {
3454 systemProperty ' file.encoding' , ' UTF-8'
55+ javaLauncher = javaToolchains. launcherFor {
56+ languageVersion = JavaLanguageVersion . of((int ) project. testProfile)
57+ }
58+ }
59+ tasks. withType(Javadoc ). configureEach {
60+ javadocTool = javaToolchains. javadocToolFor {
61+ languageVersion = JavaLanguageVersion . of((int ) project. testProfile)
62+ }
3563 }
3664}
3765
4068}
4169
4270java {
43- sourceCompatibility = JavaVersion . VERSION_17
44- targetCompatibility = JavaVersion . VERSION_17
71+ def javaVersion = JavaLanguageVersion . of((int ) project. buildProfile)
72+ sourceCompatibility = javaVersion
73+ targetCompatibility = javaVersion
4574 withJavadocJar()
4675 withSourcesJar()
4776}
@@ -161,13 +190,12 @@ tasks.named('assemble') {
161190jar {
162191 manifest {
163192 attributes(
164- ' Created-By' : " ${ System.getProperty('java.vm.version')} (${ System.getProperty('java.vm.vendor')} )" ,
165193 ' Specification-Title' : project. ' specification.title' ,
166194 ' Specification-Version' : project. ' specification.version' ,
167195 ' Specification-Vendor' : project. ' specification.vendor' ,
168196 ' Implementation-Title' : project. ' implementation.title' ,
169197 ' Implementation-Url' : project. ' implementation.url' ,
170- ' Implementation-Version' : " $project . version (build: variant=$project . mavenName tag=${ project.'version.svntag'} date=${ project.'build.id'} )" ,
198+ ' Implementation-Version' : " $project . version (build: variant=$project . mavenName tag=${ project.'version.svntag'} date=${ project.'build.id'} profile= ${ project.buildProfile } )" ,
171199 ' Implementation-Vendor' : project. ' implementation.vendor' ,
172200 ' Implementation-Vendor-Id' : project. ' implementation.vendor.id' ,
173201 ' Bundle-License' : ' LGPL-2.1-or-later OR LGPL-2.1-or-later AND BSD-3-Clause' ,
0 commit comments