@@ -14,8 +14,6 @@ import org.elasticsearch.gradle.Version
14
14
import org.elasticsearch.gradle.internal.info.BuildParams
15
15
import org.elasticsearch.gradle.internal.test.AntFixture
16
16
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
17
- import org.elasticsearch.gradle.transform.UnzipTransform
18
- import org.gradle.api.internal.artifacts.ArtifactAttributes
19
17
20
18
apply plugin : ' elasticsearch.jdk-download'
21
19
apply plugin : ' elasticsearch.internal-testclusters'
@@ -42,29 +40,34 @@ jdks {
42
40
if (Os . isFamily(Os . FAMILY_WINDOWS )) {
43
41
logger. warn(" Disabling repository-old-versions tests because we can't get the pid file on windows" )
44
42
} else {
45
- /* Register a gradle artifact transformation to unpack resolved elasticsearch distributions. We only resolve
46
- * zip files here. Using artifact transforms allow a better caching of the downloaded distros as the
47
- * transformed (unpacked) distro will be cached by gradle resulting in less unpacking
48
- *
43
+ /* Set up tasks to unzip and run the old versions of ES before running the integration tests.
49
44
* To avoid testing against too many old versions, always pick first and last version per major
50
45
*/
51
- project. getDependencies(). registerTransform(UnzipTransform . class, transformSpec -> {
52
- transformSpec. getFrom(). attribute(ArtifactAttributes . ARTIFACT_FORMAT , ArtifactTypeDefinition . ZIP_TYPE );
53
- transformSpec. getTo(). attribute(ArtifactAttributes . ARTIFACT_FORMAT , ArtifactTypeDefinition . DIRECTORY_TYPE );
54
- });
55
-
56
46
for (String versionString : [' 5.0.0' , ' 5.6.16' , ' 6.0.0' , ' 6.8.20' ]) {
57
47
Version version = Version . fromString(versionString)
58
48
String packageName = ' org.elasticsearch.distribution.zip'
59
49
String artifact = " ${ packageName} :elasticsearch:${ version} @zip"
60
50
String versionNoDots = version. toString(). replace(' .' , ' _' )
61
51
String configName = " es${ versionNoDots} "
62
52
63
- def config = configurations. create(configName)
64
- config . getAttributes() . attribute( ArtifactAttributes . ARTIFACT_FORMAT , ArtifactTypeDefinition . DIRECTORY_TYPE );
53
+ configurations. create(configName)
54
+
65
55
dependencies. add(configName, artifact)
66
56
57
+ // TODO Rene: we should be able to replace these unzip tasks with gradle artifact transforms
58
+ TaskProvider<Sync > unzip = tasks. register(" unzipEs${ versionNoDots} " , Sync ) {
59
+ Configuration oldEsDependency = configurations[configName]
60
+ dependsOn oldEsDependency
61
+ /* Use a closure here to delay resolution of the dependency until we need
62
+ * it */
63
+ from {
64
+ oldEsDependency. collect { zipTree(it) }
65
+ }
66
+ into temporaryDir
67
+ }
68
+
67
69
String repoLocation = " ${ buildDir} /cluster/shared/repo/${ versionNoDots} "
70
+
68
71
String clusterName = versionNoDots
69
72
70
73
def testClusterProvider = testClusters. register(clusterName) {
@@ -73,7 +76,8 @@ if (Os.isFamily(Os.FAMILY_WINDOWS)) {
73
76
}
74
77
75
78
TaskProvider<AntFixture > fixture = tasks. register(" oldES${ versionNoDots} Fixture" , AntFixture ) {
76
- dependsOn project. configurations. oldesFixture, jdks. legacy, config
79
+ dependsOn project. configurations. oldesFixture, jdks. legacy
80
+ dependsOn unzip
77
81
executable = " ${ BuildParams.runtimeJavaHome} /bin/java"
78
82
env ' CLASSPATH' , " ${ -> project.configurations.oldesFixture.asPath} "
79
83
// old versions of Elasticsearch need JAVA_HOME
@@ -84,7 +88,7 @@ if (Os.isFamily(Os.FAMILY_WINDOWS)) {
84
88
}
85
89
args ' oldes.OldElasticsearch' ,
86
90
baseDir,
87
- " ${ -> config.getSingleFile ().toPath() } " ,
91
+ unzip . get (). temporaryDir ,
88
92
false ,
89
93
" path.repo: ${ repoLocation} "
90
94
maxWaitInSeconds 60
0 commit comments