Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into lucene_changes_synt…
Browse files Browse the repository at this point in the history
…hetic_snapshot
  • Loading branch information
jimczi committed Nov 6, 2024
2 parents a96648d + 604722c commit c810058
Show file tree
Hide file tree
Showing 1,128 changed files with 33,320 additions and 26,606 deletions.
4 changes: 3 additions & 1 deletion .buildkite/packer_cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ for branch in "${branches[@]}"; do
fi

export JAVA_HOME="$HOME/.java/$ES_BUILD_JAVA"
"checkout/${branch}/gradlew" --project-dir "$CHECKOUT_DIR" --parallel -s resolveAllDependencies -Dorg.gradle.warning.mode=none -DisCI
"checkout/${branch}/gradlew" --project-dir "$CHECKOUT_DIR" --parallel -s resolveAllDependencies -Dorg.gradle.warning.mode=none -DisCI --max-workers=4
"checkout/${branch}/gradlew" --stop
pkill -f '.*GradleDaemon.*'
rm -rf "checkout/${branch}"
done
6 changes: 3 additions & 3 deletions .buildkite/scripts/cloud-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

set -euo pipefail

.ci/scripts/run-gradle.sh buildCloudDockerImage
.ci/scripts/run-gradle.sh buildCloudEssDockerImage

ES_VERSION=$(grep 'elasticsearch' build-tools-internal/version.properties | awk '{print $3}')
DOCKER_TAG="docker.elastic.co/elasticsearch-ci/elasticsearch-cloud:${ES_VERSION}-${BUILDKITE_COMMIT:0:7}"
docker tag elasticsearch-cloud:test "$DOCKER_TAG"
DOCKER_TAG="docker.elastic.co/elasticsearch-ci/elasticsearch-cloud-ess:${ES_VERSION}-${BUILDKITE_COMMIT:0:7}"
docker tag elasticsearch-cloud-ess:test "$DOCKER_TAG"

echo "$DOCKER_REGISTRY_PASSWORD" | docker login -u "$DOCKER_REGISTRY_USERNAME" --password-stdin docker.elastic.co
unset DOCKER_REGISTRY_USERNAME DOCKER_REGISTRY_PASSWORD
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/sync-main-to-jdk-branch.yml

This file was deleted.

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 @@ -108,7 +108,7 @@ public void setup() throws IOException {
Settings settings = mode.startsWith("logsdb")
? Settings.builder()
.put("index.mode", "logsdb")
.put(IndexSettings.INDICES_RECOVERY_SOURCE_SYNTHETIC_ENABLED_SETTING.getKey(), true)
.put(IndexSettings.RECOVERY_SOURCE_SYNTHETIC_ENABLED_SETTING.getKey(), true)
.build()
: Settings.EMPTY;
this.mapperService = MapperServiceFactory.create(settings, readMappings(dataset));
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
6 changes: 3 additions & 3 deletions build-tools-internal/src/main/groovy/elasticsearch.ide.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') {
}
}

// modifies the idea module config to enable preview features on 'elasticsearch-native' module
// modifies the idea module config to enable preview features on ':libs:native' module
tasks.register("enablePreviewFeatures") {
group = 'ide'
description = 'Enables preview features on native library module'
dependsOn tasks.named("enableExternalConfiguration")

doLast {
['main', 'test'].each { sourceSet ->
modifyXml(".idea/modules/libs/native/elasticsearch.libs.elasticsearch-native.${sourceSet}.iml") { xml ->
modifyXml(".idea/modules/libs/native/elasticsearch.libs.${project.project(':libs:native').name}.${sourceSet}.iml") { xml ->
xml.component.find { it.'@name' == 'NewModuleRootManager' }?.'@LANGUAGE_LEVEL' = 'JDK_21_PREVIEW'
}
}
Expand All @@ -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 @@ -24,7 +24,7 @@ public enum DockerBase {
// Chainguard based wolfi image with latest jdk
// This is usually updated via renovatebot
// spotless:off
WOLFI("docker.elastic.co/wolfi/chainguard-base:latest@sha256:bf163e1977002301f7b9fd28fe6837a8cb2dd5c83e4cd45fb67fb28d15d5d40f",
WOLFI("docker.elastic.co/wolfi/chainguard-base:latest@sha256:973431347ad45f40e01afbbd010bf9de929c088a63382239b90dd84f39618bc8",
"-wolfi",
"apk"
),
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 @@ -76,12 +76,14 @@ private void registerAndConfigureDistributionArchivesExtension(Project project)
sub.getArtifacts().add(DEFAULT_CONFIGURATION_NAME, distributionArchive.getArchiveTask());
var extractedConfiguration = sub.getConfigurations().create(EXTRACTED_CONFIGURATION_NAME);
extractedConfiguration.setCanBeResolved(false);
extractedConfiguration.setCanBeConsumed(true);
extractedConfiguration.getAttributes()
.attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, ArtifactTypeDefinition.DIRECTORY_TYPE);
sub.getArtifacts().add(EXTRACTED_CONFIGURATION_NAME, distributionArchive.getExpandedDistTask());
// The "composite" configuration is specifically used for resolving transformed artifacts in an included build
var compositeConfiguration = sub.getConfigurations().create(COMPOSITE_CONFIGURATION_NAME);
compositeConfiguration.setCanBeResolved(false);
compositeConfiguration.setCanBeConsumed(true);
compositeConfiguration.getAttributes()
.attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, ArtifactTypeDefinition.DIRECTORY_TYPE);
compositeConfiguration.getAttributes().attribute(Attribute.of("composite", Boolean.class), true);
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");
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 @@ -48,10 +48,11 @@ public class InternalDistributionModuleCheckTaskProvider {
/** ES jars in the lib directory that are not modularized. For now, es-log4j is the only one. */
private static final List<String> ES_JAR_EXCLUDES = List.of("elasticsearch-log4j");

/** List of the current Elasticsearch Java Modules, by name. */
/** List of the current Elasticsearch Java Modules, alphabetically by name. */
private static final List<String> EXPECTED_ES_SERVER_MODULES = List.of(
"org.elasticsearch.base",
"org.elasticsearch.cli",
"org.elasticsearch.entitlement",
"org.elasticsearch.geo",
"org.elasticsearch.grok",
"org.elasticsearch.logging",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
import org.elasticsearch.gradle.VersionProperties;
import org.gradle.api.DefaultTask;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.FileCollectionDependency;
import org.gradle.api.artifacts.component.ModuleComponentIdentifier;
import org.gradle.api.file.FileCollection;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.ProviderFactory;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.TaskAction;
Expand All @@ -26,9 +29,6 @@

import javax.inject.Inject;

import static org.elasticsearch.gradle.DistributionDownloadPlugin.DISTRO_EXTRACTED_CONFIG_PREFIX;
import static org.elasticsearch.gradle.internal.test.rest.compat.compat.LegacyYamlRestCompatTestPlugin.BWC_MINOR_CONFIG_NAME;

public abstract class ResolveAllDependencies extends DefaultTask {

private boolean resolveJavaToolChain = false;
Expand All @@ -37,18 +37,28 @@ public abstract class ResolveAllDependencies extends DefaultTask {
protected abstract JavaToolchainService getJavaToolchainService();

private final ObjectFactory objectFactory;
private final ProviderFactory providerFactory;

private Collection<Configuration> configs;

@Inject
public ResolveAllDependencies(ObjectFactory objectFactory) {
public ResolveAllDependencies(ObjectFactory objectFactory, ProviderFactory providerFactory) {
this.objectFactory = objectFactory;
this.providerFactory = providerFactory;
}

@InputFiles
public FileCollection getResolvedArtifacts() {
return objectFactory.fileCollection()
.from(configs.stream().filter(ResolveAllDependencies::canBeResolved).collect(Collectors.toList()));
return objectFactory.fileCollection().from(configs.stream().filter(ResolveAllDependencies::canBeResolved).map(c -> {
// Make a copy of the configuration, omitting file collection dependencies to avoid building project artifacts
Configuration copy = c.copyRecursive(d -> d instanceof FileCollectionDependency == false);
copy.setCanBeConsumed(false);
return copy;
})
// Include only module dependencies, ignoring things like project dependencies so we don't unnecessarily build stuff
.map(c -> c.getIncoming().artifactView(v -> v.lenient(true).componentFilter(i -> i instanceof ModuleComponentIdentifier)))
.map(artifactView -> providerFactory.provider(artifactView::getFiles))
.collect(Collectors.toList()));
}

@TaskAction
Expand Down Expand Up @@ -95,8 +105,8 @@ private static boolean canBeResolved(Configuration configuration) {
return false;
}
}
return configuration.getName().startsWith(DISTRO_EXTRACTED_CONFIG_PREFIX) == false
&& configuration.getName().equals(BWC_MINOR_CONFIG_NAME) == false;

return true;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
map.put(LegacyRestTestBasePlugin.class, ":plugins:repository-hdfs");
map.put(LegacyRestTestBasePlugin.class, ":plugins:store-smb");
map.put(LegacyRestTestBasePlugin.class, ":qa:ccs-rolling-upgrade-remote-cluster");
map.put(LegacyRestTestBasePlugin.class, ":qa:ccs-unavailable-clusters");
map.put(LegacyRestTestBasePlugin.class, ":qa:logging-config");
map.put(LegacyRestTestBasePlugin.class, ":qa:mixed-cluster");
map.put(LegacyRestTestBasePlugin.class, ":qa:multi-cluster-search");
map.put(LegacyRestTestBasePlugin.class, ":qa:remote-clusters");
Expand All @@ -65,15 +63,13 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
map.put(LegacyRestTestBasePlugin.class, ":qa:smoke-test-ingest-with-all-dependencies");
map.put(LegacyRestTestBasePlugin.class, ":qa:smoke-test-plugins");
map.put(LegacyRestTestBasePlugin.class, ":qa:system-indices");
map.put(LegacyRestTestBasePlugin.class, ":qa:unconfigured-node-name");
map.put(LegacyRestTestBasePlugin.class, ":qa:verify-version-constants");
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-apm-integration");
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-delayed-aggs");
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-die-with-dignity");
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-error-query");
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-latency-simulating-directory");
map.put(LegacyRestTestBasePlugin.class, ":test:yaml-rest-runner");
map.put(LegacyRestTestBasePlugin.class, ":distribution:archives:integ-test-zip");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:core");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ent-search");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:fleet");
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 @@ -39,7 +39,7 @@
* }
* }
* </pre>
* Will copy the entire core Rest API specifications (assuming the project has tests) and any of the the X-pack specs starting with enrich*.
* Will copy the entire core Rest API specifications (assuming the project has tests) and any of the X-pack specs starting with enrich*.
* It is recommended (but not required) to also explicitly declare which core specs your project depends on to help optimize the caching
* behavior.
* <i>For example:</i>
Expand All @@ -66,7 +66,7 @@
* }
* }
* </pre>
* Will copy any of the the x-pack tests that start with graph, and will copy the X-pack graph specification, as well as the full core
* Will copy any of the x-pack tests that start with graph, and will copy the X-pack graph specification, as well as the full core
* Rest API specification.
* <p>
* Additionally you can specify which sourceSetName resources should be copied to. The default is the yamlRestTest source set.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.elasticsearch.gradle.Version;
import org.elasticsearch.gradle.VersionProperties;
import org.elasticsearch.gradle.distribution.ElasticsearchDistributionTypes;
import org.elasticsearch.gradle.internal.ElasticsearchJavaPlugin;
import org.elasticsearch.gradle.internal.ElasticsearchJavaBasePlugin;
import org.elasticsearch.gradle.internal.InternalDistributionDownloadPlugin;
import org.elasticsearch.gradle.internal.info.BuildParams;
import org.elasticsearch.gradle.internal.test.ErrorReportingTestListener;
Expand Down Expand Up @@ -90,7 +90,7 @@ public RestTestBasePlugin(ProviderFactory providerFactory) {

@Override
public void apply(Project project) {
project.getPluginManager().apply(ElasticsearchJavaPlugin.class);
project.getPluginManager().apply(ElasticsearchJavaBasePlugin.class);
project.getPluginManager().apply(InternalDistributionDownloadPlugin.class);

// Register integ-test and default distributions
Expand Down
2 changes: 1 addition & 1 deletion build-tools-internal/version.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ elasticsearch = 9.0.0
lucene = 10.0.0

bundled_jdk_vendor = openjdk
bundled_jdk = 22.0.1+8@c7ec1332f7bb44aeba2eb341ae18aca4
bundled_jdk = 23+37@3c5b90190c68498b986a97f276efd28a
# optional dependencies
spatial4j = 0.7
jts = 1.15.0
Expand Down
Loading

0 comments on commit c810058

Please sign in to comment.