Skip to content

Commit f8a0e89

Browse files
committed
Revert "Fix hdfs-related IT tests for java24 (elastic#122044)"
This reverts commit decc551.
1 parent decc551 commit f8a0e89

File tree

11 files changed

+332
-223
lines changed

11 files changed

+332
-223
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/dependencies/patches/hdfs/HdfsClassPatcher.java

Lines changed: 0 additions & 147 deletions
This file was deleted.

plugins/repository-hdfs/build.gradle

Lines changed: 9 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,20 @@ versions << [
2222
'hadoop': '3.4.1'
2323
]
2424

25-
def patched = Attribute.of('patched', Boolean)
26-
2725
configurations {
2826
hdfsFixture2
2927
hdfsFixture3
30-
compileClasspath {
31-
attributes {
32-
attribute(patched, true)
33-
}
34-
}
35-
runtimeClasspath {
36-
attributes {
37-
attribute(patched, true)
38-
}
39-
}
40-
testCompileClasspath {
41-
attributes {
42-
attribute(patched, true)
43-
}
44-
}
45-
testRuntimeClasspath {
46-
attributes {
47-
attribute(patched, true)
48-
}
49-
}
5028
}
5129

5230
dependencies {
53-
api("org.apache.hadoop:hadoop-client-api:${versions.hadoop}")
31+
api project(path: 'hadoop-client-api', configuration: 'default')
32+
if (isEclipse) {
33+
/*
34+
* Eclipse can't pick up the shadow dependency so we point it at *something*
35+
* so it can compile things.
36+
*/
37+
api project(path: 'hadoop-client-api')
38+
}
5439
runtimeOnly "org.apache.hadoop:hadoop-client-runtime:${versions.hadoop}"
5540
implementation "org.apache.hadoop:hadoop-hdfs:${versions.hadoop}"
5641
api "com.google.protobuf:protobuf-java:${versions.protobuf}"
@@ -84,20 +69,6 @@ dependencies {
8469

8570
hdfsFixture2 project(path: ':test:fixtures:hdfs-fixture', configuration: 'shadowedHdfs2')
8671
hdfsFixture3 project(path: ':test:fixtures:hdfs-fixture', configuration: 'shadow')
87-
88-
attributesSchema {
89-
attribute(patched)
90-
}
91-
artifactTypes.getByName("jar") {
92-
attributes.attribute(patched, false)
93-
}
94-
registerTransform(org.elasticsearch.gradle.internal.dependencies.patches.hdfs.HdfsClassPatcher) {
95-
from.attribute(patched, false)
96-
to.attribute(patched, true)
97-
parameters {
98-
matchingArtifacts = ["hadoop-client-api"]
99-
}
100-
}
10172
}
10273

10374
restResources {
@@ -219,15 +190,6 @@ tasks.named("thirdPartyAudit").configure {
219190
'org.apache.hadoop.thirdparty.protobuf.UnsafeUtil$MemoryAccessor',
220191
'org.apache.hadoop.thirdparty.protobuf.MessageSchema',
221192
'org.apache.hadoop.thirdparty.protobuf.UnsafeUtil$Android32MemoryAccessor',
222-
'org.apache.hadoop.thirdparty.protobuf.UnsafeUtil$Android64MemoryAccessor',
223-
'org.apache.hadoop.thirdparty.protobuf.UnsafeUtil$Android64MemoryAccessor',
224-
'org.apache.hadoop.hdfs.shortcircuit.ShortCircuitShm',
225-
'org.apache.hadoop.hdfs.shortcircuit.ShortCircuitShm$Slot',
226-
'org.apache.hadoop.io.FastByteComparisons$LexicographicalComparerHolder$UnsafeComparer',
227-
'org.apache.hadoop.io.FastByteComparisons$LexicographicalComparerHolder$UnsafeComparer$1',
228-
'org.apache.hadoop.io.nativeio.NativeIO',
229-
'org.apache.hadoop.service.launcher.InterruptEscalator',
230-
'org.apache.hadoop.service.launcher.IrqHandler',
231-
'org.apache.hadoop.util.SignalLogger$Handler'
193+
'org.apache.hadoop.thirdparty.protobuf.UnsafeUtil$Android64MemoryAccessor'
232194
)
233195
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import org.gradle.api.file.ArchiveOperations
2+
3+
apply plugin: 'elasticsearch.java'
4+
5+
sourceSets {
6+
patcher
7+
}
8+
9+
configurations {
10+
thejar {
11+
canBeResolved = true
12+
}
13+
}
14+
15+
dependencies {
16+
thejar("org.apache.hadoop:hadoop-client-api:${project.parent.versions.hadoop}") {
17+
transitive = false
18+
}
19+
20+
patcherImplementation 'org.ow2.asm:asm:9.7.1'
21+
patcherImplementation 'org.ow2.asm:asm-tree:9.7.1'
22+
}
23+
24+
def outputDir = layout.buildDirectory.dir("patched-classes")
25+
26+
def patchTask = tasks.register("patchClasses", JavaExec) {
27+
inputs.files(configurations.thejar).withPathSensitivity(PathSensitivity.RELATIVE)
28+
inputs.files(sourceSets.patcher.output).withPathSensitivity(PathSensitivity.RELATIVE)
29+
outputs.dir(outputDir)
30+
classpath = sourceSets.patcher.runtimeClasspath
31+
mainClass = 'org.elasticsearch.hdfs.patch.HdfsClassPatcher'
32+
def thejar = configurations.thejar
33+
doFirst {
34+
args(thejar.singleFile, outputDir.get().asFile)
35+
}
36+
}
37+
38+
interface InjectedArchiveOps {
39+
@Inject ArchiveOperations getArchiveOperations()
40+
}
41+
42+
tasks.named('jar').configure {
43+
dependsOn(configurations.thejar)
44+
def injected = project.objects.newInstance(InjectedArchiveOps)
45+
def thejar = configurations.thejar
46+
from(patchTask)
47+
from({ injected.getArchiveOperations().zipTree(thejar.singleFile) }) {
48+
eachFile {
49+
if (outputDir.get().file(it.relativePath.pathString).asFile.exists()) {
50+
it.exclude()
51+
}
52+
}
53+
}
54+
}

0 commit comments

Comments
 (0)