You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by vl...@apache.org on 2019/10/06 21:40:54 UTC

[jmeter] 01/02: Make release scripts compatible with Gradle 5.6

This is an automated email from the ASF dual-hosted git repository.

vladimirsitnikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit 3209697c13c2306b4c6a653cf3911bb7aa76058a
Author: Vladimir Sitnikov <si...@gmail.com>
AuthorDate: Sun Oct 6 22:28:26 2019 +0300

    Make release scripts compatible with Gradle 5.6
    
    Previously the scripts used dependencies between tasks of different modules.
    That is anti-pattern, however it somehow worked in Gradle 5.5.
    For now the configurations are used to make dependencies between modules and to pass files across Gradle modules.
    
    stage-vote-release plugin creates 3 configurations: releaseFiles, releaseSignatures, previewSite
    :src:dist adds artifacts to the configurations, and the root project depends on project(":src:dist", configurationName)
    
    The configuration create/use is hidden in stage-vote-release-plugin itself (see releaseArtifacts)
---
 build.gradle.kts              | 24 +++++++++++++++++-------
 checksum.xml                  | 12 ++++++++++++
 src/dist/build.gradle.kts     | 34 ++++++++++++++++++++--------------
 src/licenses/build.gradle.kts | 16 +++++++++++-----
 4 files changed, 60 insertions(+), 26 deletions(-)

diff --git a/build.gradle.kts b/build.gradle.kts
index 43eeb36..1c5b5fe 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -37,9 +37,9 @@ plugins {
     id("com.diffplug.gradle.spotless") version "3.24.3"
     id("com.github.spotbugs") version "2.0.0"
     id("org.sonarqube") version "2.7.1"
-    id("com.github.vlsi.crlf") version "1.17.0"
-    id("com.github.vlsi.ide") version "1.17.0"
-    id("com.github.vlsi.stage-vote-release") version "1.17.0"
+    id("com.github.vlsi.crlf") version "1.32.0"
+    id("com.github.vlsi.ide") version "1.32.0"
+    id("com.github.vlsi.stage-vote-release") version "1.32.0"
     signing
     publishing
 }
@@ -103,14 +103,24 @@ val rat by tasks.getting(org.nosphere.apache.rat.RatTask::class) {
     exclude(rootDir.resolve("rat-excludes.txt").readLines())
 }
 
+releaseArtifacts {
+    fromProject(":src:dist")
+    previewSite {
+        into("rat")
+        from(rat) {
+            filteringCharset = "UTF-8"
+            // XML is not really interesting for now
+            exclude("rat-report.xml")
+            // RAT reports have absolute paths, and we don't want to expose them
+            filter { str: String -> str.replace(rootDir.absolutePath, "") }
+        }
+    }
+}
+
 releaseParams {
     tlp.set("JMeter")
     releaseTag.set("v${project.version.toString().replace('.', '_')}")
     rcTag.set(releaseTag.map { "${it}_RC" + rc.get() })
-    previewSiteContents {
-        into("rat")
-        from(rat)
-    }
     svnDist {
         // All the release versions are put under release/jmeter/{source,binary}
         releaseFolder.set("release/jmeter")
diff --git a/checksum.xml b/checksum.xml
index 671127f..060e655 100644
--- a/checksum.xml
+++ b/checksum.xml
@@ -147,15 +147,27 @@
     <dependency group='com.github.vlsi.gradle' module='crlf-plugin' version='1.17.0'>
       <sha512>473E13699DDDE54F2B7245BB33A47346E907179F7C528751B0BB730005BCAF3FFCDBE3F1333655D635B0EE2683FC8B24F2BD598922F9DA3DA03F8EC25A373AA1</sha512>
     </dependency>
+    <dependency group='com.github.vlsi.gradle' module='crlf-plugin' version='1.32.0'>
+      <sha512>8895959EBFEF1D14960AB48E393D64F86647C79D8FBAA938DF8020C0CC7F4CF8E895265F090D333C0F8D57C7E151F7F5CC23CCA9FB4E40EB7BD9433D0A6D4EA8</sha512>
+    </dependency>
     <dependency group='com.github.vlsi.gradle' module='ide-plugin' version='1.17.0'>
       <sha512>4321949B8201BA4F0E1F0D977397349C34DF84E4632DAFEE6F221F9AFA176FDD9497C9AFBE7F734E3423BE25351DCA7551F93181CC99A99A24EAAEB43BCBD544</sha512>
     </dependency>
+    <dependency group='com.github.vlsi.gradle' module='ide-plugin' version='1.32.0'>
+      <sha512>E8E0DF90F38DFADF3CB9D84D97FEA7189B1585FBCFACFC8B24E25A25C5B926D98C33064B3B38E4D4AD8CF837E0359EFD03F5CBB6B3EB29AE38B57AF705BF0268</sha512>
+    </dependency>
     <dependency group='com.github.vlsi.gradle' module='license-gather-plugin' version='1.17.0'>
       <sha512>E1EE1396B2838E03FB7C84667BD473BAB558569EB5F1C4CB9B7C6806FDC5C7DABC41AAB1705A0FE73FBDB11624F11A15D7394232F59AC1039EFA197FCB495E67</sha512>
     </dependency>
+    <dependency group='com.github.vlsi.gradle' module='license-gather-plugin' version='1.32.0'>
+      <sha512>819CC5E1C210254E7EC24B5FBF5D4F63901C50512A2252A333C6D815F8AB2C42A6A3FD942AE21CEAC769F9DA22660F4E7C6BD9F30AFF11E8377DFB932F1DAAB4</sha512>
+    </dependency>
     <dependency group='com.github.vlsi.gradle' module='stage-vote-release-plugin' version='1.17.0'>
       <sha512>575A87846F61717B2F220A485B67D253644980A0DD57C8EBD3F07C9D66E9B463115897BFE3364216445CAB4AA09EA4B27070ABA5BE7620A632A95BE3F414D464</sha512>
     </dependency>
+    <dependency group='com.github.vlsi.gradle' module='stage-vote-release-plugin' version='1.32.0'>
+      <sha512>DFAB7A2D627AD025629B5AB500ECC36CFC6B3D683D50FBB1AE9CB3DAB5EE3547BCFF2E61C79AA33E952ACFEB1CC367691BF8D2BA180D96F40D5CF64EEDD1CC49</sha512>
+    </dependency>
     <dependency group='commons-logging' module='commons-logging' version='1.0.4'>
       <sha512>C8D2D39A60ADCC49091D393DAF30473D1776E4B6B09BB86639171F660833A17AFBDC9F3E85843093535DA16FA664CD7CD4CA38F54E141018DD1B78DE681AD668</sha512>
     </dependency>
diff --git a/src/dist/build.gradle.kts b/src/dist/build.gradle.kts
index 2956106..f15f54f 100644
--- a/src/dist/build.gradle.kts
+++ b/src/dist/build.gradle.kts
@@ -50,9 +50,16 @@ var jars = arrayOf(
         ":src:protocol:native",
         ":src:protocol:tcp")
 
-val buildDocs by configurations.creating
-val binLicense by configurations.creating
-val srcLicense by configurations.creating
+// isCanBeConsumed = false ==> other modules must not use the configuration as a dependency
+val buildDocs by configurations.creating {
+    isCanBeConsumed = false
+}
+val binLicense by configurations.creating {
+    isCanBeConsumed = false
+}
+val srcLicense by configurations.creating {
+    isCanBeConsumed = false
+}
 
 // Note: you can inspect final classpath (list of jars in the binary distribution)  via
 // gw dependencies --configuration runtimeClasspath
@@ -354,10 +361,12 @@ fun CopySpec.siteLayout() {
     manuals()
 }
 
-val previewSite by tasks.registering(Copy::class) {
+// See https://github.com/gradle/gradle/issues/10960
+val previewSiteDir = buildDir.resolve("site")
+val previewSite by tasks.registering(Sync::class) {
     group = JavaBasePlugin.DOCUMENTATION_GROUP
     description = "Creates preview of a site to build/docs/site"
-    into("$buildDir/site")
+    into(previewSiteDir)
     CrLfSpec().run {
         gitattributes(gitProps)
         siteLayout()
@@ -469,19 +478,16 @@ for (type in listOf("binary", "source")) {
                 with(if (type == "source") sourceLayout() else binaryLayout())
             }
         }
-        rootProject.configure<ReleaseExtension> {
-            archive(archiveTask)
+        releaseArtifacts {
+            artifact(archiveTask)
         }
     }
 }
 
-rootProject.configure<ReleaseExtension> {
-    previewSiteContents {
-        CrLfSpec().run {
-            into("site") {
-                gitattributes(gitProps)
-                siteLayout()
-            }
+releaseArtifacts {
+    previewSite(previewSite) {
+        into("site") {
+            from(previewSiteDir)
         }
     }
 }
diff --git a/src/licenses/build.gradle.kts b/src/licenses/build.gradle.kts
index 3367032..e805b8a 100644
--- a/src/licenses/build.gradle.kts
+++ b/src/licenses/build.gradle.kts
@@ -30,9 +30,15 @@ import com.github.vlsi.gradle.release.ExtraLicense
 import com.github.vlsi.gradle.release.dsl.dependencyLicenses
 import com.github.vlsi.gradle.release.dsl.licensesCopySpec
 
-val binaryDependencies by configurations.creating
-val binLicense by configurations.creating
-val srcLicense by configurations.creating
+val binaryDependencies by configurations.creating {
+    isCanBeConsumed = false
+}
+val binLicense by configurations.creating {
+    isCanBeResolved = false
+}
+val srcLicense by configurations.creating {
+    isCanBeResolved = false
+}
 
 dependencies {
     binaryDependencies(project(":src:dist", "runtimeElements"))
@@ -223,10 +229,10 @@ val srcLicenseDir by tasks.registering(Sync::class) {
 }
 
 artifacts {
-    add(binLicense.name, binLicenseDir.get().destinationDir) {
+    add(binLicense.name, buildDir.resolve(binLicenseDir.name)) {
         builtBy(binLicenseDir)
     }
-    add(srcLicense.name, srcLicenseDir.get().destinationDir) {
+    add(srcLicense.name, buildDir.resolve(srcLicenseDir.name)) {
         builtBy(srcLicenseDir)
     }
 }