1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-05-28 14:10:48 +00:00

Merge pull request #908 from soloturn/master

gradle, permit 'gradle test' with java8
This commit is contained in:
PlantUML 2022-02-10 17:36:31 +01:00 committed by GitHub
commit edacfb5dbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 6 deletions

View File

@ -1,4 +1,10 @@
val javacRelease: String by project
// permits to start the build setting the javac release parameter, no parameter means build for java8:
// gradle clean build -x javaDoc -PjavacRelease=8
// gradle clean build -x javaDoc -PjavacRelease=17
// also supported is to build first, with java17, then switch the java version, and run the test with java8:
// gradle clean build -x javaDoc -x test
// gradle test
val javacRelease = (project.findProperty("javacRelease") ?: "8") as String
plugins {
java
@ -52,7 +58,11 @@ sourceSets {
}
tasks.compileJava {
options.release.set(Integer.parseInt(javacRelease))
if (JavaVersion.current().isJava8) {
java.targetCompatibility = JavaVersion.VERSION_1_8
} else {
options.release.set(Integer.parseInt(javacRelease))
}
}
tasks.withType<Jar> {

View File

@ -1,2 +1 @@
javacRelease = 8
version = 1.2022.1-SNAPSHOT

View File

@ -242,14 +242,13 @@
</properties>
</profile>
<profile>
<!-- the source contains java11+ syntax, let mvn shout. allow "mvn test" with java8 as rendering sometimes
can give different results with java8. -->
<id>javac-source-flag</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<!-- maven-compiler-plugin source default with 3.9.0 is still 1.7, so set it for java8. -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</profile>