Skip to content

Commit 125958e

Browse files
nknizeRabi Panda
authored andcommittedMar 13, 2021
Remove the Elastic license file, all checks for this license and the license REST APIs. (opensearch-project#12)
Co-authored-by: Rabi Panda <rabipanda@icloud.com> Signed-off-by: Peter Nied <petern@amazon.com>
1 parent 0dd4f9f commit 125958e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+13
-3670
lines changed
 

‎build.gradle

-11
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,6 @@ allprojects {
5555
description = "Elasticsearch subproject ${project.path}"
5656
}
5757

58-
String licenseCommit
59-
if (VersionProperties.elasticsearch.toString().endsWith('-SNAPSHOT')) {
60-
licenseCommit = BuildParams.gitRevision ?: "master" // leniency for non git builds
61-
} else {
62-
licenseCommit = "v${version}"
63-
}
64-
String elasticLicenseUrl = "https://raw.githubusercontent.com/elastic/elasticsearch/${licenseCommit}/licenses/ELASTIC-LICENSE.txt"
65-
6658
configure(allprojects - project(':distribution:archives:integ-test-zip')) {
6759
project.pluginManager.withPlugin('nebula.maven-base-publish') {
6860
if (project.pluginManager.hasPlugin('elasticsearch.build') == false) {
@@ -76,9 +68,6 @@ subprojects {
7668
project.ext.licenseName = 'The Apache Software License, Version 2.0'
7769
project.ext.licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
7870

79-
// But stick the Elastic license url in project.ext so we can get it if we need to switch to it
80-
project.ext.elasticLicenseUrl = elasticLicenseUrl
81-
8271
// we only use maven publish to add tasks for pom generation
8372
plugins.withType(MavenPublishPlugin).whenPluginAdded {
8473
publishing {

‎buildSrc/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionArchiveCheckPlugin.java

+1-69
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,6 @@ public void apply(Project project) {
7272
task.dependsOn(checkLicense);
7373
task.dependsOn(checkNotice);
7474
});
75-
76-
String projectName = project.getName();
77-
if (projectName.contains("oss") == false && (projectName.contains("zip") || projectName.contains("tar"))) {
78-
project.getExtensions().add("licenseName", "Elastic License");
79-
project.getExtensions().add("licenseUrl", project.getExtensions().getExtraProperties().get("elasticLicenseUrl"));
80-
TaskProvider<Task> checkMlCppNoticeTask = registerCheckMlCppNoticeTask(
81-
project,
82-
checkExtraction,
83-
distributionArchiveCheckExtension
84-
);
85-
checkTask.configure(task -> task.dependsOn(checkMlCppNoticeTask));
86-
}
8775
}
8876

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

99-
private static TaskProvider<Task> registerCheckMlCppNoticeTask(
100-
Project project,
101-
TaskProvider<Copy> checkExtraction,
102-
DistributionArchiveCheckExtension extension
103-
) {
104-
TaskProvider<Task> checkMlCppNoticeTask = project.getTasks().register("checkMlCppNotice", task -> {
105-
task.dependsOn(checkExtraction);
106-
task.doLast(new Action<Task>() {
107-
@Override
108-
public void execute(Task task) {
109-
// this is just a small sample from the C++ notices,
110-
// the idea being that if we've added these lines we've probably added all the required lines
111-
final List<String> expectedLines = extension.expectedMlLicenses.get();
112-
final Path noticePath = checkExtraction.get()
113-
.getDestinationDir()
114-
.toPath()
115-
.resolve("elasticsearch-" + VersionProperties.getElasticsearch() + "/modules/x-pack-ml/NOTICE.txt");
116-
final List<String> actualLines;
117-
try {
118-
actualLines = Files.readAllLines(noticePath);
119-
for (final String expectedLine : expectedLines) {
120-
if (actualLines.contains(expectedLine) == false) {
121-
throw new GradleException("expected [" + noticePath + " to contain [" + expectedLine + "] but it did not");
122-
}
123-
}
124-
} catch (IOException ioException) {
125-
ioException.printStackTrace();
126-
}
127-
}
128-
});
129-
});
130-
return checkMlCppNoticeTask;
131-
}
132-
13387
private TaskProvider<Task> registerCheckNoticeTask(Project project, TaskProvider<Copy> checkExtraction) {
13488
return project.getTasks().register("checkNotice", task -> {
13589
task.dependsOn(checkExtraction);
@@ -153,12 +107,7 @@ private TaskProvider<Task> registerCheckLicenseTask(Project project, TaskProvide
153107
task.doLast(new Action<Task>() {
154108
@Override
155109
public void execute(Task task) {
156-
String licenseFilename = null;
157-
if (project.getName().contains("oss-") || project.getName().equals("integ-test-zip")) {
158-
licenseFilename = "APACHE-LICENSE-2.0.txt";
159-
} else {
160-
licenseFilename = "ELASTIC-LICENSE.txt";
161-
}
110+
String licenseFilename = "APACHE-LICENSE-2.0.txt";
162111
final List<String> licenseLines;
163112
try {
164113
licenseLines = Files.readAllLines(project.getRootDir().toPath().resolve("licenses/" + licenseFilename));
@@ -208,29 +157,12 @@ private static void assertLinesInFile(Path path, List<String> expectedLines) {
208157
}
209158
}
210159

211-
private static boolean toolExists(Project project) {
212-
if (project.getName().contains("tar")) {
213-
return tarExists();
214-
} else {
215-
assert project.getName().contains("zip");
216-
return zipExists();
217-
}
218-
}
219-
220160
private static void assertNoClassFile(File file) {
221161
if (file.getName().endsWith(".class")) {
222162
throw new GradleException("Detected class file in distribution ('" + file.getName() + "')");
223163
}
224164
}
225165

226-
private static boolean zipExists() {
227-
return new File("/bin/unzip").exists() || new File("/usr/bin/unzip").exists() || new File("/usr/local/bin/unzip").exists();
228-
}
229-
230-
private static boolean tarExists() {
231-
return new File("/bin/tar").exists() || new File("/usr/bin/tar").exists() || new File("/usr/local/bin/tar").exists();
232-
}
233-
234166
private Object distTaskOutput(TaskProvider<Task> buildDistTask) {
235167
return new Callable<File>() {
236168
@Override

0 commit comments

Comments
 (0)
Please sign in to comment.