Skip to content

Commit 847065c

Browse files
Merge branch 'main' into esql/constant_keyword_optimizations
2 parents 3a52b87 + 6f2d4c8 commit 847065c

File tree

602 files changed

+8406
-2015
lines changed

Some content is hidden

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

602 files changed

+8406
-2015
lines changed

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,27 @@
1414
*/
1515
public enum DockerBase {
1616
// "latest" here is intentional, since the image name specifies "9"
17-
DEFAULT("redhat/ubi9-minimal:latest", "", "microdnf", "Dockerfile.default"),
17+
DEFAULT("redhat/ubi9-minimal:latest", "", "microdnf", "dockerfiles/default/Dockerfile"),
1818

1919
// The Iron Bank base image is UBI (albeit hardened), but we are required to parameterize the Docker build
2020
IRON_BANK("${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG}", "-ironbank", "yum", "Dockerfile"),
2121

2222
// Chainguard based wolfi image with latest jdk
23-
// This is usually updated via renovatebot
24-
// spotless:off
2523
WOLFI(
26-
"docker.elastic.co/wolfi/chainguard-base:latest@sha256:29150cd940cc7f69407d978d5a19c86f4d9e67cf44e4d6ded787a497e8f27c9a",
24+
null,
2725
"-wolfi",
2826
"apk",
29-
"Dockerfile"
27+
"dockerfiles/wolfi/Dockerfile"
3028
),
31-
// spotless:on
3229
// Based on WOLFI above, with more extras. We don't set a base image because
3330
// we programmatically extend from the wolfi image.
3431
CLOUD_ESS(null, "-cloud-ess", "apk", "Dockerfile.ess"),
3532

3633
CLOUD_ESS_FIPS(
37-
"docker.elastic.co/wolfi/chainguard-base-fips:sha256-ebfc3f1d7dba992231747a2e05ad1b859843e81b5e676ad342859d7cf9e425a7@sha256:ebfc3f1d7dba992231747a2e05ad1b859843e81b5e676ad342859d7cf9e425a7",
34+
null,
3835
"-cloud-ess-fips",
3936
"apk",
40-
"Dockerfile.ess-fips"
37+
"dockerfiles/cloud_ess_fips/Dockerfile"
4138
);
4239

4340
private final String image;

build-tools/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ gradlePlugin {
5151
id = 'elasticsearch.stable-esplugin'
5252
implementationClass = 'org.elasticsearch.gradle.plugin.StablePluginBuildPlugin'
5353
}
54+
testBuildInfo {
55+
id = 'elasticsearch.test-build-info'
56+
implementationClass = 'org.elasticsearch.gradle.test.TestBuildInfoPlugin'
57+
}
5458
javaRestTest {
5559
id = 'elasticsearch.java-rest-test'
5660
implementationClass = 'org.elasticsearch.gradle.test.JavaRestTestPlugin'
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package org.elasticsearch.gradle.test
2+
3+
import com.fasterxml.jackson.databind.ObjectMapper
4+
5+
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
6+
import org.gradle.testkit.runner.TaskOutcome
7+
8+
class TestBuildInfoPluginFuncTest extends AbstractGradleFuncTest {
9+
def "works"() {
10+
given:
11+
file("src/main/java/com/example/Example.java") << """
12+
package com.example;
13+
14+
public class Example {
15+
}
16+
"""
17+
18+
file("src/main/java/module-info.java") << """
19+
module com.example {
20+
exports com.example;
21+
}
22+
"""
23+
24+
buildFile << """
25+
import org.elasticsearch.gradle.plugin.GenerateTestBuildInfoTask;
26+
27+
plugins {
28+
id 'java'
29+
id 'elasticsearch.test-build-info'
30+
}
31+
32+
repositories {
33+
mavenCentral()
34+
}
35+
36+
tasks.withType(GenerateTestBuildInfoTask.class) {
37+
componentName = 'example-component'
38+
outputFile = new File('build/generated-build-info/plugin-test-build-info.json')
39+
}
40+
"""
41+
42+
when:
43+
def result = gradleRunner('generateTestBuildInfo').build()
44+
def task = result.task(":generateTestBuildInfo")
45+
46+
47+
then:
48+
task.outcome == TaskOutcome.SUCCESS
49+
50+
def output = file("build/generated-build-info/plugin-test-build-info.json")
51+
output.exists() == true
52+
53+
def location = Map.of(
54+
"module", "com.example",
55+
"representative_class", "com/example/Example.class"
56+
)
57+
def expectedOutput = Map.of(
58+
"component", "example-component",
59+
"locations", List.of(location)
60+
)
61+
new ObjectMapper().readValue(output, Map.class) == expectedOutput
62+
}
63+
}

build-tools/src/main/java/org/elasticsearch/gradle/plugin/BasePluginBuildPlugin.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ private TaskProvider<Zip> createBundleTasks(final Project project, PluginPropert
121121
task.getIsLicensed().set(providerFactory.provider(extension::isLicensed));
122122

123123
var mainSourceSet = project.getExtensions().getByType(SourceSetContainer.class).getByName(SourceSet.MAIN_SOURCE_SET_NAME);
124-
FileCollection moduleInfoFile = mainSourceSet.getOutput().getAsFileTree().matching(p -> p.include("module-info.class"));
124+
FileCollection moduleInfoFile = mainSourceSet.getOutput()
125+
.getClassesDirs()
126+
.getAsFileTree()
127+
.matching(p -> p.include("module-info.class"));
125128
task.getModuleInfoFile().setFrom(moduleInfoFile);
126129

127130
});

0 commit comments

Comments
 (0)