@@ -72,18 +72,6 @@ public void apply(Project project) {
72
72
task .dependsOn (checkLicense );
73
73
task .dependsOn (checkNotice );
74
74
});
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
- }
87
75
}
88
76
89
77
private File calculateArchiveExtractionDir (Project project ) {
@@ -96,40 +84,6 @@ private File calculateArchiveExtractionDir(Project project) {
96
84
return new File (project .getBuildDir (), "zip-extracted" );
97
85
}
98
86
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
-
133
87
private TaskProvider <Task > registerCheckNoticeTask (Project project , TaskProvider <Copy > checkExtraction ) {
134
88
return project .getTasks ().register ("checkNotice" , task -> {
135
89
task .dependsOn (checkExtraction );
@@ -153,12 +107,7 @@ private TaskProvider<Task> registerCheckLicenseTask(Project project, TaskProvide
153
107
task .doLast (new Action <Task >() {
154
108
@ Override
155
109
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" ;
162
111
final List <String > licenseLines ;
163
112
try {
164
113
licenseLines = Files .readAllLines (project .getRootDir ().toPath ().resolve ("licenses/" + licenseFilename ));
@@ -208,29 +157,12 @@ private static void assertLinesInFile(Path path, List<String> expectedLines) {
208
157
}
209
158
}
210
159
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
-
220
160
private static void assertNoClassFile (File file ) {
221
161
if (file .getName ().endsWith (".class" )) {
222
162
throw new GradleException ("Detected class file in distribution ('" + file .getName () + "')" );
223
163
}
224
164
}
225
165
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
-
234
166
private Object distTaskOutput (TaskProvider <Task > buildDistTask ) {
235
167
return new Callable <File >() {
236
168
@ Override
0 commit comments