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 0bf8b14  Perform geode-old-versions actions in parallel
0bf8b14 is described below

commit 0bf8b14db69a952fd57c66ffe351b1fd42735209
Author: Robert Houghton <[email protected]>
AuthorDate: Thu Jan 31 15:50:47 2019 -0800

    Perform geode-old-versions actions in parallel
    
    This project does download of old versions of Geode and its dependencies
    in series, due to Gradle limitations. Split these configurations into
    separate projects that are resolved at compile-time in parallel.
    
    Co-authored-by: Robert Houghton <[email protected]>
    Co-authored-by: Patrick Rhomberg <[email protected]>
---
 .../geode/test/junit/rules/GfshRuleTest.java       |   3 +-
 geode-old-versions/build.gradle                    | 140 ++++++++++-----------
 gradle.properties                                  |   2 +-
 settings.gradle                                    |  14 ++-
 4 files changed, 85 insertions(+), 74 deletions(-)

diff --git 
a/geode-assembly/src/test/java/org/apache/geode/test/junit/rules/GfshRuleTest.java
 
b/geode-assembly/src/test/java/org/apache/geode/test/junit/rules/GfshRuleTest.java
index ec887dc..7b6bd26 100644
--- 
a/geode-assembly/src/test/java/org/apache/geode/test/junit/rules/GfshRuleTest.java
+++ 
b/geode-assembly/src/test/java/org/apache/geode/test/junit/rules/GfshRuleTest.java
@@ -45,7 +45,8 @@ public class GfshRuleTest {
   @Test
   public void checkGfsh130() {
     assertThat(gfsh130.getGfshPath().toString())
-        
.contains(Paths.get("geode-old-versions/build/apache-geode-1.3.0/bin/gfsh").toString());
+        
.contains(Paths.get("geode-old-versions/1.3.0/build/apache-geode-1.3.0/bin/gfsh")
+            .toString());
   }
 
 }
diff --git a/geode-old-versions/build.gradle b/geode-old-versions/build.gradle
index 6468986..0a1d379 100644
--- a/geode-old-versions/build.gradle
+++ b/geode-old-versions/build.gradle
@@ -1,3 +1,5 @@
+import java.nio.file.Paths
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -15,100 +17,96 @@
  * limitations under the License.
  */
 
-def generatedResources = "$buildDir/generated-resources/main"
 project.ext.installs = new Properties()
+project.ext.versions = new Properties()
+
+subprojects {
+  def oldGeodeVersion = project.name
+
+  boolean useTgz = (oldGeodeVersion >= "1.7.0")
+  boolean downloadInstall = (oldGeodeVersion >= "1.2.0")
+
+  String archiveType = useTgz ? "tgz" : "zip"
+
+  // Each project is named after its fixed version, removing dots and removing 
any release tags.
+  // eg: 1.0.0-incubating -> test100
+  def projSrcName = "test".concat(oldGeodeVersion.split(/\.|-/)
+      .toList()
+      .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}"
+  }
 
-task createGeodeClasspathsFile {
-  File classpathsFile = 
file("$generatedResources/geodeOldVersionClasspaths.txt")
-  File installsFile = file("$generatedResources/geodeOldVersionInstalls.txt")
-  outputs.file(classpathsFile)
-  outputs.file(installsFile)
+  parent.ext.versions.setProperty(projSrcName, 
sourceSets.main.runtimeClasspath.asPath)
 
+  def unpackDest = 
project.buildDir.toPath().resolve('apache-geode-'.concat(oldGeodeVersion))
 
-  // Add sourceSets for backwards compatibility, rolling upgrade, and
-  // pdx testing.
-  addOldVersion('test100', '1.0.0-incubating', false, false)
-  addOldVersion('test110', '1.1.0', false, false)
-  addOldVersion('test111', '1.1.1', false, false)
-  addOldVersion('test120', '1.2.0', true, false)
-  addOldVersion('test130', '1.3.0', true, false)
-  addOldVersion('test140', '1.4.0', true, false)
-  addOldVersion('test150', '1.5.0', true, false)
-  addOldVersion('test160', '1.6.0', true, false)
-  addOldVersion('test170', '1.7.0', true, false)
-  addOldVersion('test180', '1.8.0', true)
+  project.configurations.create("oldInstall")
 
-  doLast {
-    Properties versions = new Properties()
-    project(':geode-old-versions').sourceSets.each {
-      versions.setProperty(it.name,it.runtimeClasspath.getAsPath())
-    }
+  if (downloadInstall) {
+    project.dependencies.add "oldInstall", 
"org.apache.geode:apache-geode:${oldGeodeVersion}@${archiveType}"
 
-    classpathsFile.getParentFile().mkdirs()
+    parent.ext.installs.setProperty(projSrcName, unpackDest.toString())
+  }
+  project.task("downloadAndUnzipFile") {
 
-    new FileOutputStream(classpathsFile).withStream { fos ->
-      versions.store(fos, '')
+    inputs.files {
+      configurations.oldInstall
     }
+    outputs.dir(unpackDest)
 
-    installsFile.getParentFile().mkdirs()
-
-    new FileOutputStream(installsFile).withStream { fos ->
-      project.ext.installs.store(fos, '')
+    doLast {
+      def oldArchive = configurations."oldInstall".singleFile
+      copy {
+        from(useTgz ? tarTree(oldArchive) : zipTree(oldArchive))
+        into project.buildDir
+      }
     }
   }
-}
-createGeodeClasspathsFile.mustRunAfter(clean)
-
-def addOldVersion(def source, def geodeVersion, def downloadInstall, def 
useTgz = true) {
-  sourceSets.create("${source}", {})
-
-  configurations {
-    "${source}Compile"
-  }
+  project.build.dependsOn(project.downloadAndUnzipFile)
+  project.downloadAndUnzipFile.onlyIf {downloadInstall}
 
-  dependencies.add "${source}Compile", 
"org.apache.geode:geode-common:${geodeVersion}"
-  dependencies.add "${source}Compile", 
"org.apache.geode:geode-core:${geodeVersion}"
-  dependencies.add "${source}Compile", 
"org.apache.geode:geode-lucene:${geodeVersion}"
-  dependencies.add "${source}Compile", 
"org.apache.geode:geode-old-client-support:${geodeVersion}"
-  dependencies.add "${source}Compile", 
"org.apache.geode:geode-wan:${geodeVersion}"
-  dependencies.add "${source}Compile", 
"org.apache.geode:geode-cq:${geodeVersion}"
-  dependencies.add "${source}Compile", 
"org.apache.geode:geode-rebalancer:${geodeVersion}"
+  (project.tasks.jar as Task).onlyIf {false}
+}
 
-  if (downloadInstall) {
-    configurations.create("${source}OldInstall")
+def generatedResources = 
buildDir.toPath().resolve('generated-resources').resolve('main').toString()
+task 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 )
 
-    def archiveType = "tgz"
-    def extractMethod = "tarTree"
-    if (!useTgz) {
-      archiveType = "zip"
-      extractMethod = "zipTree"
+  doLast {
+    sourceSets.each { sset ->
+      project.ext.versions.setProperty(sset.name, sset.runtimeClasspath.asPath)
     }
 
-    dependencies {
-      "${source}OldInstall"  
"org.apache.geode:apache-geode:${geodeVersion}@${archiveType}"
+    new FileOutputStream(classpathsFile).withStream { fos ->
+      project.ext.versions.store(fos, '')
     }
 
-    project.ext.installs.setProperty(source, 
"${buildDir}/apache-geode-${geodeVersion}")
-
-    task("downloadAndUnzipFile${geodeVersion}") {
-      inputs.files {
-        configurations."${source}OldInstall"
-      }
-
-      outputs.dir("${buildDir}/apache-geode-${geodeVersion}")
-      doLast {
-        copy {
-          from 
"${extractMethod}"(configurations."${source}OldInstall".singleFile)
-          into project.buildDir
-        }
-      }
+    // TODO potential caching issue with implicit configuration in doLast 
action.
+    new FileOutputStream(installsFile).withStream { fos ->
+      project.ext.installs.store(fos, '')
     }
-    createGeodeClasspathsFile.dependsOn 
tasks["downloadAndUnzipFile${geodeVersion}"]
   }
 }
 
+project.createGeodeClasspathsFile.mustRunAfter(clean)
+project.createGeodeClasspathsFile.inputs.files(getTasksByName('downloadAndUnzipFile',
 true))
+project.build.dependsOn(createGeodeClasspathsFile)
+
 sourceSets {
   main {
-    output.dir(generatedResources, builtBy: 'createGeodeClasspathsFile')
+    output.dir(generatedResources, builtBy: createGeodeClasspathsFile)
   }
 }
diff --git a/gradle.properties b/gradle.properties
index 890ed13..9e9f109 100755
--- a/gradle.properties
+++ b/gradle.properties
@@ -78,7 +78,7 @@ org.gradle.caching = true
 org.gradle.configureondemand = false
 org.gradle.daemon = true
 org.gradle.jvmargs = -Xmx3g
-org.gradle.parallel = false
+org.gradle.parallel = true
 
 org.gradle.internal.http.socketTimeout=120000
 org.gradle.internal.http.connectionTimeout=120000
diff --git a/settings.gradle b/settings.gradle
index 374d3e6..258ada9 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -22,7 +22,7 @@ rootProject.name = 'geode'
 // We want to see all test results.  This is equivalent to setting --continue 
on the command line.
 gradle.startParameter.continueOnFailure = true
 
-include 'geode-old-versions'
+
 include 'geode-common'
 include 'geode-json'
 include 'geode-junit'
@@ -60,6 +60,18 @@ include 'geode-concurrency-test'
 include 'boms:geode-client-bom'
 include 'boms:geode-all-bom'
 
+['1.0.0-incubating',
+ '1.1.0',
+ '1.1.1',
+ '1.2.0',
+ '1.3.0',
+ '1.4.0',
+ '1.5.0',
+ '1.6.0',
+ '1.7.0',
+ '1.8.0'].each {
+  include 'geode-old-versions:'.concat(it)
+}
 
 if (GradleVersion.current() < GradleVersion.version(minimumGradleVersion)) {
   throw new GradleException('Running with unsupported Gradle Version. Use 
Gradle Wrapper or with Gradle version >= ' + minimumGradleVersion)

Reply via email to