From 17706161ba348117f3477fa99264e143804ca679 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 6 Jan 2021 11:41:13 +0100 Subject: [PATCH] Use Java 11 for build but 8 as target platform --- build-plugins/build.gradle | 4 ++ .../com/cloudogu/scm/JavaModulePlugin.groovy | 45 +++++++++++++++++++ build.gradle | 5 --- scm-annotation-processor/build.gradle | 1 + scm-annotations/build.gradle | 1 + scm-core/build.gradle | 1 + scm-dao-xml/build.gradle | 1 + scm-it/build.gradle | 1 + scm-server/build.gradle | 1 + scm-test/build.gradle | 1 + scm-webapp/build.gradle | 3 +- 11 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 build-plugins/src/main/groovy/com/cloudogu/scm/JavaModulePlugin.groovy diff --git a/build-plugins/build.gradle b/build-plugins/build.gradle index 39cfc7009e..0df72a977b 100644 --- a/build-plugins/build.gradle +++ b/build-plugins/build.gradle @@ -44,6 +44,10 @@ dependencies { gradlePlugin { // Define the plugin plugins { + javaModule { + id = 'org.scm-manager.java' + implementationClass = 'com.cloudogu.scm.JavaModulePlugin' + } buildInfo { id = 'org.scm-manager.build-info' implementationClass = 'com.cloudogu.scm.BuildInfoPlugin' diff --git a/build-plugins/src/main/groovy/com/cloudogu/scm/JavaModulePlugin.groovy b/build-plugins/src/main/groovy/com/cloudogu/scm/JavaModulePlugin.groovy new file mode 100644 index 0000000000..e427266868 --- /dev/null +++ b/build-plugins/src/main/groovy/com/cloudogu/scm/JavaModulePlugin.groovy @@ -0,0 +1,45 @@ +/* + * MIT License + * + * Copyright (c) 2020-present Cloudogu GmbH and Contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.cloudogu.scm + +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.jvm.toolchain.JavaLanguageVersion + +class JavaModulePlugin implements Plugin { + + void apply(Project project) { + project.afterEvaluate { + project.java { + toolchain { + languageVersion = JavaLanguageVersion.of(11) + } + } + project.compileJava { + options.release = 8 + } + } + } + +} diff --git a/build.gradle b/build.gradle index 6bb64a4b9d..8a8c035bb4 100644 --- a/build.gradle +++ b/build.gradle @@ -117,11 +117,6 @@ subprojects { } } - project.tasks.withType(JavaCompile) { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - apply from: rootProject.file( 'gradle/dependencies.gradle' ) } diff --git a/scm-annotation-processor/build.gradle b/scm-annotation-processor/build.gradle index 2c59284f8e..c10d1c1077 100644 --- a/scm-annotation-processor/build.gradle +++ b/scm-annotation-processor/build.gradle @@ -24,6 +24,7 @@ plugins { id 'java-library' + id 'org.scm-manager.java' } dependencies { diff --git a/scm-annotations/build.gradle b/scm-annotations/build.gradle index a225c721ea..24accbfc8a 100644 --- a/scm-annotations/build.gradle +++ b/scm-annotations/build.gradle @@ -24,6 +24,7 @@ plugins { id 'java-library' + id 'org.scm-manager.java' } dependencies { diff --git a/scm-core/build.gradle b/scm-core/build.gradle index 170a0f1e2a..2d4b76d497 100644 --- a/scm-core/build.gradle +++ b/scm-core/build.gradle @@ -24,6 +24,7 @@ plugins { id 'java-library' + id 'org.scm-manager.java' id 'org.scm-manager.build-info' } diff --git a/scm-dao-xml/build.gradle b/scm-dao-xml/build.gradle index 4c7c71f059..24c18c8c30 100644 --- a/scm-dao-xml/build.gradle +++ b/scm-dao-xml/build.gradle @@ -24,6 +24,7 @@ plugins { id 'java-library' + id 'org.scm-manager.java' } dependencies { diff --git a/scm-it/build.gradle b/scm-it/build.gradle index 61cdeeb70d..ebb8425d2f 100644 --- a/scm-it/build.gradle +++ b/scm-it/build.gradle @@ -24,6 +24,7 @@ plugins { id 'java-library' + id 'org.scm-manager.java' id 'org.scm-manager.integration-tests' } diff --git a/scm-server/build.gradle b/scm-server/build.gradle index acdd209bff..11dad31b0f 100644 --- a/scm-server/build.gradle +++ b/scm-server/build.gradle @@ -24,6 +24,7 @@ plugins { id 'java-library' + id 'org.scm-manager.java' } dependencies { diff --git a/scm-test/build.gradle b/scm-test/build.gradle index dde34c05b9..29908fb030 100644 --- a/scm-test/build.gradle +++ b/scm-test/build.gradle @@ -24,6 +24,7 @@ plugins { id 'java-library' + id 'org.scm-manager.java' } dependencies { diff --git a/scm-webapp/build.gradle b/scm-webapp/build.gradle index 0fa16fc05c..672dfdeae2 100644 --- a/scm-webapp/build.gradle +++ b/scm-webapp/build.gradle @@ -24,8 +24,9 @@ plugins { id 'war' - id 'org.scm-manager.core-plugins' + id 'org.scm-manager.java' id 'org.scm-manager.serve' + id 'org.scm-manager.core-plugins' id 'io.swagger.core.v3.swagger-gradle-plugin' version '2.1.6' }