Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ allprojects {
description = "Elasticsearch subproject ${project.path}"
}

String licenseCommit
if (VersionProperties.elasticsearch.toString().endsWith('-SNAPSHOT')) {
licenseCommit = BuildParams.gitRevision ?: "master" // leniency for non git builds
} else {
licenseCommit = "v${version}"
}
String elasticLicenseUrl = "https://raw.githubusercontent.com/elastic/elasticsearch/${licenseCommit}/licenses/ELASTIC-LICENSE.txt"

configure(allprojects - project(':distribution:archives:integ-test-zip')) {
project.pluginManager.withPlugin('nebula.maven-base-publish') {
if (project.pluginManager.hasPlugin('elasticsearch.build') == false) {
Expand All @@ -76,9 +68,6 @@ subprojects {
project.ext.licenseName = 'The Apache Software License, Version 2.0'
project.ext.licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'

// But stick the Elastic license url in project.ext so we can get it if we need to switch to it
project.ext.elasticLicenseUrl = elasticLicenseUrl

// we only use maven publish to add tasks for pom generation
plugins.withType(MavenPublishPlugin).whenPluginAdded {
publishing {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,6 @@ public void apply(Project project) {
task.dependsOn(checkLicense);
task.dependsOn(checkNotice);
});

String projectName = project.getName();
if (projectName.contains("oss") == false && (projectName.contains("zip") || projectName.contains("tar"))) {
project.getExtensions().add("licenseName", "Elastic License");
project.getExtensions().add("licenseUrl", project.getExtensions().getExtraProperties().get("elasticLicenseUrl"));
TaskProvider<Task> checkMlCppNoticeTask = registerCheckMlCppNoticeTask(
project,
checkExtraction,
distributionArchiveCheckExtension
);
checkTask.configure(task -> task.dependsOn(checkMlCppNoticeTask));
}
}

private File calculateArchiveExtractionDir(Project project) {
Expand All @@ -96,40 +84,6 @@ private File calculateArchiveExtractionDir(Project project) {
return new File(project.getBuildDir(), "zip-extracted");
}

private static TaskProvider<Task> registerCheckMlCppNoticeTask(
Project project,
TaskProvider<Copy> checkExtraction,
DistributionArchiveCheckExtension extension
) {
TaskProvider<Task> checkMlCppNoticeTask = project.getTasks().register("checkMlCppNotice", task -> {
task.dependsOn(checkExtraction);
task.doLast(new Action<Task>() {
@Override
public void execute(Task task) {
// this is just a small sample from the C++ notices,
// the idea being that if we've added these lines we've probably added all the required lines
final List<String> expectedLines = extension.expectedMlLicenses.get();
final Path noticePath = checkExtraction.get()
.getDestinationDir()
.toPath()
.resolve("elasticsearch-" + VersionProperties.getElasticsearch() + "/modules/x-pack-ml/NOTICE.txt");
final List<String> actualLines;
try {
actualLines = Files.readAllLines(noticePath);
for (final String expectedLine : expectedLines) {
if (actualLines.contains(expectedLine) == false) {
throw new GradleException("expected [" + noticePath + " to contain [" + expectedLine + "] but it did not");
}
}
} catch (IOException ioException) {
ioException.printStackTrace();
}
}
});
});
return checkMlCppNoticeTask;
}

private TaskProvider<Task> registerCheckNoticeTask(Project project, TaskProvider<Copy> checkExtraction) {
return project.getTasks().register("checkNotice", task -> {
task.dependsOn(checkExtraction);
Expand All @@ -153,12 +107,7 @@ private TaskProvider<Task> registerCheckLicenseTask(Project project, TaskProvide
task.doLast(new Action<Task>() {
@Override
public void execute(Task task) {
String licenseFilename = null;
if (project.getName().contains("oss-") || project.getName().equals("integ-test-zip")) {
licenseFilename = "APACHE-LICENSE-2.0.txt";
} else {
licenseFilename = "ELASTIC-LICENSE.txt";
}
String licenseFilename = "APACHE-LICENSE-2.0.txt";
final List<String> licenseLines;
try {
licenseLines = Files.readAllLines(project.getRootDir().toPath().resolve("licenses/" + licenseFilename));
Expand Down Expand Up @@ -208,29 +157,12 @@ private static void assertLinesInFile(Path path, List<String> expectedLines) {
}
}

private static boolean toolExists(Project project) {
if (project.getName().contains("tar")) {
return tarExists();
} else {
assert project.getName().contains("zip");
return zipExists();
}
}

private static void assertNoClassFile(File file) {
if (file.getName().endsWith(".class")) {
throw new GradleException("Detected class file in distribution ('" + file.getName() + "')");
}
}

private static boolean zipExists() {
return new File("/bin/unzip").exists() || new File("/usr/bin/unzip").exists() || new File("/usr/local/bin/unzip").exists();
}

private static boolean tarExists() {
return new File("/bin/tar").exists() || new File("/usr/bin/tar").exists() || new File("/usr/local/bin/tar").exists();
}

private Object distTaskOutput(TaskProvider<Task> buildDistTask) {
return new Callable<File>() {
@Override
Expand Down

This file was deleted.

This file was deleted.

Loading