Skip to content

Commit 66e734b

Browse files
authored
Merge branch 'main' into concept-cleanup
2 parents f3da584 + 6e2c614 commit 66e734b

File tree

5 files changed

+36
-8
lines changed

5 files changed

+36
-8
lines changed

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,15 @@
3131
import org.gradle.api.tasks.bundling.Jar;
3232
import org.gradle.api.tasks.javadoc.Javadoc;
3333
import org.gradle.external.javadoc.CoreJavadocOptions;
34+
import org.gradle.jvm.toolchain.JavaLanguageVersion;
35+
import org.gradle.jvm.toolchain.JavaToolchainService;
3436
import org.gradle.language.base.plugins.LifecycleBasePlugin;
3537

3638
import java.io.File;
3739
import java.util.Map;
3840

41+
import javax.inject.Inject;
42+
3943
import static org.elasticsearch.gradle.internal.conventions.util.Util.toStringable;
4044
import static org.elasticsearch.gradle.internal.util.ParamsUtils.loadBuildParams;
4145

@@ -44,6 +48,14 @@
4448
* common configuration for production code.
4549
*/
4650
public class ElasticsearchJavaPlugin implements Plugin<Project> {
51+
52+
private final JavaToolchainService javaToolchains;
53+
54+
@Inject
55+
ElasticsearchJavaPlugin(JavaToolchainService javaToolchains) {
56+
this.javaToolchains = javaToolchains;
57+
}
58+
4759
@Override
4860
public void apply(Project project) {
4961
project.getRootProject().getPlugins().apply(GlobalBuildInfoPlugin.class);
@@ -55,7 +67,7 @@ public void apply(Project project) {
5567
// configureConfigurations(project);
5668
configureJars(project, buildParams.get());
5769
configureJarManifest(project, buildParams.get());
58-
configureJavadoc(project);
70+
configureJavadoc(project, buildParams.get());
5971
testCompileOnlyDeps(project);
6072
}
6173

@@ -128,14 +140,18 @@ private static void configureJarManifest(Project project, BuildParameterExtensio
128140
project.getPluginManager().apply("nebula.info-jar");
129141
}
130142

131-
private static void configureJavadoc(Project project) {
143+
private void configureJavadoc(Project project, BuildParameterExtension buildParams) {
132144
project.getTasks().withType(Javadoc.class).configureEach(javadoc -> {
133145
/*
134146
* Generate docs using html5 to suppress a warning from `javadoc`
135147
* that the default will change to html5 in the future.
136148
*/
137149
CoreJavadocOptions javadocOptions = (CoreJavadocOptions) javadoc.getOptions();
138150
javadocOptions.addBooleanOption("html5", true);
151+
152+
javadoc.getJavadocTool().set(javaToolchains.javadocToolFor(spec -> {
153+
spec.getLanguageVersion().set(JavaLanguageVersion.of(buildParams.getMinimumRuntimeVersion().getMajorVersion()));
154+
}));
139155
});
140156

141157
TaskProvider<Javadoc> javadoc = project.getTasks().withType(Javadoc.class).named("javadoc");

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ public void apply(Project project) {
8686
configurePreviewFeatures(project, javaExtension.getSourceSets().getByName(SourceSet.TEST_SOURCE_SET_NAME), 21);
8787
for (int javaVersion : mainVersions) {
8888
String mainSourceSetName = SourceSet.MAIN_SOURCE_SET_NAME + javaVersion;
89-
SourceSet mainSourceSet = addSourceSet(project, javaExtension, mainSourceSetName, mainSourceSets, javaVersion);
89+
SourceSet mainSourceSet = addSourceSet(project, javaExtension, mainSourceSetName, mainSourceSets, javaVersion, true);
9090
configureSourceSetInJar(project, mainSourceSet, javaVersion);
9191
addJar(project, mainSourceSet, javaVersion);
9292
mainSourceSets.add(mainSourceSetName);
9393
testSourceSets.add(mainSourceSetName);
9494

9595
String testSourceSetName = SourceSet.TEST_SOURCE_SET_NAME + javaVersion;
96-
SourceSet testSourceSet = addSourceSet(project, javaExtension, testSourceSetName, testSourceSets, javaVersion);
96+
SourceSet testSourceSet = addSourceSet(project, javaExtension, testSourceSetName, testSourceSets, javaVersion, false);
9797
testSourceSets.add(testSourceSetName);
9898
createTestTask(project, buildParams, testSourceSet, javaVersion, mainSourceSets);
9999
}
@@ -121,7 +121,8 @@ private SourceSet addSourceSet(
121121
JavaPluginExtension javaExtension,
122122
String sourceSetName,
123123
List<String> parentSourceSets,
124-
int javaVersion
124+
int javaVersion,
125+
boolean isMainSourceSet
125126
) {
126127
SourceSet sourceSet = javaExtension.getSourceSets().maybeCreate(sourceSetName);
127128
for (String parentSourceSetName : parentSourceSets) {
@@ -135,6 +136,13 @@ private SourceSet addSourceSet(
135136
CompileOptions compileOptions = compileTask.getOptions();
136137
compileOptions.getRelease().set(javaVersion);
137138
});
139+
if (isMainSourceSet) {
140+
project.getTasks().create(sourceSet.getJavadocTaskName(), Javadoc.class, javadocTask -> {
141+
javadocTask.getJavadocTool().set(javaToolchains.javadocToolFor(spec -> {
142+
spec.getLanguageVersion().set(JavaLanguageVersion.of(javaVersion));
143+
}));
144+
});
145+
}
138146
configurePreviewFeatures(project, sourceSet, javaVersion);
139147

140148
// Since we configure MRJAR sourcesets to allow preview apis, class signatures for those

docs/changelog/119007.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 119007
2+
summary: Block-writes cannot be added after read-only
3+
area: Data streams
4+
type: bug
5+
issues:
6+
- 119002

muted-tests.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,6 @@ tests:
293293
issue: https://github.com/elastic/elasticsearch/issues/118955
294294
- class: org.elasticsearch.repositories.blobstore.testkit.analyze.SecureHdfsRepositoryAnalysisRestIT
295295
issue: https://github.com/elastic/elasticsearch/issues/118970
296-
- class: org.elasticsearch.xpack.migrate.action.ReindexDatastreamIndexTransportActionIT
297-
issue: https://github.com/elastic/elasticsearch/issues/119002
298296

299297
# Examples:
300298
#

x-pack/plugin/migrate/src/main/java/org/elasticsearch/xpack/migrate/action/ReindexDataStreamIndexTransportAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ protected void doExecute(
9292
.<AcknowledgedResponse>andThen(l -> deleteDestIfExists(destIndexName, l))
9393
.<AcknowledgedResponse>andThen(l -> createIndex(sourceIndex, destIndexName, l))
9494
.<BulkByScrollResponse>andThen(l -> reindex(sourceIndexName, destIndexName, l))
95-
.<AddIndexBlockResponse>andThen(l -> addBlockIfFromSource(READ_ONLY, settingsBefore, destIndexName, l))
9695
.<AddIndexBlockResponse>andThen(l -> addBlockIfFromSource(WRITE, settingsBefore, destIndexName, l))
96+
.<AddIndexBlockResponse>andThen(l -> addBlockIfFromSource(READ_ONLY, settingsBefore, destIndexName, l))
9797
.andThenApply(ignored -> new ReindexDataStreamIndexAction.Response(destIndexName))
9898
.addListener(listener);
9999
}

0 commit comments

Comments
 (0)