jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vladimirsitni...@apache.org
Subject [jmeter] 02/03: Specify versions for all Gradle projects
Date Sat, 09 Nov 2019 17:38:01 GMT
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 ef06709a780bc776ecc3b5d839c424d39bb1aeae
Author: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
AuthorDate: Sat Nov 9 18:53:59 2019 +0300

    Specify versions for all Gradle projects
    
    Even though "projects without versions" might work,
    it seems to be an edge case (e.g. generated pom.xml might contain version=unspecified)
    
    So we specify versions for all the modules, and trim that version from file names when
    generating release artifacts.
---
 .travis.yml               |  3 +++
 build.gradle.kts          |  1 +
 src/dist/build.gradle.kts | 26 ++++++++++++++++++--------
 3 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index f962c6d..ead244d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,10 +7,13 @@ install: true
 before_cache:
   - rm -f  $HOME/.gradle/caches/modules-2/modules-2.lock
   - rm -fr $HOME/.gradle/caches/*/plugin-resolution/
+  - rm -rf $HOME/.m2/repository/org/apache/jmeter
+
 cache:
   directories:
     - $HOME/.gradle/caches/
     - $HOME/.gradle/wrapper/
+    - $HOME/.m2/repository
 
 env:
   global:
diff --git a/build.gradle.kts b/build.gradle.kts
index 3593625..6b4d69f 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -280,6 +280,7 @@ if (enableSpotBugs) {
 val licenseHeaderFile = file("config/license.header.java")
 allprojects {
     group = "org.apache.jmeter"
+    version = rootProject.version
     // JMeter ClassFinder parses "class.path" and tries to find jar names there,
     // so we should produce jars without versions names for now
     // version = rootProject.version
diff --git a/src/dist/build.gradle.kts b/src/dist/build.gradle.kts
index 7242dc2..98c537e 100644
--- a/src/dist/build.gradle.kts
+++ b/src/dist/build.gradle.kts
@@ -53,6 +53,12 @@ var jars = arrayOf(
 val buildDocs by configurations.creating {
     isCanBeConsumed = false
 }
+val generatorJar by configurations.creating {
+    isCanBeConsumed = false
+}
+val junitSampleJar by configurations.creating {
+    isCanBeConsumed = false
+}
 val binLicense by configurations.creating {
     isCanBeConsumed = false
 }
@@ -75,6 +81,8 @@ dependencies {
 
     binLicense(project(":src:licenses", "binLicense"))
     srcLicense(project(":src:licenses", "srcLicense"))
+    generatorJar(project(":src:generator", "archives"))
+    junitSampleJar(project(":src:protocol:junit-sample", "archives"))
 
     buildDocs(platform(project(":src:bom")))
     buildDocs("org.apache.velocity:velocity")
@@ -130,10 +138,10 @@ val populateLibs by tasks.registering {
                         jorphanProject, bshclientProject -> libs
                         else -> libsExt
                     }).from(dep.file) {
-                        // Technically speaking, current JMeter artifacts do not have version
in the name
-                        // however rename is here just in case
+                        // Remove version from the file name
                         rename { dep.name + "." + dep.extension }
                     }
+
                 else -> libs.from(dep.file)
             }
         }
@@ -147,9 +155,6 @@ libsExt.from(populateLibs)
 binLibs.from(populateLibs)
 
 val copyLibs by tasks.registering(Sync::class) {
-    val junitSampleJar = project(":src:protocol:junit-sample").tasks.named(JavaPlugin.JAR_TASK_NAME)
-    dependsOn(junitSampleJar)
-    val generatorJar = project(":src:generator").tasks.named(JavaPlugin.JAR_TASK_NAME)
     // Can't use $rootDir since Gradle somehow reports .gradle/caches/ as "always modified"
     rootSpec.into("$rootDir/lib")
     with(libs)
@@ -158,15 +163,18 @@ val copyLibs by tasks.registering(Sync::class) {
         // it just removes everything it sees.
         // We configure it to keep txt files that should be present there (the files come
from Git source tree)
         include("**/*.txt")
-        // Keep jars in lib/ext so developers don't have to re-install the plugsin again
and again
+        // Keep jars in lib/ext so developers don't have to re-install the plugins again
and again
         include("ext/*.jar")
+        exclude("ext/ApacheJMeter*.jar")
     }
     into("ext") {
         with(libsExt)
-        from(generatorJar)
+        from(files(generatorJar)) {
+            rename { "ApacheJMeter_generator.jar" }
+        }
     }
     into("junit") {
-        from(junitSampleJar) {
+        from(files(junitSampleJar)) {
             rename { "test.jar" }
         }
     }
@@ -472,6 +480,8 @@ for (type in listOf("binary", "source")) {
             // Gradle defaults to the following pattern, and JMeter was using apache-jmeter-5.1_src.zip
             // [baseName]-[appendix]-[version]-[classifier].[extension]
             archiveBaseName.set("apache-jmeter-${rootProject.version}${if (type == "source")
"_src" else ""}")
+            // Discard project version since we want it to be added before "_src"
+            archiveVersion.set("")
             CrLfSpec(eol).run {
                 wa1191SetInputs(gitProps)
                 with(if (type == "source") sourceLayout() else binaryLayout())


Mime
View raw message