@@ -58,8 +58,10 @@ public class CopyRestApiTask extends DefaultTask {
5858 final ListProperty <String > includeCore = getProject ().getObjects ().listProperty (String .class );
5959 final ListProperty <String > includeXpack = getProject ().getObjects ().listProperty (String .class );
6060 String sourceSetName ;
61+ boolean skipHasRestTestCheck ;
6162 Configuration coreConfig ;
6263 Configuration xpackConfig ;
64+ Configuration additionalConfig ;
6365
6466 private final PatternFilterable corePatternSet ;
6567 private final PatternFilterable xpackPatternSet ;
@@ -89,6 +91,11 @@ String getSourceSetName() {
8991 return sourceSetName ;
9092 }
9193
94+ @ Input
95+ public boolean isSkipHasRestTestCheck () {
96+ return skipHasRestTestCheck ;
97+ }
98+
9299 @ SkipWhenEmpty
93100 @ InputFiles
94101 public FileTree getInputDir () {
@@ -98,7 +105,7 @@ public FileTree getInputDir() {
98105 xpackPatternSet .setIncludes (includeXpack .get ().stream ().map (prefix -> prefix + "*/**" ).collect (Collectors .toList ()));
99106 xpackFileTree = xpackConfig .getAsFileTree ().matching (xpackPatternSet );
100107 }
101- boolean projectHasYamlRestTests = projectHasYamlRestTests ();
108+ boolean projectHasYamlRestTests = skipHasRestTestCheck || projectHasYamlRestTests ();
102109 if (includeCore .get ().isEmpty () == false || projectHasYamlRestTests ) {
103110 if (BuildParams .isInternal ()) {
104111 corePatternSet .setIncludes (includeCore .get ().stream ().map (prefix -> prefix + "*/**" ).collect (Collectors .toList ()));
@@ -107,7 +114,10 @@ public FileTree getInputDir() {
107114 coreFileTree = coreConfig .getAsFileTree (); // jar file
108115 }
109116 }
110- ConfigurableFileCollection fileCollection = getProject ().files (coreFileTree , xpackFileTree );
117+
118+ ConfigurableFileCollection fileCollection = additionalConfig == null
119+ ? getProject ().files (coreFileTree , xpackFileTree )
120+ : getProject ().files (coreFileTree , xpackFileTree , additionalConfig .getAsFileTree ());
111121
112122 // if project has rest tests or the includes are explicitly configured execute the task, else NO-SOURCE due to the null input
113123 return projectHasYamlRestTests || includeCore .get ().isEmpty () == false || includeXpack .get ().isEmpty () == false
@@ -132,7 +142,7 @@ void copy() {
132142 if (BuildParams .isInternal ()) {
133143 getLogger ().debug ("Rest specs for project [{}] will be copied to the test resources." , project .getPath ());
134144 project .copy (c -> {
135- c .from (coreConfig .getSingleFile ());
145+ c .from (coreConfig .getAsFileTree ());
136146 c .into (getOutputDir ());
137147 c .include (corePatternSet .getIncludes ());
138148 });
@@ -164,6 +174,14 @@ void copy() {
164174 c .include (xpackPatternSet .getIncludes ());
165175 });
166176 }
177+ // TODO: once https://github.com/elastic/elasticsearch/pull/62968 lands ensure that this uses `getFileSystemOperations()`
178+ // copy any additional config
179+ if (additionalConfig != null ) {
180+ project .copy (c -> {
181+ c .from (additionalConfig .getAsFileTree ());
182+ c .into (getOutputDir ());
183+ });
184+ }
167185 }
168186
169187 /**
0 commit comments