Skip to content

Commit 01d95f6

Browse files
committed
WIP
1 parent 78b4c97 commit 01d95f6

File tree

3 files changed

+43
-31
lines changed

3 files changed

+43
-31
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/dependencies/rules/ExcludeTransitivesRule.java

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,11 @@ public void execute(ComponentMetadataContext context) {
2020
context.getDetails().allVariants(variant -> {
2121
variant.withDependencies(dependencies -> {
2222
// Exclude all transitive dependencies
23-
if (dependencies.isEmpty()) {
23+
if (dependencies.isEmpty() == false) {
2424
System.out.println(context.getDetails().getId().getGroup() + ":" + context.getDetails().getId().getName());
2525
}
2626
dependencies.clear();
27-
// dependencies.removeIf(p -> {
28-
// System.out.println("p.getName() = " + p.getName());
29-
// return true;
30-
// });
3127
});
3228
});
3329
}
34-
//
35-
// private boolean isCodeQuality(VariantMetadata variant) {
36-
// // System.out.println("CodeQualityRule#context#variantName = " + ((VariantMetadataAdapter)variant).variantName);
37-
// System.out.println("ExcludeTransitivesRule#context#isCodeQuality = " + ((VariantMetadataAdapter) variant).toString());
38-
// try {
39-
// java.lang.reflect.Field field = VariantMetadataAdapter.class.getDeclaredField("variantName");
40-
// field.setAccessible(true);
41-
// Object variantName = field.get(variant);
42-
// System.out.println("ExcludeTransitivesRule#context#variantName = " + variantName);
43-
// } catch (Exception e) {
44-
// System.out.println("Failed to access variantName: " + e.getMessage());
45-
// }
46-
// DependencyContext attribute = variant.getAttributes().getAttribute(DependencyContext.CONTEXT_ATTRIBUTE);
47-
// return attribute != null && DependencyContext.CODE_QUALITY.equals(attribute.getName());
48-
// }
49-
5030
}

settings.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,11 @@ dependencyResolutionManagement {
186186
withModule("org.orbisgis:h2gis-utilities", ExcludeTransitivesRule)
187187
withModule("org.apache.tika:tika-parser-apple-module", ExcludeTransitivesRule)
188188
withModule("io.projectreactor.netty:reactor-netty-core", ExcludeTransitivesRule)
189-
withModule("net.java.dev.jets3t:jets3t", ExcludeTransitivesRule)
189+
//withModule("net.java.dev.jets3t:jets3t", ExcludeTransitivesRule)
190190
withModule("org.apache.hadoop:hadoop-auth", ExcludeTransitivesRule)
191191
withModule("org.apache.hadoop:hadoop-common", ExcludeTransitivesRule)
192192
withModule("org.apache.hadoop:hadoop-yarn-common", ExcludeTransitivesRule)
193-
withModule("org.apache.hadoop:hadoop-minicluster", ExcludeTransitivesRule)
193+
// withModule("org.apache.hadoop:hadoop-minicluster", ExcludeTransitivesRule)
194194
withModule("org.apache.hadoop:hadoop-yarn-common", ExcludeTransitivesRule)
195195
withModule("org.apache.hadoop:hadoop-client-api", ExcludeTransitivesRule)
196196
withModule("net.sf.ehcache:ehcache", ExcludeTransitivesRule)

test/fixtures/hdfs-fixture/build.gradle

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def hdfsVersionAttr = Attribute.of('hdfs.major.version', Integer)
1919

2020
configurations {
2121
hdfs2 {
22+
transitive = false
2223
attributes {
2324
attribute(hdfs2patched, true)
2425
}
@@ -74,8 +75,27 @@ dependencies {
7475
matchingArtifacts = ["hadoop3-common"]
7576
}
7677
}
78+
constraints {
79+
implementation("commons-codec:commons-codec:1.9")
80+
implementation("commons-logging:commons-logging:1.2")
81+
implementation("org.slf4j:slf4j-api:${versions.slf4j}")
82+
}
83+
implementation("org.slf4j:slf4j-api:${versions.slf4j}")
7784

78-
compileOnly("org.apache.hadoop:hadoop-minicluster:2.8.5")
85+
compileOnly("commons-io:commons-io:2.16.1")
86+
compileOnly("org.apache.hadoop:hadoop-common:2.8.5")
87+
compileOnly("org.apache.hadoop:hadoop-annotations:2.8.5")
88+
compileOnly("org.apache.hadoop:hadoop-hdfs:2.8.5")
89+
compileOnly("org.apache.hadoop:hadoop-hdfs:2.8.5:tests")
90+
compileOnly("org.apache.hadoop:hadoop-hdfs-client:2.8.5") {
91+
exclude group: "org.apache.hadoop", module: "hadoop-common"
92+
}
93+
compileOnly("org.apache.hadoop:hadoop-hdfs:2.8.5:tests") {
94+
transitive = false
95+
}
96+
compileOnly("org.apache.hadoop:hadoop-minicluster:2.8.5") {
97+
transitive = false
98+
}
7999
api("com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}") {
80100
transitive = false
81101
}
@@ -116,13 +136,25 @@ dependencies {
116136
[group: "org.slf4j", module: "slf4j-api"],
117137
]
118138

119-
hdfs2("org.apache.hadoop:hadoop-minicluster:2.8.5") {
120-
commonExcludes.each { exclude it }
121-
exclude group: "org.apache.commons", module: "commons-math3"
122-
exclude group: "xmlenc", module: "xmlenc"
123-
exclude group: "net.java.dev.jets3t", module: "jets3t"
124-
exclude group: "org.apache.directory.server", module: "apacheds-i18n"
125-
exclude group: "xerces", module: "xercesImpl"
139+
// hdfs2("org.apache.hadoop:hadoop-hdfs:2.8.5")
140+
hdfs2("commons-io:commons-io:2.16.1")
141+
hdfs2("commons-collections:commons-collections:3.2.1")
142+
hdfs2("commons-configuration:commons-configuration:1.6")
143+
hdfs2("commons-lang:commons-lang:2.6")
144+
hdfs2("org.apache.hadoop:hadoop-auth:2.8.5")
145+
hdfs2("org.apache.hadoop:hadoop-common:2.8.5")
146+
hdfs2("org.apache.hadoop:hadoop-common:2.8.5:tests")
147+
hdfs2("org.apache.hadoop:hadoop-hdfs:2.8.5")
148+
hdfs2("org.apache.hadoop:hadoop-hdfs:2.8.5:tests")
149+
hdfs2("org.apache.hadoop:hadoop-annotations:2.8.5")
150+
hdfs2("org.apache.hadoop:hadoop-hdfs-client:2.8.5")
151+
hdfs2("org.apache.hadoop:hadoop-minicluster:2.8.5") {
152+
commonExcludes.each { exclude it }
153+
exclude group: "org.apache.commons", module: "commons-math3"
154+
exclude group: "xmlenc", module: "xmlenc"
155+
exclude group: "net.java.dev.jets3t", module: "jets3t"
156+
exclude group: "org.apache.directory.server", module: "apacheds-i18n"
157+
exclude group: "xerces", module: "xercesImpl"
126158
}
127159

128160
hdfs3("org.apache.hadoop:hadoop-minicluster:3.3.1") {

0 commit comments

Comments
 (0)