From ac63a87fff684c5c4eb3b0a2562526e2643378be Mon Sep 17 00:00:00 2001 From: Kengo TODA Date: Thu, 30 Sep 2021 19:07:41 +0800 Subject: [PATCH] SONAR-15470 Do not declare Gradle build dependencies using compile and runtime configurations --- plugins/sonar-xoo-plugin/build.gradle | 4 ++-- server/sonar-auth-bitbucket/build.gradle | 2 +- server/sonar-auth-common/build.gradle | 2 +- server/sonar-auth-github/build.gradle | 2 +- server/sonar-auth-gitlab/build.gradle | 2 +- server/sonar-auth-ldap/build.gradle | 2 +- server/sonar-auth-saml/build.gradle | 2 +- server/sonar-ce-common/build.gradle | 2 +- sonar-application/build.gradle | 2 +- sonar-plugin-api/build.gradle | 7 +++---- sonar-scanner-engine/build.gradle | 2 +- sonar-ws/build.gradle | 2 +- 12 files changed, 15 insertions(+), 16 deletions(-) diff --git a/plugins/sonar-xoo-plugin/build.gradle b/plugins/sonar-xoo-plugin/build.gradle index b4bb30a3c11..f34fd75a325 100644 --- a/plugins/sonar-xoo-plugin/build.gradle +++ b/plugins/sonar-xoo-plugin/build.gradle @@ -1,5 +1,5 @@ configurations { - testCompile.extendsFrom(compileOnly) + testImplementation.extendsFrom(compileOnly) } configureCompileJavaToVersion 8 @@ -31,7 +31,7 @@ jar { ) } into('META-INF/lib') { - from configurations.compile + from configurations.compileClasspath } } diff --git a/server/sonar-auth-bitbucket/build.gradle b/server/sonar-auth-bitbucket/build.gradle index 2e5f80aa76e..80f71c55fa7 100644 --- a/server/sonar-auth-bitbucket/build.gradle +++ b/server/sonar-auth-bitbucket/build.gradle @@ -1,7 +1,7 @@ description = 'SonarQube :: Authentication :: Bitbucket' configurations { - testCompile.extendsFrom compileOnly + testImplementation.extendsFrom compileOnly } dependencies { diff --git a/server/sonar-auth-common/build.gradle b/server/sonar-auth-common/build.gradle index 8adf3d9591e..7c598342345 100644 --- a/server/sonar-auth-common/build.gradle +++ b/server/sonar-auth-common/build.gradle @@ -1,7 +1,7 @@ description = 'SonarQube :: Authentication :: Common' configurations { - testCompile.extendsFrom compileOnly + testImplementation.extendsFrom compileOnly } dependencies { diff --git a/server/sonar-auth-github/build.gradle b/server/sonar-auth-github/build.gradle index b8911ac7943..9dbceacc719 100644 --- a/server/sonar-auth-github/build.gradle +++ b/server/sonar-auth-github/build.gradle @@ -1,7 +1,7 @@ description = 'SonarQube :: Authentication :: GitHub' configurations { - testCompile.extendsFrom compileOnly + testImplementation.extendsFrom compileOnly } dependencies { diff --git a/server/sonar-auth-gitlab/build.gradle b/server/sonar-auth-gitlab/build.gradle index f4c43ca8769..7f679b9506a 100644 --- a/server/sonar-auth-gitlab/build.gradle +++ b/server/sonar-auth-gitlab/build.gradle @@ -1,7 +1,7 @@ description = 'SonarQube :: Authentication :: GitLab' configurations { - testCompile.extendsFrom compileOnly + testImplementation.extendsFrom compileOnly } dependencies { diff --git a/server/sonar-auth-ldap/build.gradle b/server/sonar-auth-ldap/build.gradle index 622b983188a..8af87f30bcb 100644 --- a/server/sonar-auth-ldap/build.gradle +++ b/server/sonar-auth-ldap/build.gradle @@ -1,7 +1,7 @@ description = 'SonarQube :: Authentication :: LDAP' configurations { - testCompile.extendsFrom compileOnly + testImplementation.extendsFrom compileOnly } dependencies { diff --git a/server/sonar-auth-saml/build.gradle b/server/sonar-auth-saml/build.gradle index dd9d2341cb1..168572a6620 100644 --- a/server/sonar-auth-saml/build.gradle +++ b/server/sonar-auth-saml/build.gradle @@ -1,7 +1,7 @@ description = 'SonarQube :: Authentication :: SAML' configurations { - testCompile.extendsFrom compileOnly + testImplementation.extendsFrom compileOnly } ext { diff --git a/server/sonar-ce-common/build.gradle b/server/sonar-ce-common/build.gradle index 800286bde41..02edbe428bc 100644 --- a/server/sonar-ce-common/build.gradle +++ b/server/sonar-ce-common/build.gradle @@ -25,7 +25,7 @@ processResources { } configurations { - testCompile.extendsFrom compileOnly + testImplementation.extendsFrom compileOnly } dependencies { diff --git a/sonar-application/build.gradle b/sonar-application/build.gradle index 70ddc8bb2a3..d9ec42c1f1d 100644 --- a/sonar-application/build.gradle +++ b/sonar-application/build.gradle @@ -90,7 +90,7 @@ task downloadElasticSearch(type: Download) { finalizedBy verifyElasticSearchDownload } -task zip(type: Zip, dependsOn: [configurations.compile, downloadElasticSearch, verifyElasticSearchDownload]) { +task zip(type: Zip, dependsOn: [configurations.compileClasspath, downloadElasticSearch, verifyElasticSearchDownload]) { duplicatesStrategy DuplicatesStrategy.EXCLUDE def archiveDir = "sonarqube-$project.version" diff --git a/sonar-plugin-api/build.gradle b/sonar-plugin-api/build.gradle index 8cdf7778f70..6226e1a77a1 100644 --- a/sonar-plugin-api/build.gradle +++ b/sonar-plugin-api/build.gradle @@ -33,10 +33,9 @@ dependencies { testCompile project(':sonar-plugin-api-impl') } -sourceSets { +configurations { // Make the compileOnly dependencies available when compiling/running tests - test.compileClasspath += configurations.compileOnly + configurations.shadow - test.runtimeClasspath += configurations.compileOnly + configurations.shadow + testImplementation.extendsFrom compileOnly } def on3Digits(version) { @@ -54,7 +53,7 @@ processResources { } shadowJar { - configurations = [project.configurations.default] + configurations = [project.configurations.runtimeClasspath] minimize { exclude(project(':sonar-check-api')) } diff --git a/sonar-scanner-engine/build.gradle b/sonar-scanner-engine/build.gradle index 6c324c325b4..5afaba8d774 100644 --- a/sonar-scanner-engine/build.gradle +++ b/sonar-scanner-engine/build.gradle @@ -10,7 +10,7 @@ sourceSets.test.resources { } configurations { - testCompile.extendsFrom(compileOnly) + testImplementation.extendsFrom(compileOnly) } dependencies { diff --git a/sonar-ws/build.gradle b/sonar-ws/build.gradle index bfb707e01e7..021b9156c2f 100644 --- a/sonar-ws/build.gradle +++ b/sonar-ws/build.gradle @@ -8,7 +8,7 @@ sonarqube { configureCompileJavaToVersion 8 configurations { - testCompile.extendsFrom(compileOnly) + testImplementation.extendsFrom(compileOnly) } dependencies { -- 2.39.5