GEODE-7340: Dependency cleanup for geode-old-versions (#4209)
Use test configuration to download, unpack and enumerate geode-old-versions.
Authored-by: Robert Houghton <rhoughton@pivotal.io>
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 @@
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 @@
- 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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
* 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 @@
.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 @@
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
- }
- outputs.dir(unpackDest)
-
- doLast {
- def oldArchive = configurations."oldInstall".singleFile
- copy {
- from(useTgz ? tarTree(oldArchive) : zipTree(oldArchive))
- into project.buildDir
+ doLast {
+ def oldArchive = configurations."oldInstall".singleFile
+ copy {
+ from(useTgz ? tarTree(oldArchive) : zipTree(oldArchive))
+ into project.buildDir
+ }
}
}
- }
- project.build.dependsOn(project.downloadAndUnzipFile)
- project.downloadAndUnzipFile.onlyIf {downloadInstall}
+ 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.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 @@
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 @@
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 @@
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 @@
upgradeTestCompile('org.assertj:assertj-core')
upgradeTestCompile('junit:junit')
- upgradeTestRuntime(project(':geode-old-versions'))
+ upgradeTestRuntime(project(path: ':geode-old-versions', configuration: 'testOutput'))
}