diff --git a/plugins/repository-hdfs/build.gradle b/plugins/repository-hdfs/build.gradle index 1ea3577e515f..6436dd2969d6 100644 --- a/plugins/repository-hdfs/build.gradle +++ b/plugins/repository-hdfs/build.gradle @@ -7,15 +7,16 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import org.elasticsearch.gradle.internal.test.RestIntegTestTask + import org.elasticsearch.gradle.OS +import org.elasticsearch.gradle.internal.test.RestIntegTestTask apply plugin: 'elasticsearch.internal-java-rest-test' apply plugin: 'elasticsearch.internal-yaml-rest-test' esplugin { description = 'The HDFS repository plugin adds support for Hadoop Distributed File-System (HDFS) repositories.' - classname ='org.elasticsearch.repositories.hdfs.HdfsPlugin' + classname = 'org.elasticsearch.repositories.hdfs.HdfsPlugin' } versions << [ @@ -23,10 +24,19 @@ versions << [ ] def patched = Attribute.of('patched', Boolean) +def hdfsVersionAttr = Attribute.of('hdfs.major.version', Integer) configurations { - hdfsFixture2 - hdfsFixture3 + hdfsFixture2 { + attributes { + attribute(hdfsVersionAttr, 2) + } + } + hdfsFixture3 { + attributes { + attribute(hdfsVersionAttr, 3) + } + } compileClasspath { attributes { attribute(patched, true) @@ -82,8 +92,8 @@ dependencies { yamlRestTestRuntimeOnly "commons-cli:commons-cli:1.5.0" yamlRestTestRuntimeOnly "org.apache.logging.log4j:log4j-1.2-api:${versions.log4j}" - hdfsFixture2 project(path: ':test:fixtures:hdfs-fixture', configuration: 'shadowedHdfs2') - hdfsFixture3 project(path: ':test:fixtures:hdfs-fixture', configuration: 'shadow') + hdfsFixture2 project(':test:fixtures:hdfs-fixture') + hdfsFixture3 project(':test:fixtures:hdfs-fixture') attributesSchema { attribute(patched) diff --git a/test/fixtures/hdfs-fixture/build.gradle b/test/fixtures/hdfs-fixture/build.gradle index a273f5d6656d..b716659648cf 100644 --- a/test/fixtures/hdfs-fixture/build.gradle +++ b/test/fixtures/hdfs-fixture/build.gradle @@ -15,6 +15,8 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar def hdfs2patched = Attribute.of('hdfs2-patched', Boolean) def hdfs3patched = Attribute.of('hdfs3-patched', Boolean) +def hdfsVersionAttr = Attribute.of('hdfs.major.version', Integer) + configurations { hdfs2 { attributes { @@ -26,7 +28,26 @@ configurations { attribute(hdfs3patched, true) } } - consumable("shadowedHdfs2") + consumable("shadowedHdfs2") { + attributes { + attribute(hdfsVersionAttr, 2) + attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.LIBRARY)) + attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME)) + attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, Integer.parseInt(buildParams.minimumRuntimeVersion.getMajorVersion())) + attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements, LibraryElements.JAR)) + attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling, Bundling.EXTERNAL)) + } + } + consumable("shadowedHdfs3") { + attributes { + attribute(hdfsVersionAttr, 3) + attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.LIBRARY)) + attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME)) + attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, Integer.parseInt(buildParams.minimumRuntimeVersion.getMajorVersion())) + attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements, LibraryElements.JAR)) + attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling, Bundling.EXTERNAL)) + } + } } dependencies { @@ -165,4 +186,5 @@ tasks.withType(ShadowJar).configureEach { artifacts { shadowedHdfs2(hdfs2Jar) + shadowedHdfs3(tasks.named("shadowJar")) } diff --git a/test/fixtures/krb5kdc-fixture/build.gradle b/test/fixtures/krb5kdc-fixture/build.gradle index 887d6a2b6876..1e43e2618a38 100644 --- a/test/fixtures/krb5kdc-fixture/build.gradle +++ b/test/fixtures/krb5kdc-fixture/build.gradle @@ -25,14 +25,6 @@ configurations { all { exclude group: 'org.hamcrest', module: 'hamcrest-core' } - krb5ConfHdfsFile { - canBeConsumed = true - canBeResolved = false - } - krb5KeytabsHdfsDir { - canBeConsumed = true - canBeResolved = false - } } dependencies { diff --git a/x-pack/plugin/searchable-snapshots/qa/hdfs/build.gradle b/x-pack/plugin/searchable-snapshots/qa/hdfs/build.gradle index f0cc0c181f3a..9c574edcf36f 100644 --- a/x-pack/plugin/searchable-snapshots/qa/hdfs/build.gradle +++ b/x-pack/plugin/searchable-snapshots/qa/hdfs/build.gradle @@ -9,11 +9,19 @@ apply plugin: 'elasticsearch.internal-java-rest-test' apply plugin: 'elasticsearch.rest-resources' apply plugin: 'elasticsearch.internal-available-ports' +configurations { + javaRestTestRuntimeClasspath { + attributes { + attribute(Attribute.of('hdfs.major.version', Integer), 2) + } + } +} + dependencies { clusterPlugins project(':plugins:repository-hdfs') javaRestTestImplementation(testArtifact(project(xpackModule('searchable-snapshots')))) javaRestTestCompileOnly project(path: ':test:fixtures:hdfs-fixture') - javaRestTestRuntimeOnly project(path: ':test:fixtures:hdfs-fixture', configuration:"shadowedHdfs2") + javaRestTestRuntimeOnly project(path: ':test:fixtures:hdfs-fixture') javaRestTestImplementation project(':test:fixtures:krb5kdc-fixture') javaRestTestRuntimeOnly "com.google.guava:guava:16.0.1" javaRestTestRuntimeOnly "commons-cli:commons-cli:1.2" diff --git a/x-pack/plugin/snapshot-repo-test-kit/qa/hdfs/build.gradle b/x-pack/plugin/snapshot-repo-test-kit/qa/hdfs/build.gradle index fab8e3d6f403..e92e2a651138 100644 --- a/x-pack/plugin/snapshot-repo-test-kit/qa/hdfs/build.gradle +++ b/x-pack/plugin/snapshot-repo-test-kit/qa/hdfs/build.gradle @@ -8,10 +8,18 @@ apply plugin: 'elasticsearch.internal-java-rest-test' apply plugin: 'elasticsearch.rest-resources' +configurations { + javaRestTestRuntimeClasspath { + attributes { + attribute(Attribute.of('hdfs.major.version', Integer), 3) + } + } +} + dependencies { javaRestTestImplementation testArtifact(project(xpackModule('snapshot-repo-test-kit'))) javaRestTestCompileOnly project(path: ':test:fixtures:hdfs-fixture') - javaRestTestRuntimeOnly project(path: ':test:fixtures:hdfs-fixture', configuration:"shadow") + javaRestTestRuntimeOnly project(path: ':test:fixtures:hdfs-fixture') javaRestTestImplementation project(':test:fixtures:krb5kdc-fixture') javaRestTestImplementation "org.slf4j:slf4j-api:${versions.slf4j}" javaRestTestImplementation "org.slf4j:slf4j-simple:${versions.slf4j}"