Skip to content

Commit dedf9fd

Browse files
authored
Use directory name as project name for libs (#115720) (#115984)
* Use directory name as project name for libs (#115720) The libs projects are configured to all begin with `elasticsearch-`. While this is desireable for the artifacts to contain this consistent prefix, it means the project names don't match up with their directories. Additionally, it creates complexities for subproject naming that must be manually adjusted. This commit adjusts the project names for those under libs to be their directory names. The resulting artifacts for these libs are kept the same, all beginning with `elasticsearch-`. * fixes
1 parent c8a3f37 commit dedf9fd

File tree

67 files changed

+169
-139
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+169
-139
lines changed

benchmarks/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ dependencies {
4040
// us to invoke the JMH uberjar as usual.
4141
exclude group: 'net.sf.jopt-simple', module: 'jopt-simple'
4242
}
43-
api(project(':libs:elasticsearch-h3'))
43+
api(project(':libs:h3'))
4444
api(project(':modules:aggregations'))
4545
api(project(':x-pack:plugin:esql-core'))
4646
api(project(':x-pack:plugin:esql'))
4747
api(project(':x-pack:plugin:esql:compute'))
48-
implementation project(path: ':libs:elasticsearch-simdvec')
48+
implementation project(path: ':libs:simdvec')
4949
expression(project(path: ':modules:lang-expression', configuration: 'zip'))
5050
painless(project(path: ':modules:lang-painless', configuration: 'zip'))
51-
nativeLib(project(':libs:elasticsearch-native'))
51+
nativeLib(project(':libs:native'))
5252
api "org.openjdk.jmh:jmh-core:$versions.jmh"
5353
annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:$versions.jmh"
5454
// Dependencies of JMH

build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/PublishPluginFuncTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
1818

1919
def setup() {
2020
// required for JarHell to work
21-
subProject(":libs:elasticsearch-core") << "apply plugin:'java'"
21+
subProject(":libs:core") << "apply plugin:'java'"
2222

2323
configurationCacheCompatible = false
2424
}

build-tools-internal/src/main/groovy/elasticsearch.ide.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') {
131131
':server:generateModulesList',
132132
':server:generatePluginsList',
133133
':generateProviderImpls',
134-
':libs:elasticsearch-native:elasticsearch-native-libraries:extractLibs',
134+
':libs:native:native-libraries:extractLibs',
135135
':x-pack:libs:es-opensaml-security-api:shadowJar'].collect { elasticsearchProject.right()?.task(it) ?: it })
136136
}
137137

build-tools-internal/src/main/groovy/elasticsearch.stable-api.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ BuildParams.bwcVersions.withIndexCompatible({ it.onOrAfter(Version.fromString(ex
3333
if (unreleasedVersion) {
3434
// For unreleased snapshot versions, build them from source
3535
"oldJar${baseName}"(files(project(unreleasedVersion.gradleProjectPath).tasks.named(buildBwcTaskName(project.name))))
36-
} else if(bwcVersion.onOrAfter('8.7.0') && project.name.endsWith("elasticsearch-logging")==false) {
36+
} else if(bwcVersion.onOrAfter('8.7.0') && project.name.endsWith("logging")==false) {
3737
//there was a package rename in 8.7.0, except for es-logging
38-
"oldJar${baseName}"("org.elasticsearch.plugin:${project.name}:${bwcVersion}")
38+
"oldJar${baseName}"("org.elasticsearch.plugin:elasticsearch-${project.name}:${bwcVersion}")
3939
} else {
4040
// For released versions, download it
41-
"oldJar${baseName}"("org.elasticsearch:${project.name}:${bwcVersion}")
41+
"oldJar${baseName}"("org.elasticsearch:elasticsearch-${project.name}:${bwcVersion}")
4242
}
4343
}
4444

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public static void configureInputNormalization(Project project) {
177177
}
178178

179179
private static void configureNativeLibraryPath(Project project) {
180-
String nativeProject = ":libs:elasticsearch-native:elasticsearch-native-libraries";
180+
String nativeProject = ":libs:native:native-libraries";
181181
Configuration nativeConfig = project.getConfigurations().create("nativeLibs");
182182
nativeConfig.defaultDependencies(deps -> {
183183
deps.add(project.getDependencies().project(Map.of("path", nativeProject, "configuration", "default")));

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,12 @@ private static void configureBwcProject(
165165
DistributionProjectArtifact stableAnalysisPluginProjectArtifact = new DistributionProjectArtifact(
166166
new File(
167167
checkoutDir.get(),
168-
relativeDir + "/build/distributions/" + stableApiProject.getName() + "-" + bwcVersion.get() + "-SNAPSHOT.jar"
168+
relativeDir
169+
+ "/build/distributions/elasticsearch-"
170+
+ stableApiProject.getName()
171+
+ "-"
172+
+ bwcVersion.get()
173+
+ "-SNAPSHOT.jar"
169174
),
170175
null
171176
);
@@ -275,7 +280,7 @@ private static List<DistributionProject> resolveArchiveProjects(File checkoutDir
275280
}
276281

277282
private static List<Project> resolveStableProjects(Project project) {
278-
Set<String> stableProjectNames = Set.of("elasticsearch-logging", "elasticsearch-plugin-api", "elasticsearch-plugin-analysis-api");
283+
Set<String> stableProjectNames = Set.of("logging", "plugin-api", "plugin-analysis-api");
279284
return project.findProject(":libs")
280285
.getSubprojects()
281286
.stream()
@@ -312,7 +317,9 @@ static void createBuildBwcTask(
312317
c.getOutputs().files(expectedOutputFile);
313318
}
314319
c.getOutputs().doNotCacheIf("BWC distribution caching is disabled for local builds", task -> BuildParams.isCi() == false);
315-
c.getArgs().add(projectPath.replace('/', ':') + ":" + assembleTaskName);
320+
c.getArgs().add("-p");
321+
c.getArgs().add(projectPath);
322+
c.getArgs().add(assembleTaskName);
316323
if (project.getGradle().getStartParameter().isBuildCacheEnabled()) {
317324
c.getArgs().add("--build-cache");
318325
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public class JarHellPrecommitPlugin extends PrecommitPlugin {
2121
public TaskProvider<? extends Task> createTask(Project project) {
2222
project.getPluginManager().apply(JarHellPlugin.class);
2323

24-
if (project.getPath().equals(":libs:elasticsearch-core") == false) {
24+
if (project.getPath().equals(":libs:core") == false) {
2525
// ideally we would configure this as a default dependency. But Default dependencies do not work correctly
2626
// with gradle project dependencies as they're resolved to late in the build and don't setup according task
2727
// dependencies properly
28-
var elasticsearchCoreProject = project.findProject(":libs:elasticsearch-core");
28+
var elasticsearchCoreProject = project.findProject(":libs:core");
2929
if (elasticsearchCoreProject != null) {
3030
project.getDependencies().add("jarHell", elasticsearchCoreProject);
3131
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
public class ThirdPartyAuditPrecommitPlugin extends PrecommitPlugin {
2828

2929
public static final String JDK_JAR_HELL_CONFIG_NAME = "jdkJarHell";
30-
public static final String LIBS_ELASTICSEARCH_CORE_PROJECT_PATH = ":libs:elasticsearch-core";
30+
public static final String LIBS_ELASTICSEARCH_CORE_PROJECT_PATH = ":libs:core";
3131

3232
@Override
3333
public TaskProvider<? extends Task> createTask(Project project) {

build-tools/src/testFixtures/groovy/org/elasticsearch/gradle/fixtures/AbstractGradleFuncTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ abstract class AbstractGradleFuncTest extends Specification {
5656
propertiesFile <<
5757
"org.gradle.java.installations.fromEnv=JAVA_HOME,RUNTIME_JAVA_HOME,JAVA15_HOME,JAVA14_HOME,JAVA13_HOME,JAVA12_HOME,JAVA11_HOME,JAVA8_HOME"
5858

59-
def nativeLibsProject = subProject(":libs:elasticsearch-native:elasticsearch-native-libraries")
59+
def nativeLibsProject = subProject(":libs:native:native-libraries")
6060
nativeLibsProject << """
6161
plugins {
6262
id 'base'

client/rest/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ tasks.named('forbiddenApisTest').configure {
7979
}
8080

8181
// JarHell is part of es server, which we don't want to pull in
82-
// TODO: Not anymore. Now in :libs:elasticsearch-core
82+
// TODO: Not anymore. Now in :libs:core
8383
tasks.named("jarHell").configure {
8484
enabled = false
8585
}

0 commit comments

Comments
 (0)