You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by rh...@apache.org on 2019/10/31 14:34:06 UTC

[geode] branch develop updated: GEODE-7340: Dependency cleanup for geode-old-versions (#4209)

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

rhoughton pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 08505d8  GEODE-7340: Dependency cleanup for geode-old-versions (#4209)
08505d8 is described below

commit 08505d8700956dd08cd13f5b6e55147a159eafa2
Author: Robert Houghton <rh...@pivotal.io>
AuthorDate: Thu Oct 31 07:33:41 2019 -0700

    GEODE-7340: Dependency cleanup for geode-old-versions (#4209)
    
    Use test configuration to download, unpack and enumerate geode-old-versions.
    
    Authored-by: Robert Houghton <rh...@pivotal.io>
---
 ci/pipelines/geode-build/jinja.template.yml |  4 +-
 geode-assembly/build.gradle                 |  6 +-
 geode-core/build.gradle                     |  6 +-
 geode-cq/build.gradle                       |  2 +-
 geode-dunit/build.gradle                    |  2 +-
 geode-junit/build.gradle                    |  2 +-
 geode-logging/build.gradle                  |  6 +-
 geode-lucene/build.gradle                   |  2 +-
 geode-old-versions/build.gradle             | 90 +++++++++++++++--------------
 geode-serialization/build.gradle            |  6 +-
 geode-wan/build.gradle                      |  2 +-
 11 files changed, 67 insertions(+), 61 deletions(-)

diff --git a/ci/pipelines/geode-build/jinja.template.yml b/ci/pipelines/geode-build/jinja.template.yml
index 3d3f2e9..bf8ea32 100644
--- a/ci/pipelines/geode-build/jinja.template.yml
+++ b/ci/pipelines/geode-build/jinja.template.yml
@@ -223,8 +223,8 @@ jobs:
   serial: true
   plan:
   - get: geode-ci
+  - get: alpine-tools-image
   - aggregate:
-    - get: alpine-tools-image
     - get: geode
       trigger: true
     - get: geode-build-version
@@ -482,8 +482,8 @@ jobs:
   - get: geode-ci
     passed:
     - Benchmark
+  - get: alpine-tools-image
   - aggregate:
-    - get: alpine-tools-image
     - get: geode
       passed:
       - Benchmark
diff --git a/geode-assembly/build.gradle b/geode-assembly/build.gradle
index 89d8061..6580ae2 100755
--- a/geode-assembly/build.gradle
+++ b/geode-assembly/build.gradle
@@ -193,10 +193,10 @@ dependencies {
   testCompile(project(':geode-log4j')) {
     exclude module: 'geode-core'
   }
-  testRuntime(project(':geode-old-versions'))
+  testRuntime(project(path: ':geode-old-versions', configuration: 'testOutput'))
 
 
-  acceptanceTestRuntime(project(':geode-old-versions'))
+  acceptanceTestRuntime(project(path: ':geode-old-versions', configuration: 'testOutput'))
 
 
   integrationTestCompile(project(':geode-core'))
@@ -284,7 +284,7 @@ dependencies {
   }
   upgradeTestCompile(project(':geode-assembly:geode-assembly-test'))
 
-  upgradeTestRuntime(project(':geode-old-versions'))
+  upgradeTestRuntime(project(path: ':geode-old-versions', configuration: 'testOutput'))
   upgradeTestRuntime(project(':extensions:session-testing-war'))
   upgradeTestRuntime('org.codehaus.cargo:cargo-core-uberjar')
   upgradeTestRuntime('org.apache.httpcomponents:httpclient')
diff --git a/geode-core/build.gradle b/geode-core/build.gradle
index cb32f25..9c01170 100755
--- a/geode-core/build.gradle
+++ b/geode-core/build.gradle
@@ -342,7 +342,7 @@ dependencies {
   testRuntime('commons-io:commons-io')
   testRuntime('commons-validator:commons-validator')
   testRuntime('com.pholser:junit-quickcheck-generators')
-  testRuntime(project(':geode-old-versions'))
+  testRuntime(project(path: ':geode-old-versions', configuration: 'testOutput'))
 
 
   integrationTestCompile(project(':geode-junit')) {
@@ -379,7 +379,7 @@ dependencies {
   distributedTestCompile('com.jayway.jsonpath:json-path-assert')
   distributedTestCompile('net.openhft:compiler')
 
-  distributedTestRuntime(project(':geode-old-versions'))
+  distributedTestRuntime(project(path: ':geode-old-versions', configuration: 'testOutput'))
   distributedTestRuntime('org.apache.derby:derby')
 
 
@@ -387,7 +387,7 @@ dependencies {
     exclude module: 'geode-core'
   }
 
-  upgradeTestRuntime(project(':geode-old-versions'))
+  upgradeTestRuntime(project(path: ':geode-old-versions', configuration: 'testOutput'))
   upgradeTestRuntime(project(':geode-log4j'))
 
 
diff --git a/geode-cq/build.gradle b/geode-cq/build.gradle
index b2cdd6d..11bbe95 100644
--- a/geode-cq/build.gradle
+++ b/geode-cq/build.gradle
@@ -65,7 +65,7 @@ dependencies {
   upgradeTestCompile('org.awaitility:awaitility')
   upgradeTestCompile('org.mockito:mockito-core')
 
-  upgradeTestRuntime(project(':geode-old-versions'))
+  upgradeTestRuntime(project(path: ':geode-old-versions', configuration: 'testOutput'))
 }
 
 ext.moduleName = group + '.cq'
diff --git a/geode-dunit/build.gradle b/geode-dunit/build.gradle
index 5f6e97a..4c8668c 100755
--- a/geode-dunit/build.gradle
+++ b/geode-dunit/build.gradle
@@ -62,7 +62,7 @@ dependencies {
     exclude module: 'hamcrest-core'
   }
 
-  distributedTestRuntime(project(':geode-old-versions'))
+  distributedTestRuntime(project(path: ':geode-old-versions', configuration: 'testOutput'))
 }
 
 distributedTest {
diff --git a/geode-junit/build.gradle b/geode-junit/build.gradle
index da6b0c5..6d376b7 100755
--- a/geode-junit/build.gradle
+++ b/geode-junit/build.gradle
@@ -51,7 +51,7 @@ dependencies {
 
   testCompile('pl.pragmatists:JUnitParams')
 
-  testRuntime(project(':geode-old-versions'))
+  testRuntime(project(path: ':geode-old-versions', configuration: 'testOutput'))
 }
 
 test {
diff --git a/geode-logging/build.gradle b/geode-logging/build.gradle
index 8e1ed52..4aa149d 100644
--- a/geode-logging/build.gradle
+++ b/geode-logging/build.gradle
@@ -36,7 +36,7 @@ dependencies {
     testCompile('junit:junit')
     testCompile('org.assertj:assertj-core')
 
-    testRuntime(project(':geode-old-versions'))
+    testRuntime(project(path: ':geode-old-versions', configuration: 'testOutput'))
 
     integrationTestCompile(project(':geode-junit')) {
         exclude module: 'geode-logging'
@@ -52,8 +52,8 @@ dependencies {
         exclude module: 'geode-logging'
     }
     distributedTestCompile('pl.pragmatists:JUnitParams')
-    distributedTestRuntime(project(':geode-old-versions'))
-    upgradeTestRuntime(project(':geode-old-versions'))
+    distributedTestRuntime(project(path: ':geode-old-versions', configuration: 'testOutput'))
+    upgradeTestRuntime(project(path: ':geode-old-versions', configuration: 'testOutput'))
 
     testImplementation('com.tngtech.archunit:archunit-junit4')
 
diff --git a/geode-lucene/build.gradle b/geode-lucene/build.gradle
index 91c4e30..e8126bc 100644
--- a/geode-lucene/build.gradle
+++ b/geode-lucene/build.gradle
@@ -90,7 +90,7 @@ dependencies {
     exclude module: 'geode-core'
   }
 
-  upgradeTestRuntime(project(':geode-old-versions'))
+  upgradeTestRuntime(project(path: ':geode-old-versions', configuration: 'testOutput'))
 
 
   performanceTestCompile(project(':geode-junit')) {
diff --git a/geode-old-versions/build.gradle b/geode-old-versions/build.gradle
index 32d8d05..8b6fc53 100644
--- a/geode-old-versions/build.gradle
+++ b/geode-old-versions/build.gradle
@@ -17,13 +17,12 @@ import java.nio.file.Paths
  * limitations under the License.
  */
 
-apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle"
+apply from: "${rootProject.rootDir}/gradle/java.gradle"
 
 project.ext.installs = new Properties()
-project.ext.versions = new Properties()
 
 subprojects {
-  apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle"
+  apply plugin: 'base'
 
   def oldGeodeVersion = project.name
 
@@ -40,18 +39,6 @@ subprojects {
       .subList(0,3)
       .join(''))
 
-  project.dependencies {
-    compile "org.apache.geode:geode-common:${oldGeodeVersion}"
-    compile "org.apache.geode:geode-core:${oldGeodeVersion}"
-    compile "org.apache.geode:geode-lucene:${oldGeodeVersion}"
-    compile "org.apache.geode:geode-old-client-support:${oldGeodeVersion}"
-    compile "org.apache.geode:geode-wan:${oldGeodeVersion}"
-    compile "org.apache.geode:geode-cq:${oldGeodeVersion}"
-    compile "org.apache.geode:geode-rebalancer:${oldGeodeVersion}"
-  }
-
-  parent.ext.versions.setProperty(oldGeodeVersion, sourceSets.main.runtimeClasspath.asPath)
-
   def unpackDest = project.buildDir.toPath().resolve('apache-geode-'.concat(oldGeodeVersion))
 
   project.configurations.create("oldInstall")
@@ -60,43 +47,61 @@ subprojects {
     project.dependencies.add "oldInstall", "org.apache.geode:apache-geode:${oldGeodeVersion}@${archiveType}"
 
     parent.ext.installs.setProperty(oldGeodeVersion, unpackDest.toString())
-  }
-  project.task("downloadAndUnzipFile") {
+    project.tasks.register('downloadAndUnzipFile') {
+      onlyIf { downloadInstall }
+      inputs.files {
+        configurations.oldInstall
+      }
+      outputs.dir {
+        file(unpackDest)
+      }
 
-    inputs.files {
-      configurations.oldInstall
+      doLast {
+        def oldArchive = configurations."oldInstall".singleFile
+        copy {
+          from(useTgz ? tarTree(oldArchive) : zipTree(oldArchive))
+          into project.buildDir
+        }
+      }
     }
-    outputs.dir(unpackDest)
-
-    doLast {
-      def oldArchive = configurations."oldInstall".singleFile
-      copy {
-        from(useTgz ? tarTree(oldArchive) : zipTree(oldArchive))
-        into project.buildDir
+    project.tasks.register('enumerateArchiveContents') {
+      onlyIf { downloadInstall }
+      inputs.files {
+        downloadAndUnzipFile
+      }
+      def contentsFile = project.buildDir.toPath().resolve('contents.txt')
+      outputs.files {
+        file(contentsFile)
+      }
+      doLast {
+        new File(contentsFile.toAbsolutePath().toString()).text = file(unpackDest).listFiles()
       }
     }
-  }
-  project.build.dependsOn(project.downloadAndUnzipFile)
-  project.downloadAndUnzipFile.onlyIf {downloadInstall}
+    project.assemble.dependsOn(project.downloadAndUnzipFile)
+    project.assemble.dependsOn(project.enumerateArchiveContents)
 
-  (project.tasks.jar as Task).onlyIf {false}
+  }
 }
 
-def generatedResources = buildDir.toPath().resolve('generated-resources').resolve('main').toString()
-task createGeodeClasspathsFile {
+def generatedResources = buildDir.toPath().resolve('generated-resources').resolve('test').toString()
+tasks.register('createGeodeClasspathsFile') {
   def classpathsFile = Paths.get(generatedResources).resolve('geodeOldVersionClasspaths.txt').toString()
   def installsFile = Paths.get(generatedResources).resolve('geodeOldVersionInstalls.txt').toString()
-  outputs.file(classpathsFile)
-  outputs.file(installsFile)
-//  outputs.cacheIf( false )
+  outputs.files {classpathsFile }
+  outputs.files {installsFile}
 
   doLast {
-    sourceSets.each { sset ->
-      project.ext.versions.setProperty(sset.name, sset.runtimeClasspath.asPath)
-    }
-
     new FileOutputStream(classpathsFile).withStream { fos ->
-      project.ext.versions.store(fos, '')
+      def cp = new Properties()
+      project.ext.installs.each {
+        File libdir = file("${it.value}/lib")
+        FileCollection libJars = layout.files(libdir.listFiles())
+          .filter { File f ->
+            f.name.endsWith('.jar')
+          }
+        cp.setProperty(it.key, libJars.join(':'))
+      }
+      cp.store(fos, '')
     }
 
     // TODO potential caching issue with implicit configuration in doLast action.
@@ -108,10 +113,11 @@ task createGeodeClasspathsFile {
 
 project.createGeodeClasspathsFile.mustRunAfter(clean)
 project.createGeodeClasspathsFile.inputs.files(getTasksByName('downloadAndUnzipFile', true))
-project.build.dependsOn(createGeodeClasspathsFile)
+project.createGeodeClasspathsFile.inputs.files(getTasksByName('enumerateArchiveContents', true))
+project.jarTest.dependsOn(createGeodeClasspathsFile)
 
 sourceSets {
-  main {
+  test {
     output.dir(generatedResources, builtBy: createGeodeClasspathsFile)
   }
 }
diff --git a/geode-serialization/build.gradle b/geode-serialization/build.gradle
index 5197f81..c918683 100755
--- a/geode-serialization/build.gradle
+++ b/geode-serialization/build.gradle
@@ -42,7 +42,7 @@ dependencies {
   testImplementation('junit:junit')
   testImplementation('org.assertj:assertj-core')
 
-  testRuntime(project(':geode-old-versions'))
+  testRuntime(project(path: ':geode-old-versions', configuration: 'testOutput'))
 
   integrationTestImplementation(project(':geode-junit')) {
     exclude module: 'geode-serialization'
@@ -58,8 +58,8 @@ dependencies {
     exclude module: 'geode-serialization'
   }
   distributedTestImplementation('pl.pragmatists:JUnitParams')
-  distributedTestRuntime(project(':geode-old-versions'))
-  upgradeTestRuntime(project(':geode-old-versions'))
+  distributedTestRuntime(project(path: ':geode-old-versions', configuration: 'testOutput'))
+  upgradeTestRuntime(project(path: ':geode-old-versions', configuration: 'testOutput'))
 }
 
 distributedTest {
diff --git a/geode-wan/build.gradle b/geode-wan/build.gradle
index 986a503..1f2df63 100644
--- a/geode-wan/build.gradle
+++ b/geode-wan/build.gradle
@@ -72,5 +72,5 @@ dependencies {
   upgradeTestCompile('org.assertj:assertj-core')
   upgradeTestCompile('junit:junit')
 
-  upgradeTestRuntime(project(':geode-old-versions'))
+  upgradeTestRuntime(project(path: ':geode-old-versions', configuration: 'testOutput'))
 }