Skip to content

Commit 58c5dc5

Browse files
committed
Cleanup
1 parent a028c35 commit 58c5dc5

File tree

8 files changed

+14
-96
lines changed

8 files changed

+14
-96
lines changed

build-conventions/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ repositories {
7272
}
7373

7474
dependencies {
75+
constraints {
76+
api("org.slf4j:slf4j-api:2.0.6")
77+
}
7578
api buildLibs.maven.model
7679
api buildLibs.shadow.plugin
7780
api buildLibs.apache.rat

build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/precommit/FormattingPrecommitPlugin.java

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import com.diffplug.gradle.spotless.SpotlessExtension;
1313
import com.diffplug.gradle.spotless.SpotlessPlugin;
1414

15-
import org.elasticsearch.gradle.internal.DependencyContext;
1615
import org.elasticsearch.gradle.internal.conventions.util.Util;
1716
import org.gradle.api.Plugin;
1817
import org.gradle.api.Project;
@@ -44,7 +43,6 @@
4443
*/
4544
public class FormattingPrecommitPlugin implements Plugin<Project> {
4645

47-
@SuppressWarnings("checkstyle:RegexpMultiline")
4846
@Override
4947
public void apply(Project project) {
5048
project.getPluginManager().withPlugin("java-base", javaBasePlugin -> {
@@ -54,22 +52,6 @@ public void apply(Project project) {
5452
// Spotless resolves required dependencies from project repositories, so we need maven central
5553
project.getRepositories().mavenCentral();
5654

57-
// project.getDependencies()
58-
// .components(
59-
// metadataHandler -> metadataHandler.withModule(
60-
// "com.google.googlejavaformat:google-java-format",
61-
// componentMetadataDetails -> componentMetadataDetails.allVariants(
62-
// variant -> variant.withDependencies(depMetadata -> depMetadata.add("com.google.guava:guava:32.1.3-jre"))
63-
// )
64-
// )
65-
// );
66-
project.getConfigurations().matching(spec -> spec.getName().startsWith("spotless")).all(conf -> {
67-
conf.getAttributes()
68-
.attribute(
69-
DependencyContext.CONTEXT_ATTRIBUTE,
70-
project.getObjects().named(DependencyContext.class, DependencyContext.CODE_QUALITY)
71-
);
72-
});
7355
project.getExtensions().getByType(SpotlessExtension.class).java(java -> {
7456
File elasticsearchWorkspace = Util.locateElasticsearchWorkspace(project.getGradle());
7557
String importOrderPath = "build-conventions/elastic.importorder";
@@ -92,7 +74,7 @@ public void apply(Project project) {
9274
// When running build benchmarks we alter the source in some scenarios.
9375
// The gradle-profiler unfortunately does not generate compliant formatted
9476
// sources so we ignore that altered file when running build benchmarks
95-
if (Boolean.getBoolean("BUILD_PERFORMANCE_TEST") && project.getPath().equals(":server")) {
77+
if(Boolean.getBoolean("BUILD_PERFORMANCE_TEST") && project.getPath().equals(":server")) {
9678
java.targetExclude("src/main/java/org/elasticsearch/bootstrap/BootstrapInfo.java");
9779
}
9880
});

build-tools-internal/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@ dependencies {
281281
testImplementation buildLibs.asm
282282
integTestImplementation buildLibs.asm
283283
api(buildLibs.snakeyaml)
284+
api("org.slf4j:slf4j-api:2.0.6") {
285+
because("Align with what we use in production")
286+
}
284287
}
285288
// Forcefully downgrade the jackson platform as used in production
286289
api enforcedPlatform(buildLibs.jackson.platform)

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchJavaBasePlugin.java

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import org.gradle.api.Plugin;
2121
import org.gradle.api.Project;
2222
import org.gradle.api.artifacts.Configuration;
23-
import org.gradle.api.artifacts.ResolutionStrategy;
2423
import org.gradle.api.file.FileCollection;
2524
import org.gradle.api.plugins.JavaBasePlugin;
2625
import org.gradle.api.plugins.JavaPluginExtension;
@@ -64,7 +63,6 @@ public void apply(Project project) {
6463
project.getPluginManager().apply(ElasticsearchTestBasePlugin.class);
6564
project.getPluginManager().apply(PrecommitTaskPlugin.class);
6665
project.getPluginManager().apply(MutedTestPlugin.class);
67-
configureConfigurations(project);
6866
configureCompile(project);
6967
configureInputNormalization(project);
7068
configureNativeLibraryPath(project);
@@ -73,37 +71,6 @@ public void apply(Project project) {
7371
project.getExtensions().getExtraProperties().set("versions", VersionProperties.getVersions());
7472
}
7573

76-
/**
77-
* Makes dependencies non-transitive.
78-
* <p>
79-
* Gradle allows setting all dependencies as non-transitive very easily.
80-
* Sadly this mechanism does not translate into maven pom generation. In order
81-
* to effectively make the pom act as if it has no transitive dependencies,
82-
* we must exclude each transitive dependency of each direct dependency.
83-
* <p>
84-
* Determining the transitive deps of a dependency which has been resolved as
85-
* non-transitive is difficult because the process of resolving removes the
86-
* transitive deps. To sidestep this issue, we create a configuration per
87-
* direct dependency version. This specially named and unique configuration
88-
* will contain all of the transitive dependencies of this particular
89-
* dependency. We can then use this configuration during pom generation
90-
* to iterate the transitive dependencies and add excludes.
91-
*/
92-
public static void configureConfigurations(Project project) {
93-
// we are not shipping these jars, we act like dumb consumers of these things
94-
if (project.getPath().startsWith(":test:fixtures") || project.getPath().equals(":build-tools")) {
95-
return;
96-
}
97-
// fail on any conflicting dependency versions
98-
project.getConfigurations().all(configuration -> {
99-
if (configuration.getName().endsWith("Fixture")) {
100-
// just a self contained test-fixture configuration, likely transitive and hellacious
101-
return;
102-
}
103-
configuration.resolutionStrategy(ResolutionStrategy::failOnVersionConflict);
104-
});
105-
}
106-
10774
/**
10875
* Adds compiler settings to the project
10976
*/

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/CheckstylePrecommitPlugin.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@
99

1010
package org.elasticsearch.gradle.internal.precommit;
1111

12-
import org.elasticsearch.gradle.internal.DependencyContext;
1312
import org.elasticsearch.gradle.internal.conventions.precommit.PrecommitPlugin;
1413
import org.gradle.api.Action;
1514
import org.gradle.api.Project;
1615
import org.gradle.api.Task;
17-
import org.gradle.api.artifacts.Configuration;
1816
import org.gradle.api.artifacts.VersionCatalogsExtension;
1917
import org.gradle.api.artifacts.dsl.DependencyHandler;
2018
import org.gradle.api.plugins.JavaBasePlugin;
@@ -93,12 +91,6 @@ public void execute(Task task) {
9391
project.getPluginManager().apply("checkstyle");
9492
CheckstyleExtension checkstyle = project.getExtensions().getByType(CheckstyleExtension.class);
9593
checkstyle.getConfigDirectory().set(checkstyleDir);
96-
Configuration configuration = project.getConfigurations().getByName("checkstyle");
97-
configuration.getAttributes()
98-
.attribute(
99-
DependencyContext.CONTEXT_ATTRIBUTE,
100-
project.getObjects().named(DependencyContext.class, DependencyContext.CODE_QUALITY)
101-
);
10294
DependencyHandler dependencies = project.getDependencies();
10395
Provider<String> conventionsDependencyProvider = project.provider(
10496
() -> "org.elasticsearch:build-conventions:" + project.getVersion()

distribution/packages/build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ import java.util.regex.Pattern
4242
* dpkg -c path/to/elasticsearch.deb
4343
*/
4444

45+
buildscript {
46+
dependencies {
47+
constraints {
48+
classpath "org.slf4j:slf4j-api:2.0.6"
49+
}
50+
}
51+
}
4552
plugins {
4653
alias(buildLibs.plugins.ospackage)
4754
}

docs/build.gradle

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,6 @@ ext.docsFileTree = fileTree(projectDir) {
3737
}
3838
}
3939

40-
configurations {
41-
testTransi
42-
}
43-
44-
tasks.register('testTrans') {
45-
doLast {
46-
configurations.testTransi.each { File file ->
47-
println file.name
48-
}
49-
}
50-
}
5140
tasks.named("yamlRestTest") {
5241
enabled = false
5342
if (buildParams.snapshotBuild == false) {

gradle/verification-metadata.xml

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4905,36 +4905,11 @@
49054905
<sha256 value="affd06771589ebfe454bb11315a4f466ecaa135b95f3e7939534cf1d2fd7064c" origin="Generated by Gradle"/>
49064906
</artifact>
49074907
</component>
4908-
<component group="org.slf4j" name="slf4j-api" version="1.7.10">
4909-
<artifact name="slf4j-api-1.7.10.jar">
4910-
<sha256 value="3863e27005740d4d1289bf87b113efea115e9a22408a7d623be8004991232bfe" origin="Generated by Gradle"/>
4911-
</artifact>
4912-
</component>
49134908
<component group="org.slf4j" name="slf4j-api" version="1.7.25">
49144909
<artifact name="slf4j-api-1.7.25.jar">
49154910
<sha256 value="18c4a0095d5c1da6b817592e767bb23d29dd2f560ad74df75ff3961dbde25b79" origin="Generated by Gradle"/>
49164911
</artifact>
49174912
</component>
4918-
<component group="org.slf4j" name="slf4j-api" version="1.7.30">
4919-
<artifact name="slf4j-api-1.7.30.jar">
4920-
<sha256 value="cdba07964d1bb40a0761485c6b1e8c2f8fd9eb1d19c53928ac0d7f9510105c57" origin="Generated by Gradle"/>
4921-
</artifact>
4922-
</component>
4923-
<component group="org.slf4j" name="slf4j-api" version="1.7.32">
4924-
<artifact name="slf4j-api-1.7.32.jar">
4925-
<sha256 value="3624f8474c1af46d75f98bc097d7864a323c81b3808aa43689a6e1c601c027be" origin="Generated by Gradle"/>
4926-
</artifact>
4927-
</component>
4928-
<component group="org.slf4j" name="slf4j-api" version="1.7.36">
4929-
<artifact name="slf4j-api-1.7.36.jar">
4930-
<sha256 value="d3ef575e3e4979678dc01bf1dcce51021493b4d11fb7f1be8ad982877c16a1c0" origin="Generated by Gradle"/>
4931-
</artifact>
4932-
</component>
4933-
<component group="org.slf4j" name="slf4j-api" version="1.7.5">
4934-
<artifact name="slf4j-api-1.7.5.jar">
4935-
<sha256 value="fe30825245d2336c859dc38d60c0fc5f3668dbf29cd586828d2b5667ec355b91" origin="Generated by Gradle"/>
4936-
</artifact>
4937-
</component>
49384913
<component group="org.slf4j" name="slf4j-api" version="2.0.17">
49394914
<artifact name="slf4j-api-2.0.17.jar">
49404915
<sha256 value="7b751d952061954d5abfed7181c1f645d336091b679891591d63329c622eb832" origin="Generated by Gradle"/>

0 commit comments

Comments
 (0)