|
@@ -31,6 +31,7 @@ import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.nio.file.Files;
|
|
|
+import java.nio.file.Path;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.zip.ZipEntry;
|
|
@@ -84,7 +85,16 @@ public class BuildPluginIT extends GradleIntegrationTestCase {
|
|
|
|
|
|
private void runInsecureArtifactRepositoryTest(final String name, final String url, final List<String> lines) throws IOException {
|
|
|
final File projectDir = getProjectDir("elasticsearch.build");
|
|
|
- FileUtils.copyDirectory(projectDir, tmpDir.getRoot(), pathname -> pathname.getPath().contains("/build/") == false);
|
|
|
+ final Path projectDirPath = projectDir.toPath();
|
|
|
+ FileUtils.copyDirectory(projectDir, tmpDir.getRoot(), file -> {
|
|
|
+ final Path relativePath = projectDirPath.relativize(file.toPath());
|
|
|
+ for (Path segment : relativePath) {
|
|
|
+ if (segment.toString().equals("build")) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ });
|
|
|
final List<String> buildGradleLines = Files.readAllLines(tmpDir.getRoot().toPath().resolve("build.gradle"), StandardCharsets.UTF_8);
|
|
|
buildGradleLines.addAll(lines);
|
|
|
Files.write(tmpDir.getRoot().toPath().resolve("build.gradle"), buildGradleLines, StandardCharsets.UTF_8);
|