Skip to content

Commit

Permalink
Merge branch 'main' into left_join_for_lookup_2_take_2
Browse files Browse the repository at this point in the history
  • Loading branch information
nik9000 committed Jan 2, 2025
2 parents aada8b2 + cd2ee4c commit 85c3609
Show file tree
Hide file tree
Showing 814 changed files with 10,434 additions and 1,015 deletions.
4 changes: 2 additions & 2 deletions build-tools-internal/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=89d4e70e4e84e2d2dfbb63e4daa53e21b25017cc70c37e4eea31ee51fb15098a
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
distributionSha256Sum=7ebdac923867a3cec0098302416d1e3c6c0c729fc4e2e05c10637a8af33a76c5
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
esplugin {
name = 'hello-world-plugin'
classname 'org.acme.HelloWorldPlugin'
classname = 'org.acme.HelloWorldPlugin'
description = "shadowed es plugin"
}
Expand Down Expand Up @@ -375,7 +375,7 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
esplugin {
name = 'hello-world-plugin'
classname 'org.acme.HelloWorldPlugin'
classname = 'org.acme.HelloWorldPlugin'
description = "custom project description"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,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:bfdeddb33330a281950c2a54adef991dbbe6a42832bc505d13b11beaf50ae73f",
WOLFI("docker.elastic.co/wolfi/chainguard-base:latest@sha256:eef54b3a414aa53b98f0f8df2633aed83c3ba6230722769282925442968f0364",
"-wolfi",
"apk"
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@ private void registerEmptyDirectoryTasks(Project project) {
});

File pluginsDir = new File(project.getBuildDir(), "plugins-hack/plugins");
project.getExtensions().add("pluginsDir", pluginsDir);
project.getExtensions().getExtraProperties().set("pluginsDir", pluginsDir);
project.getTasks().register("createPluginsDir", EmptyDirTask.class, t -> {
t.setDir(pluginsDir);
t.setDirMode(0755);
});

File jvmOptionsDir = new File(project.getBuildDir(), "jvm-options-hack/jvm.options.d");
project.getExtensions().add("jvmOptionsDir", jvmOptionsDir);
project.getExtensions().getExtraProperties().set("jvmOptionsDir", jvmOptionsDir);
project.getTasks().register("createJvmOptionsDir", EmptyDirTask.class, t -> {
t.setDir(jvmOptionsDir);
t.setDirMode(0750);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,13 @@ private static void configureBwcProject(
// We don't use a normal `Copy` task here as snapshotting the entire gradle user home is very expensive. This task is cheap, so
// up-to-date checking doesn't buy us much
project.getTasks().register("setupGradleUserHome", task -> {
File gradleUserHome = project.getGradle().getGradleUserHomeDir();
String projectName = project.getName();
task.doLast(t -> {
fileSystemOperations.copy(copy -> {
String gradleUserHome = project.getGradle().getGradleUserHomeDir().getAbsolutePath();
copy.into(gradleUserHome + "-" + project.getName());
copy.from(gradleUserHome, copySpec -> {
String absoluteGradleUserHomePath = gradleUserHome.getAbsolutePath();
copy.into(absoluteGradleUserHomePath + "-" + projectName);
copy.from(absoluteGradleUserHomePath, copySpec -> {
copySpec.include("gradle.properties");
copySpec.include("init.d/*");
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public TaskProvider<? extends Task> createTask(Project project) {
File checkstyleDir = new File(project.getBuildDir(), "checkstyle");
File checkstyleSuppressions = new File(checkstyleDir, "checkstyle_suppressions.xml");
File checkstyleConf = new File(checkstyleDir, "checkstyle.xml");
TaskProvider<Task> copyCheckstyleConf = project.getTasks().register("copyCheckstyleConf");
TaskProvider<CopyCheckStyleConfTask> copyCheckstyleConf = project.getTasks()
.register("copyCheckstyleConf", CopyCheckStyleConfTask.class);
// configure inputs and outputs so up to date works properly
copyCheckstyleConf.configure(t -> t.getOutputs().files(checkstyleSuppressions, checkstyleConf));
if ("jar".equals(checkstyleConfUrl.getProtocol())) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

package org.elasticsearch.gradle.internal.precommit;

import org.gradle.api.DefaultTask;
import org.gradle.api.file.FileSystemOperations;

import javax.inject.Inject;

public abstract class CopyCheckStyleConfTask extends DefaultTask {

@Inject
public abstract FileSystemOperations getFs();
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ public Destination getDestination() {
return Destination.StdErr;
}

@Override
public long getLogTime() {
return result.getEndTime();
}

@Override
public String getMessage() {
return message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ public String url(String os, String arch, String extension) {
}
}

record EarlyAccessJdkBuild(JavaLanguageVersion languageVersion, String version, String buildNumber) implements JdkBuild {

record EarlyAccessJdkBuild(JavaLanguageVersion languageVersion) implements JdkBuild {
@Override
public String url(String os, String arch, String extension) {
String buildNumber = resolveBuildNumber(languageVersion.asInt());
return "https://download.java.net/java/early_access/jdk"
+ version
+ languageVersion.asInt()
+ "/"
+ version
+ buildNumber
+ "/GPL/openjdk-"
+ version
+ languageVersion.asInt()
+ "-ea+"
+ buildNumber
+ "_"
Expand All @@ -73,6 +73,29 @@ public String url(String os, String arch, String extension) {
+ "_bin."
+ extension;
}

private static String resolveBuildNumber(int version) {
String buildNumber = System.getProperty("runtime.java." + version + ".build");
if (buildNumber != null) {
System.out.println("buildNumber = " + buildNumber);
return buildNumber;
}
buildNumber = System.getProperty("runtime.java.build");
if (buildNumber != null) {
System.out.println("buildNumber2 = " + buildNumber);
return buildNumber;
}

switch (version) {
case 24:
// latest explicitly found build number for 24
return "29";
case 25:
return "3";
default:
throw new IllegalArgumentException("Unsupported version " + version);
}
}
}

private static final Pattern VERSION_PATTERN = Pattern.compile(
Expand All @@ -88,8 +111,8 @@ public String url(String os, String arch, String extension) {
// package private so it can be replaced by tests
List<JdkBuild> builds = List.of(
getBundledJdkBuild(),
// 23 early access
new EarlyAccessJdkBuild(JavaLanguageVersion.of(23), "23", "24")
new EarlyAccessJdkBuild(JavaLanguageVersion.of(24)),
new EarlyAccessJdkBuild(JavaLanguageVersion.of(25))
);

private JdkBuild getBundledJdkBuild() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.11.1
8.12
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

package org.elasticsearch.gradle.internal.toolchain

import spock.lang.Unroll

import org.gradle.api.provider.Property
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.jvm.toolchain.JavaToolchainDownload
Expand All @@ -26,6 +28,7 @@ import static org.gradle.platform.OperatingSystem.MAC_OS

abstract class AbstractToolchainResolverSpec extends Specification {

@Unroll
def "resolves #os #arch #vendor jdk #langVersion"() {
given:
def resolver = resolverImplementation()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,34 @@

package org.elasticsearch.gradle.internal.toolchain

import spock.util.environment.RestoreSystemProperties

import org.gradle.api.services.BuildServiceParameters
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.jvm.toolchain.JavaToolchainDownload

import static org.gradle.jvm.toolchain.JvmVendorSpec.ORACLE
import static org.gradle.platform.Architecture.*
import static org.gradle.platform.Architecture.AARCH64
import static org.gradle.platform.Architecture.X86_64
import static org.gradle.platform.OperatingSystem.*

class OracleOpenJdkToolchainResolverSpec extends AbstractToolchainResolverSpec {


OracleOpenJdkToolchainResolver resolverImplementation() {
var toolChain = new OracleOpenJdkToolchainResolver() {
@Override
BuildServiceParameters.None getParameters() {
return null
}
}
toolChain.builds = [
new OracleOpenJdkToolchainResolver.ReleasedJdkBuild(JavaLanguageVersion.of(20), "20", "36", "bdc68b4b9cbc4ebcb30745c85038d91d"),
new OracleOpenJdkToolchainResolver.EarlyAccessJdkBuild(JavaLanguageVersion.of(21), "21", "6")
]
toolChain.builds = toolChain.builds.findAll { it instanceof OracleOpenJdkToolchainResolver.EarlyAccessJdkBuild } + [
new OracleOpenJdkToolchainResolver.ReleasedJdkBuild(
JavaLanguageVersion.of(20),
"20",
"36",
"bdc68b4b9cbc4ebcb30745c85038d91d"
)]
toolChain
}

Expand All @@ -44,23 +52,67 @@ class OracleOpenJdkToolchainResolverSpec extends AbstractToolchainResolverSpec {
[20, anyVendor(), LINUX, AARCH64, "https://download.oracle.com/java/GA/jdk20/bdc68b4b9cbc4ebcb30745c85038d91d/36/GPL/openjdk-20_linux-aarch64_bin.tar.gz"],
[20, anyVendor(), WINDOWS, X86_64, "https://download.oracle.com/java/GA/jdk20/bdc68b4b9cbc4ebcb30745c85038d91d/36/GPL/openjdk-20_windows-x64_bin.zip"],
// https://download.java.net/java/early_access/jdk23/23/GPL/openjdk-23-ea+23_macos-aarch64_bin.tar.gz
[21, ORACLE, MAC_OS, X86_64, "https://download.java.net/java/early_access/jdk21/21/GPL/openjdk-21-ea+6_macos-x64_bin.tar.gz"],
[21, ORACLE, MAC_OS, AARCH64, "https://download.java.net/java/early_access/jdk21/21/GPL/openjdk-21-ea+6_macos-aarch64_bin.tar.gz"],
[21, ORACLE, LINUX, X86_64, "https://download.java.net/java/early_access/jdk21/21/GPL/openjdk-21-ea+6_linux-x64_bin.tar.gz"],
[21, ORACLE, LINUX, AARCH64, "https://download.java.net/java/early_access/jdk21/21/GPL/openjdk-21-ea+6_linux-aarch64_bin.tar.gz"],
[21, ORACLE, WINDOWS, X86_64, "https://download.java.net/java/early_access/jdk21/21/GPL/openjdk-21-ea+6_windows-x64_bin.zip"],
[21, anyVendor(), MAC_OS, X86_64, "https://download.java.net/java/early_access/jdk21/21/GPL/openjdk-21-ea+6_macos-x64_bin.tar.gz"],
[21, anyVendor(), MAC_OS, AARCH64, "https://download.java.net/java/early_access/jdk21/21/GPL/openjdk-21-ea+6_macos-aarch64_bin.tar.gz"],
[21, anyVendor(), LINUX, X86_64, "https://download.java.net/java/early_access/jdk21/21/GPL/openjdk-21-ea+6_linux-x64_bin.tar.gz"],
[21, anyVendor(), LINUX, AARCH64, "https://download.java.net/java/early_access/jdk21/21/GPL/openjdk-21-ea+6_linux-aarch64_bin.tar.gz"],
[21, anyVendor(), WINDOWS, X86_64, "https://download.java.net/java/early_access/jdk21/21/GPL/openjdk-21-ea+6_windows-x64_bin.zip"]
]
[24, ORACLE, MAC_OS, X86_64, "https://download.java.net/java/early_access/jdk24/29/GPL/openjdk-24-ea+29_macos-x64_bin.tar.gz"],
[24, ORACLE, MAC_OS, AARCH64, "https://download.java.net/java/early_access/jdk24/29/GPL/openjdk-24-ea+29_macos-aarch64_bin.tar.gz"],
[24, ORACLE, LINUX, X86_64, "https://download.java.net/java/early_access/jdk24/29/GPL/openjdk-24-ea+29_linux-x64_bin.tar.gz"],
[24, ORACLE, LINUX, AARCH64, "https://download.java.net/java/early_access/jdk24/29/GPL/openjdk-24-ea+29_linux-aarch64_bin.tar.gz"],
[24, ORACLE, WINDOWS, X86_64, "https://download.java.net/java/early_access/jdk24/29/GPL/openjdk-24-ea+29_windows-x64_bin.zip"],
[24, anyVendor(), MAC_OS, X86_64, "https://download.java.net/java/early_access/jdk24/29/GPL/openjdk-24-ea+29_macos-x64_bin.tar.gz"],
[24, anyVendor(), MAC_OS, AARCH64, "https://download.java.net/java/early_access/jdk24/29/GPL/openjdk-24-ea+29_macos-aarch64_bin.tar.gz"],
[24, anyVendor(), LINUX, X86_64, "https://download.java.net/java/early_access/jdk24/29/GPL/openjdk-24-ea+29_linux-x64_bin.tar.gz"],
[24, anyVendor(), LINUX, AARCH64, "https://download.java.net/java/early_access/jdk24/29/GPL/openjdk-24-ea+29_linux-aarch64_bin.tar.gz"],
[24, anyVendor(), WINDOWS, X86_64, "https://download.java.net/java/early_access/jdk24/29/GPL/openjdk-24-ea+29_windows-x64_bin.zip"]]
}

@RestoreSystemProperties
def "can provide build number for ea versions"() {
given:
System.setProperty('runtime.java.build', "42")
System.setProperty('runtime.java.25.build', "13")
def resolver = resolverImplementation()

when:
Optional<JavaToolchainDownload> download = resolver.resolve(
request(
JavaLanguageVersion.of(version),
vendor,
platform(os, arch)
)
)

then:
download.get().uri == URI.create(expectedUrl)

where:
version | vendor | os | arch | expectedUrl
24 | ORACLE | MAC_OS | X86_64 | urlPrefix(24) + "42/GPL/openjdk-24-ea+42_macos-x64_bin.tar.gz"
24 | ORACLE | MAC_OS | AARCH64 | urlPrefix(24) + "42/GPL/openjdk-24-ea+42_macos-aarch64_bin.tar.gz"
24 | ORACLE | LINUX | X86_64 | urlPrefix(24) + "42/GPL/openjdk-24-ea+42_linux-x64_bin.tar.gz"
24 | ORACLE | LINUX | AARCH64 | urlPrefix(24) + "42/GPL/openjdk-24-ea+42_linux-aarch64_bin.tar.gz"
24 | ORACLE | WINDOWS | X86_64 | urlPrefix(24) + "42/GPL/openjdk-24-ea+42_windows-x64_bin.zip"
24 | anyVendor() | MAC_OS | X86_64 | urlPrefix(24) + "42/GPL/openjdk-24-ea+42_macos-x64_bin.tar.gz"
24 | anyVendor() | MAC_OS | AARCH64 | urlPrefix(24) + "42/GPL/openjdk-24-ea+42_macos-aarch64_bin.tar.gz"
24 | anyVendor() | LINUX | X86_64 | urlPrefix(24) + "42/GPL/openjdk-24-ea+42_linux-x64_bin.tar.gz"
24 | anyVendor() | LINUX | AARCH64 | urlPrefix(24) + "42/GPL/openjdk-24-ea+42_linux-aarch64_bin.tar.gz"
24 | anyVendor() | WINDOWS | X86_64 | urlPrefix(24) + "42/GPL/openjdk-24-ea+42_windows-x64_bin.zip"
25 | ORACLE | MAC_OS | X86_64 | urlPrefix(25) + "13/GPL/openjdk-25-ea+13_macos-x64_bin.tar.gz"
25 | ORACLE | MAC_OS | AARCH64 | urlPrefix(25) + "13/GPL/openjdk-25-ea+13_macos-aarch64_bin.tar.gz"
25 | ORACLE | LINUX | X86_64 | urlPrefix(25) + "13/GPL/openjdk-25-ea+13_linux-x64_bin.tar.gz"
25 | ORACLE | LINUX | AARCH64 | urlPrefix(25) + "13/GPL/openjdk-25-ea+13_linux-aarch64_bin.tar.gz"
25 | ORACLE | WINDOWS | X86_64 | urlPrefix(25) + "13/GPL/openjdk-25-ea+13_windows-x64_bin.zip"
25 | anyVendor() | MAC_OS | X86_64 | urlPrefix(25) + "13/GPL/openjdk-25-ea+13_macos-x64_bin.tar.gz"
25 | anyVendor() | MAC_OS | AARCH64 | urlPrefix(25) + "13/GPL/openjdk-25-ea+13_macos-aarch64_bin.tar.gz"
25 | anyVendor() | LINUX | X86_64 | urlPrefix(25) + "13/GPL/openjdk-25-ea+13_linux-x64_bin.tar.gz"
25 | anyVendor() | LINUX | AARCH64 | urlPrefix(25) + "13/GPL/openjdk-25-ea+13_linux-aarch64_bin.tar.gz"
25 | anyVendor() | WINDOWS | X86_64 | urlPrefix(25) + "13/GPL/openjdk-25-ea+13_windows-x64_bin.zip"
}

private static String urlPrefix(int i) {
return "https://download.java.net/java/early_access/jdk" + i + "/"
}

def unsupportedRequests() {
[
[20, ORACLE, WINDOWS, AARCH64]
]
[[20, ORACLE, WINDOWS, AARCH64]]
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class TestClustersPluginFuncTest extends AbstractGradleFuncTest {
esplugin {
name = 'test-$pluginType'
classname 'org.acme.TestModule'
classname = 'org.acme.TestModule'
description = "test $pluginType description"
}
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -364,24 +364,24 @@ tasks.register("verifyBwcTestsEnabled") {
}

tasks.register("branchConsistency") {
description 'Ensures this branch is internally consistent. For example, that versions constants match released versions.'
description = 'Ensures this branch is internally consistent. For example, that versions constants match released versions.'
group 'Verification'
dependsOn ":verifyVersions", ":verifyBwcTestsEnabled"
}

tasks.named("wrapper").configure {
distributionType = 'ALL'
def minimumGradleVersionFile = project.file('build-tools-internal/src/main/resources/minimumGradleVersion')
doLast {
// copy wrapper properties file to build-tools-internal to allow seamless idea integration
def file = new File("build-tools-internal/gradle/wrapper/gradle-wrapper.properties")
Files.copy(wrapper.getPropertiesFile().toPath(), file.toPath(), REPLACE_EXISTING)
Files.copy(getPropertiesFile().toPath(), file.toPath(), REPLACE_EXISTING)
// copy wrapper properties file to plugins/examples to allow seamless idea integration
def examplePluginsWrapperProperties = new File("plugins/examples/gradle/wrapper/gradle-wrapper.properties")
Files.copy(wrapper.getPropertiesFile().toPath(), examplePluginsWrapperProperties.toPath(), REPLACE_EXISTING)

Files.copy(getPropertiesFile().toPath(), examplePluginsWrapperProperties.toPath(), REPLACE_EXISTING)
// Update build-tools to reflect the Gradle upgrade
// TODO: we can remove this once we have tests to make sure older versions work.
project.file('build-tools-internal/src/main/resources/minimumGradleVersion').text = gradleVersion
minimumGradleVersionFile.text = gradleVersion
println "Updated minimum Gradle Version"
}
}
Expand Down
6 changes: 3 additions & 3 deletions client/client-benchmark-noop-api-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ group = 'org.elasticsearch.plugin'
apply plugin: 'elasticsearch.internal-es-plugin'

esplugin {
name 'client-benchmark-noop-api'
description 'Stubbed out Elasticsearch actions that can be used for client-side benchmarking'
classname 'org.elasticsearch.plugin.noop.NoopPlugin'
name = 'client-benchmark-noop-api'
description = 'Stubbed out Elasticsearch actions that can be used for client-side benchmarking'
classname ='org.elasticsearch.plugin.noop.NoopPlugin'
}

// Not published so no need to assemble
Expand Down
4 changes: 2 additions & 2 deletions distribution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,8 @@ subprojects {
// in the final log4j2.properties configuration, as it appears in the
// archive distribution.
artifacts.add('log4jConfig', file("${defaultOutputs}/log4j2.properties")) {
type 'file'
name 'log4j2.properties'
type = 'file'
name = 'log4j2.properties'
builtBy 'buildDefaultLog4jConfig'
}

Expand Down
Loading

0 comments on commit 85c3609

Please sign in to comment.