Skip to content

Commit 1d5706e

Browse files
authored
[Gradle] Make CopyCheckStyleConfTask usage cc compatible in serverless (#119249)
This ensures we can use gradle configuration cache with elasticsearch serverless build
1 parent 03fd89a commit 1d5706e

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,14 @@ private void registerEmptyDirectoryTasks(Project project) {
134134
});
135135

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

143143
File jvmOptionsDir = new File(project.getBuildDir(), "jvm-options-hack/jvm.options.d");
144-
project.getExtensions().add("jvmOptionsDir", jvmOptionsDir);
144+
project.getExtensions().getExtraProperties().set("jvmOptionsDir", jvmOptionsDir);
145145
project.getTasks().register("createJvmOptionsDir", EmptyDirTask.class, t -> {
146146
t.setDir(jvmOptionsDir);
147147
t.setDirMode(0750);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ public TaskProvider<? extends Task> createTask(Project project) {
4242
File checkstyleDir = new File(project.getBuildDir(), "checkstyle");
4343
File checkstyleSuppressions = new File(checkstyleDir, "checkstyle_suppressions.xml");
4444
File checkstyleConf = new File(checkstyleDir, "checkstyle.xml");
45-
TaskProvider<Task> copyCheckstyleConf = project.getTasks().register("copyCheckstyleConf");
45+
TaskProvider<CopyCheckStyleConfTask> copyCheckstyleConf = project.getTasks()
46+
.register("copyCheckstyleConf", CopyCheckStyleConfTask.class);
4647
// configure inputs and outputs so up to date works properly
4748
copyCheckstyleConf.configure(t -> t.getOutputs().files(checkstyleSuppressions, checkstyleConf));
4849
if ("jar".equals(checkstyleConfUrl.getProtocol())) {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
package org.elasticsearch.gradle.internal.precommit;
11+
12+
import org.gradle.api.DefaultTask;
13+
import org.gradle.api.file.FileSystemOperations;
14+
15+
import javax.inject.Inject;
16+
17+
public abstract class CopyCheckStyleConfTask extends DefaultTask {
18+
19+
@Inject
20+
public abstract FileSystemOperations getFs();
21+
}

0 commit comments

Comments
 (0)