diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/CopyRestApiTask.java b/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/CopyRestApiTask.java index 810762a08e87e..1cb3034419bbe 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/CopyRestApiTask.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/CopyRestApiTask.java @@ -51,7 +51,7 @@ * @see RestResourcesPlugin */ public class CopyRestApiTask extends DefaultTask { - private static final String COPY_TO = "rest-api-spec/api"; + private static final String REST_API_PREFIX = "rest-api-spec/api"; final ListProperty includeCore = getProject().getObjects().listProperty(String.class); final ListProperty includeXpack = getProject().getObjects().listProperty(String.class); @@ -109,7 +109,7 @@ public FileTree getInputDir() { @OutputDirectory public File getOutputDir() { - return new File(getTestSourceSet().getOutput().getResourcesDir(), COPY_TO); + return new File(getTestSourceSet().getOutput().getResourcesDir(), REST_API_PREFIX); } @TaskAction @@ -132,7 +132,13 @@ void copy() { project.copy(c -> { c.from(project.zipTree(coreConfig.getSingleFile())); c.into(getTestSourceSet().getOutput().getResourcesDir()); // this ends up as the same dir as outputDir - c.include(includeCore.get().stream().map(prefix -> COPY_TO + "/" + prefix + "*/**").collect(Collectors.toList())); + if (includeCore.get().isEmpty()) { + c.include(REST_API_PREFIX + "/**"); + } else { + c.include( + includeCore.get().stream().map(prefix -> REST_API_PREFIX + "/" + prefix + "*/**").collect(Collectors.toList()) + ); + } }); } // only copy x-pack specs if explicitly instructed diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/CopyRestTestsTask.java b/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/CopyRestTestsTask.java index 046bb5a6d1a8a..9e9d1e0d9e795 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/CopyRestTestsTask.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/test/rest/CopyRestTestsTask.java @@ -48,7 +48,7 @@ * @see RestResourcesPlugin */ public class CopyRestTestsTask extends DefaultTask { - private static final String COPY_TO = "rest-api-spec/test"; + private static final String REST_TEST_PREFIX = "rest-api-spec/test"; final ListProperty includeCore = getProject().getObjects().listProperty(String.class); final ListProperty includeXpack = getProject().getObjects().listProperty(String.class); @@ -103,7 +103,7 @@ public FileTree getInputDir() { @OutputDirectory public File getOutputDir() { - return new File(getTestSourceSet().getOutput().getResourcesDir(), COPY_TO); + return new File(getTestSourceSet().getOutput().getResourcesDir(), REST_TEST_PREFIX); } @TaskAction @@ -128,7 +128,9 @@ void copy() { project.copy(c -> { c.from(project.zipTree(coreConfig.getSingleFile())); c.into(getTestSourceSet().getOutput().getResourcesDir()); // this ends up as the same dir as outputDir - c.include(includeCore.get().stream().map(prefix -> COPY_TO + "/" + prefix + "*/**").collect(Collectors.toList())); + c.include( + includeCore.get().stream().map(prefix -> REST_TEST_PREFIX + "/" + prefix + "*/**").collect(Collectors.toList()) + ); }); } }