Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions benchmarks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ dependencies {
// us to invoke the JMH uberjar as usual.
exclude group: 'net.sf.jopt-simple', module: 'jopt-simple'
}
api(project(':libs:elasticsearch-h3'))
api(project(':libs:h3'))
api(project(':modules:aggregations'))
api(project(':x-pack:plugin:esql-core'))
api(project(':x-pack:plugin:esql'))
api(project(':x-pack:plugin:esql:compute'))
implementation project(path: ':libs:elasticsearch-simdvec')
implementation project(path: ':libs:simdvec')
expression(project(path: ':modules:lang-expression', configuration: 'zip'))
painless(project(path: ':modules:lang-painless', configuration: 'zip'))
nativeLib(project(':libs:elasticsearch-native'))
nativeLib(project(':libs:native'))
api "org.openjdk.jmh:jmh-core:$versions.jmh"
annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:$versions.jmh"
// Dependencies of JMH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {

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

configurationCacheCompatible = false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') {
':server:generateModulesList',
':server:generatePluginsList',
':generateProviderImpls',
':libs:elasticsearch-native:elasticsearch-native-libraries:extractLibs',
':libs:native:native-libraries:extractLibs',
':x-pack:libs:es-opensaml-security-api:shadowJar'].collect { elasticsearchProject.right()?.task(it) ?: it })
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ BuildParams.bwcVersions.withIndexCompatible({ it.onOrAfter(Version.fromString(ex
if (unreleasedVersion) {
// For unreleased snapshot versions, build them from source
"oldJar${baseName}"(files(project(unreleasedVersion.gradleProjectPath).tasks.named(buildBwcTaskName(project.name))))
} else if(bwcVersion.onOrAfter('8.7.0') && project.name.endsWith("elasticsearch-logging")==false) {
} else if(bwcVersion.onOrAfter('8.7.0') && project.name.endsWith("logging")==false) {
//there was a package rename in 8.7.0, except for es-logging
"oldJar${baseName}"("org.elasticsearch.plugin:${project.name}:${bwcVersion}")
"oldJar${baseName}"("org.elasticsearch.plugin:elasticsearch-${project.name}:${bwcVersion}")
} else {
// For released versions, download it
"oldJar${baseName}"("org.elasticsearch:${project.name}:${bwcVersion}")
"oldJar${baseName}"("org.elasticsearch:elasticsearch-${project.name}:${bwcVersion}")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public static void configureInputNormalization(Project project) {
}

private static void configureNativeLibraryPath(Project project) {
String nativeProject = ":libs:elasticsearch-native:elasticsearch-native-libraries";
String nativeProject = ":libs:native:native-libraries";
Configuration nativeConfig = project.getConfigurations().create("nativeLibs");
nativeConfig.defaultDependencies(deps -> {
deps.add(project.getDependencies().project(Map.of("path", nativeProject, "configuration", "default")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,12 @@ private static void configureBwcProject(
DistributionProjectArtifact stableAnalysisPluginProjectArtifact = new DistributionProjectArtifact(
new File(
checkoutDir.get(),
relativeDir + "/build/distributions/" + stableApiProject.getName() + "-" + bwcVersion.get() + "-SNAPSHOT.jar"
relativeDir
+ "/build/distributions/elasticsearch-"
+ stableApiProject.getName()
+ "-"
+ bwcVersion.get()
+ "-SNAPSHOT.jar"
),
null
);
Expand Down Expand Up @@ -275,7 +280,7 @@ private static List<DistributionProject> resolveArchiveProjects(File checkoutDir
}

private static List<Project> resolveStableProjects(Project project) {
Set<String> stableProjectNames = Set.of("elasticsearch-logging", "elasticsearch-plugin-api", "elasticsearch-plugin-analysis-api");
Set<String> stableProjectNames = Set.of("logging", "plugin-api", "plugin-analysis-api");
return project.findProject(":libs")
.getSubprojects()
.stream()
Expand Down Expand Up @@ -312,7 +317,9 @@ static void createBuildBwcTask(
c.getOutputs().files(expectedOutputFile);
}
c.getOutputs().doNotCacheIf("BWC distribution caching is disabled for local builds", task -> BuildParams.isCi() == false);
c.getArgs().add(projectPath.replace('/', ':') + ":" + assembleTaskName);
c.getArgs().add("-p");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By using the directory name (which hasn't changed) this allows for bwc builds to run, even though this change has not yet been backported.

c.getArgs().add(projectPath);
c.getArgs().add(assembleTaskName);
if (project.getGradle().getStartParameter().isBuildCacheEnabled()) {
c.getArgs().add("--build-cache");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public class JarHellPrecommitPlugin extends PrecommitPlugin {
public TaskProvider<? extends Task> createTask(Project project) {
project.getPluginManager().apply(JarHellPlugin.class);

if (project.getPath().equals(":libs:elasticsearch-core") == false) {
if (project.getPath().equals(":libs:core") == false) {
// ideally we would configure this as a default dependency. But Default dependencies do not work correctly
// with gradle project dependencies as they're resolved to late in the build and don't setup according task
// dependencies properly
var elasticsearchCoreProject = project.findProject(":libs:elasticsearch-core");
var elasticsearchCoreProject = project.findProject(":libs:core");
if (elasticsearchCoreProject != null) {
project.getDependencies().add("jarHell", elasticsearchCoreProject);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
public class ThirdPartyAuditPrecommitPlugin extends PrecommitPlugin {

public static final String JDK_JAR_HELL_CONFIG_NAME = "jdkJarHell";
public static final String LIBS_ELASTICSEARCH_CORE_PROJECT_PATH = ":libs:elasticsearch-core";
public static final String LIBS_ELASTICSEARCH_CORE_PROJECT_PATH = ":libs:core";

@Override
public TaskProvider<? extends Task> createTask(Project project) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ abstract class AbstractGradleFuncTest extends Specification {
propertiesFile <<
"org.gradle.java.installations.fromEnv=JAVA_HOME,RUNTIME_JAVA_HOME,JAVA15_HOME,JAVA14_HOME,JAVA13_HOME,JAVA12_HOME,JAVA11_HOME,JAVA8_HOME"

def nativeLibsProject = subProject(":libs:elasticsearch-native:elasticsearch-native-libraries")
def nativeLibsProject = subProject(":libs:native:native-libraries")
nativeLibsProject << """
plugins {
id 'base'
Expand Down
2 changes: 1 addition & 1 deletion client/rest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ tasks.named('forbiddenApisTest').configure {
}

// JarHell is part of es server, which we don't want to pull in
// TODO: Not anymore. Now in :libs:elasticsearch-core
// TODO: Not anymore. Now in :libs:core
tasks.named("jarHell").configure {
enabled = false
}
Expand Down
2 changes: 1 addition & 1 deletion client/sniffer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ tasks.named("dependencyLicenses").configure {
}

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

tasks.named("testTestingConventions").configure {
Expand Down
2 changes: 1 addition & 1 deletion client/test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ tasks.named('forbiddenApisTest').configure {
tasks.named("thirdPartyAudit").configure { enabled = false }

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

// TODO: should we have licenses for our test deps?
Expand Down
4 changes: 2 additions & 2 deletions distribution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
}
all {
resolutionStrategy.dependencySubstitution {
substitute module("org.apache.logging.log4j:log4j-core") using project(":libs:elasticsearch-log4j") because "patched to remove JndiLookup clas"}
substitute module("org.apache.logging.log4j:log4j-core") using project(":libs:log4j") because "patched to remove JndiLookup clas"}
}
}

Expand All @@ -291,7 +291,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
libsKeystoreCli project(path: ':distribution:tools:keystore-cli')
libsSecurityCli project(':x-pack:plugin:security:cli')
libsGeoIpCli project(':distribution:tools:geoip-cli')
libsNative project(':libs:elasticsearch-native:elasticsearch-native-libraries')
libsNative project(':libs:native:native-libraries')
}

project.ext {
Expand Down
2 changes: 1 addition & 1 deletion distribution/tools/entitlement-agent/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ configurations {

dependencies {
entitlementBridge project(":distribution:tools:entitlement-bridge")
compileOnly project(":libs:elasticsearch-core")
compileOnly project(":libs:core")
compileOnly project(":distribution:tools:entitlement-runtime")
testImplementation project(":test:framework")
testImplementation project(":distribution:tools:entitlement-bridge")
Expand Down
4 changes: 2 additions & 2 deletions distribution/tools/entitlement-runtime/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ apply plugin: 'elasticsearch.build'
apply plugin: 'elasticsearch.publish'

dependencies {
compileOnly project(':libs:elasticsearch-core') // For @SuppressForbidden
compileOnly project(":libs:elasticsearch-x-content") // for parsing policy files
compileOnly project(':libs:core') // For @SuppressForbidden
compileOnly project(":libs:x-content") // for parsing policy files
compileOnly project(':server') // To access the main server module for special permission checks
compileOnly project(':distribution:tools:entitlement-bridge')
testImplementation project(":test:framework")
Expand Down
4 changes: 2 additions & 2 deletions distribution/tools/geoip-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ base {

dependencies {
compileOnly project(":server")
compileOnly project(":libs:elasticsearch-cli")
compileOnly project(":libs:elasticsearch-x-content")
compileOnly project(":libs:cli")
compileOnly project(":libs:x-content")
testImplementation project(":test:framework")
testImplementation "org.apache.commons:commons-compress:1.26.1"
testImplementation "commons-io:commons-io:2.15.1"
Expand Down
2 changes: 1 addition & 1 deletion distribution/tools/keystore-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ apply plugin: 'elasticsearch.build'

dependencies {
compileOnly project(":server")
compileOnly project(":libs:elasticsearch-cli")
compileOnly project(":libs:cli")
testImplementation project(":test:framework")
testImplementation "com.google.jimfs:jimfs:${versions.jimfs}"
testRuntimeOnly "com.google.guava:guava:${versions.jimfs_guava}"
Expand Down
6 changes: 3 additions & 3 deletions distribution/tools/plugin-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ tasks.named("dependencyLicenses").configure {

dependencies {
compileOnly project(":server")
compileOnly project(":libs:elasticsearch-cli")
implementation project(":libs:elasticsearch-plugin-api")
implementation project(":libs:elasticsearch-plugin-scanner")
compileOnly project(":libs:cli")
implementation project(":libs:plugin-api")
implementation project(":libs:plugin-scanner")
// TODO: asm is picked up from the plugin scanner, we should consolidate so it is not defined twice
implementation 'org.ow2.asm:asm:9.7'
implementation 'org.ow2.asm:asm-tree:9.7'
Expand Down
2 changes: 1 addition & 1 deletion distribution/tools/server-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ apply plugin: 'elasticsearch.build'

dependencies {
compileOnly project(":server")
compileOnly project(":libs:elasticsearch-cli")
compileOnly project(":libs:cli")

testImplementation project(":test:framework")
}
Expand Down
2 changes: 1 addition & 1 deletion distribution/tools/windows-service-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'elasticsearch.build'

dependencies {
compileOnly project(":server")
compileOnly project(":libs:elasticsearch-cli")
compileOnly project(":libs:cli")
compileOnly project(":distribution:tools:server-cli")

testImplementation project(":test:framework")
Expand Down
40 changes: 36 additions & 4 deletions libs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,42 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

configure(childProjects.values() - project('elasticsearch-log4j')) {
configure(childProjects.values()) {

apply plugin: 'base'

/*
* All subprojects are java projects using Elasticsearch's standard build
* tools.
* Although these libs are local to Elasticsearch, they can conflict with other similarly
* named libraries when downloaded into a single directory via maven. Here we set the
* name of all libs to begin with the "elasticsearch-" prefix. Additionally, subprojects
* of libs begin with their parents artifactId.
*/
apply plugin: 'elasticsearch.build'
def baseProject = project
def baseArtifactId = "elasticsearch-${it.name}"
base {
archivesName = baseArtifactId
}
subprojects {
apply plugin: 'base'

def subArtifactId = baseArtifactId
def currentProject = project
while (currentProject != baseProject) {
subArtifactId += "-${currentProject.name}"
currentProject = currentProject.parent
}
base {
archivesName = subArtifactId
}
}

// log4j is a hack, and not really a full elasticsearch built jar
if (project.name != 'log4j') {

/*
* All subprojects are java projects using Elasticsearch's standard build
* tools.
*/
apply plugin: 'elasticsearch.build'
}
}
4 changes: 2 additions & 2 deletions libs/cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ apply plugin: 'elasticsearch.publish'

dependencies {
api 'net.sf.jopt-simple:jopt-simple:5.0.2'
api project(':libs:elasticsearch-core')
api project(':libs:core')

testImplementation(project(":test:framework")) {
exclude group: 'org.elasticsearch', module: 'elasticsearch-cli'
exclude group: 'org.elasticsearch', module: 'cli'
}
}

Expand Down
6 changes: 3 additions & 3 deletions libs/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ apply plugin: 'elasticsearch.mrjar'
dependencies {
// This dependency is used only by :libs:core for null-checking interop with other tools
compileOnly "com.google.code.findbugs:jsr305:3.0.2"
compileOnly project(':libs:elasticsearch-logging')
compileOnly project(':libs:logging')

testImplementation "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}"
testImplementation "junit:junit:${versions.junit}"
testImplementation "org.hamcrest:hamcrest:${versions.hamcrest}"

testImplementation(project(":test:framework")) {
exclude group: 'org.elasticsearch', module: 'elasticsearch-core'
exclude group: 'org.elasticsearch', module: 'core'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the gradle "module name" matter? This PR produces the same artifact ids, though the "name" attribute in the pom is different. Is there a way to control this module name in gradle? I could only find archivesName which we set as the artifactId.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "name" is purely descriptive so I think it's fine if they are different. So long as the artifactId is the same we won't have to deal with updating dependencies.

name: Projects tend to have conversational names, beyond the artifactId. The Sun engineers did not refer to their project as "java-1.5", but rather just called it "Tiger". Here is where to set that value.

}
}

tasks.named('forbiddenApisMain').configure {
// :libs:elasticsearch-core does not depend on server
// :libs:core does not depend on server
// TODO: Need to decide how we want to handle for forbidden signatures with the changes to server
replaceSignatureFiles 'jdk-signatures'
}
Expand Down
2 changes: 1 addition & 1 deletion libs/dissect/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

dependencies {
testImplementation(project(":test:framework")) {
exclude group: 'org.elasticsearch', module: 'elasticsearch-dissect'
exclude group: 'org.elasticsearch', module: 'dissect'
}
testImplementation "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
testImplementation "com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}"
Expand Down
2 changes: 1 addition & 1 deletion libs/geo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ apply plugin: 'elasticsearch.publish'

dependencies {
testImplementation(project(":test:framework")) {
exclude group: 'org.elasticsearch', module: 'elasticsearch-geo'
exclude group: 'org.elasticsearch', module: 'geo'
}
}

Expand Down
2 changes: 1 addition & 1 deletion libs/grok/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies {
api 'org.jruby.jcodings:jcodings:1.0.44'

testImplementation(project(":test:framework")) {
exclude group: 'org.elasticsearch', module: 'elasticsearch-grok'
exclude group: 'org.elasticsearch', module: 'grok'
}
}

Expand Down
4 changes: 2 additions & 2 deletions libs/h3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ apply plugin: 'elasticsearch.publish'

dependencies {
testImplementation(project(":test:framework")) {
exclude group: 'org.elasticsearch', module: 'elasticsearch-geo'
exclude group: 'org.elasticsearch', module: 'geo'
}
// lucene topology library that uses spherical geometry
testImplementation "org.apache.lucene:lucene-spatial3d:${versions.lucene}"
Expand All @@ -40,4 +40,4 @@ licenseFile.set(rootProject.file('licenses/APACHE-LICENSE-2.0.txt'))

tasks.withType(LicenseHeadersTask.class).configureEach {
approvedLicenses = ['Apache', 'Generated', 'Vendored']
}
}
4 changes: 2 additions & 2 deletions libs/logging/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ tasks.named("loggerUsageCheck").configure {enabled = false }

dependencies {
testImplementation(project(":test:framework")) {
exclude group: 'org.elasticsearch', module: 'elasticsearch-logging'
exclude group: 'org.elasticsearch', module: 'logging'
}
}


tasks.named('forbiddenApisMain').configure {
// :libs:elasticsearch-logging does not depend on server
// :libs:logging does not depend on server
replaceSignatureFiles 'jdk-signatures'
}
6 changes: 3 additions & 3 deletions libs/logstash-bridge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ apply plugin: 'elasticsearch.build'

dependencies {
compileOnly project(':server')
compileOnly project(':libs:elasticsearch-core')
compileOnly project(':libs:elasticsearch-plugin-api')
compileOnly project(':libs:elasticsearch-x-content')
compileOnly project(':libs:core')
compileOnly project(':libs:plugin-api')
compileOnly project(':libs:x-content')
compileOnly project(':modules:lang-painless')
compileOnly project(':modules:lang-painless:spi')
compileOnly project(':modules:lang-mustache')
Expand Down
Loading