diff options
-rw-r--r-- | build.gradle | 66 | ||||
-rw-r--r-- | plugins/sonar-xoo-plugin/build.gradle | 2 | ||||
-rw-r--r-- | sonar-check-api/build.gradle | 3 | ||||
-rw-r--r-- | sonar-core/build.gradle | 2 | ||||
-rw-r--r-- | sonar-markdown/build.gradle | 2 | ||||
-rw-r--r-- | sonar-plugin-api-impl/build.gradle | 2 | ||||
-rw-r--r-- | sonar-plugin-api/build.gradle | 2 | ||||
-rw-r--r-- | sonar-scanner-protocol/build.gradle | 2 | ||||
-rw-r--r-- | sonar-testing-harness/build.gradle | 2 | ||||
-rw-r--r-- | sonar-ws/build.gradle | 2 |
10 files changed, 0 insertions, 85 deletions
diff --git a/build.gradle b/build.gradle index 17232a43187..dd6ba0e0bf6 100644 --- a/build.gradle +++ b/build.gradle @@ -130,74 +130,8 @@ subprojects { ext { protobufVersion = '3.19.4' - - // define a method which can be called by project to change Java version to compile to - configureCompileJavaToVersion = { javaVersion -> - if ( javaVersion != 11 & javaVersion != 8) { - throw new InvalidUserDataException("Only Java 8 and 11 are supported") - } - if ( javaVersion == 8 ) { - println "Configuring project ${project.name} to compile to Java ${javaVersion}" - - if (!project.hasProperty('skipJava8Checks')) { - task ensureDependenciesRunOnJava8(dependsOn: [configurations.compileClasspath]) { - ext.readJavaMajorVersion = { classFile -> - classFile.withDataInputStream({ d -> - if (d.skip(7) == 7) { - // read the version of the class file - d.read() - } else { - throw new GradleException("Could not read major version from $classFile") - } - }) - } - - doLast { - [configurations.compileClasspath].each { config -> - config.resolvedConfiguration.files - .findAll({ f -> f.name.endsWith("jar") }) - .each { jarFile -> - def onlyJava8 = true - zipTree(jarFile) - .matching({ - include "**/*.class" - // multi-release jar files were introduced with Java 9 => contains only classes targeting Java 9+ - exclude "META-INF/versions/**" - // ignore module-info existing in some archives for Java 9 forward compatibility - exclude "module-info.class" - }) - .files - .each { classFile -> - int javaMajorVersion = readJavaMajorVersion(classFile) - if (javaMajorVersion > 52) { - println "$classFile has been compiled to a more recent version of Java than 8 (java8=52, java11=55, actual=$javaMajorVersion)" - onlyJava8 = false - } - } - if (!onlyJava8) { - throw new GradleException("Dependency ${jarFile} in configuration ${config.name} contains class file(s) compiled to a Java version > Java 8 (see logs for details)") - } - } - } - } - } - - compileJava.dependsOn ensureDependenciesRunOnJava8 - } - } - - sourceCompatibility = javaVersion - targetCompatibility = javaVersion - - tasks.withType(JavaCompile) { - options.compilerArgs.addAll(['--release', javaVersion + '']) - options.encoding = 'UTF-8' - } - } } - configureCompileJavaToVersion 11 - sonarqube { properties { property 'sonar.moduleKey', project.group + ':' + project.name diff --git a/plugins/sonar-xoo-plugin/build.gradle b/plugins/sonar-xoo-plugin/build.gradle index f34fd75a325..61f7e7e5e1a 100644 --- a/plugins/sonar-xoo-plugin/build.gradle +++ b/plugins/sonar-xoo-plugin/build.gradle @@ -2,8 +2,6 @@ configurations { testImplementation.extendsFrom(compileOnly) } -configureCompileJavaToVersion 8 - dependencies { compile 'com.google.guava:guava' compile 'commons-io:commons-io' diff --git a/sonar-check-api/build.gradle b/sonar-check-api/build.gradle index 910647a60f4..48e230f1617 100644 --- a/sonar-check-api/build.gradle +++ b/sonar-check-api/build.gradle @@ -4,9 +4,6 @@ sonarqube { } } -configureCompileJavaToVersion 8 - - dependencies { compileOnly 'com.google.code.findbugs:jsr305' diff --git a/sonar-core/build.gradle b/sonar-core/build.gradle index 153eb788ec2..024708d515b 100644 --- a/sonar-core/build.gradle +++ b/sonar-core/build.gradle @@ -4,8 +4,6 @@ sonarqube { } } -configureCompileJavaToVersion 8 - dependencies { // please keep list ordered diff --git a/sonar-markdown/build.gradle b/sonar-markdown/build.gradle index f75aae381bf..16e8e834cdc 100644 --- a/sonar-markdown/build.gradle +++ b/sonar-markdown/build.gradle @@ -4,8 +4,6 @@ sonarqube { } } -configureCompileJavaToVersion 8 - dependencies { // please keep list ordered diff --git a/sonar-plugin-api-impl/build.gradle b/sonar-plugin-api-impl/build.gradle index 303fa2f1549..ee9930a295d 100644 --- a/sonar-plugin-api-impl/build.gradle +++ b/sonar-plugin-api-impl/build.gradle @@ -4,8 +4,6 @@ sonarqube { } } -configureCompileJavaToVersion 8 - dependencies { // please keep the list grouped by configuration and ordered by name diff --git a/sonar-plugin-api/build.gradle b/sonar-plugin-api/build.gradle index 59b49a673d7..9dc4e8d4762 100644 --- a/sonar-plugin-api/build.gradle +++ b/sonar-plugin-api/build.gradle @@ -4,8 +4,6 @@ sonarqube { } } -configureCompileJavaToVersion 8 - apply plugin: 'com.github.johnrengelman.shadow' dependencies { diff --git a/sonar-scanner-protocol/build.gradle b/sonar-scanner-protocol/build.gradle index eec132a2f93..b1e3e04f859 100644 --- a/sonar-scanner-protocol/build.gradle +++ b/sonar-scanner-protocol/build.gradle @@ -5,8 +5,6 @@ sonarqube { } } -configureCompileJavaToVersion 8 - dependencies { // please keep the list ordered compile 'com.google.code.gson:gson' diff --git a/sonar-testing-harness/build.gradle b/sonar-testing-harness/build.gradle index d2e4c7b6ab7..1c339ba836d 100644 --- a/sonar-testing-harness/build.gradle +++ b/sonar-testing-harness/build.gradle @@ -4,8 +4,6 @@ sonarqube { } } -configureCompileJavaToVersion 8 - dependencies { // please keep list ordered diff --git a/sonar-ws/build.gradle b/sonar-ws/build.gradle index 021b9156c2f..0665efae5f6 100644 --- a/sonar-ws/build.gradle +++ b/sonar-ws/build.gradle @@ -5,8 +5,6 @@ sonarqube { } } -configureCompileJavaToVersion 8 - configurations { testImplementation.extendsFrom(compileOnly) } |