@@ -68,8 +68,8 @@ public class AppBundlerTask extends Task {
68
68
// JVM info properties
69
69
private String mainClassName = null ;
70
70
private FileSet runtime = null ;
71
- private ArrayList <File > classPath = new ArrayList <>();
72
- private ArrayList <File > libraryPath = new ArrayList <>();
71
+ private ArrayList <FileSet > classPath = new ArrayList <>();
72
+ private ArrayList <FileSet > libraryPath = new ArrayList <>();
73
73
private ArrayList <String > options = new ArrayList <>();
74
74
private ArrayList <String > arguments = new ArrayList <>();
75
75
@@ -130,25 +130,11 @@ public void addConfiguredRuntime(FileSet runtime) throws BuildException {
130
130
}
131
131
132
132
public void addConfiguredClassPath (FileSet classPath ) {
133
- File parent = classPath .getDir ();
134
-
135
- DirectoryScanner directoryScanner = classPath .getDirectoryScanner (getProject ());
136
- String [] includedFiles = directoryScanner .getIncludedFiles ();
137
-
138
- for (int i = 0 ; i < includedFiles .length ; i ++) {
139
- this .classPath .add (new File (parent , includedFiles [i ]));
140
- }
133
+ this .classPath .add (classPath );
141
134
}
142
135
143
136
public void addConfiguredLibraryPath (FileSet libraryPath ) {
144
- File parent = libraryPath .getDir ();
145
-
146
- DirectoryScanner directoryScanner = libraryPath .getDirectoryScanner (getProject ());
147
- String [] includedFiles = directoryScanner .getIncludedFiles ();
148
-
149
- for (int i = 0 ; i < includedFiles .length ; i ++) {
150
- this .libraryPath .add (new File (parent , includedFiles [i ]));
151
- }
137
+ this .libraryPath .add (libraryPath );
152
138
}
153
139
154
140
public void addConfiguredOption (Option option ) throws BuildException {
@@ -249,9 +235,6 @@ public void execute() throws BuildException {
249
235
File javaDirectory = new File (contentsDirectory , "Java" );
250
236
javaDirectory .mkdir ();
251
237
252
- File classesDirectory = new File (javaDirectory , "Classes" );
253
- classesDirectory .mkdir ();
254
-
255
238
File plugInsDirectory = new File (contentsDirectory , "PlugIns" );
256
239
plugInsDirectory .mkdir ();
257
240
@@ -270,11 +253,11 @@ public void execute() throws BuildException {
270
253
271
254
// Copy executable to MacOS folder
272
255
File executableFile = new File (macOSDirectory , EXECUTABLE_NAME );
273
- copy (getClass ().getResource (EXECUTABLE_NAME ), executableFile );
256
+ copy (getClass ().getResource (executableFile . getName () ), executableFile );
274
257
275
258
executableFile .setExecutable (true );
276
259
277
- // Copy runtime to PlugIns folder (if specified)
260
+ // Copy runtime to PlugIns folder
278
261
if (runtime != null ) {
279
262
// Create root directory
280
263
File runtimeDirectory = runtime .getDir ();
@@ -299,28 +282,44 @@ public void execute() throws BuildException {
299
282
String [] includedFiles = directoryScanner .getIncludedFiles ();
300
283
301
284
for (int i = 0 ; i < includedFiles .length ; i ++) {
302
- copy (new File (runtimeDirectory , includedFiles [i ]), new File (pluginDirectory , includedFiles [i ]));
285
+ String includedFile = includedFiles [i ];
286
+ File source = new File (runtimeDirectory , includedFile );
287
+ File destination = new File (pluginDirectory , includedFile );
288
+ copy (source , destination );
303
289
}
304
290
}
305
291
306
292
// Copy class path entries to Java folder
307
- for (File entry : classPath ) {
308
- if (entry .isDirectory ()) {
309
- copy (entry , new File (classesDirectory , entry .getName ()));
310
- } else {
311
- copy (entry , new File (javaDirectory , entry .getName ()));
293
+ for (FileSet fileSet : classPath ) {
294
+ File classPathDirectory = fileSet .getDir ();
295
+ DirectoryScanner directoryScanner = fileSet .getDirectoryScanner (getProject ());
296
+ String [] includedFiles = directoryScanner .getIncludedFiles ();
297
+
298
+ for (int i = 0 ; i < includedFiles .length ; i ++) {
299
+ String includedFile = includedFiles [i ];
300
+ File source = new File (classPathDirectory , includedFile );
301
+ File destination = new File (javaDirectory , new File (includedFile ).getName ());
302
+ copy (source , destination );
312
303
}
313
304
}
314
305
315
306
// Copy native libraries to MacOS folder
316
- for (File entry : libraryPath ) {
317
- copy (entry , new File (macOSDirectory , entry .getName ()));
307
+ for (FileSet fileSet : libraryPath ) {
308
+ File libraryPathDirectory = fileSet .getDir ();
309
+ DirectoryScanner directoryScanner = fileSet .getDirectoryScanner (getProject ());
310
+ String [] includedFiles = directoryScanner .getIncludedFiles ();
311
+
312
+ for (int i = 0 ; i < includedFiles .length ; i ++) {
313
+ String includedFile = includedFiles [i ];
314
+ File source = new File (libraryPathDirectory , includedFile );
315
+ File destination = new File (macOSDirectory , new File (includedFile ).getName ());
316
+ copy (source , destination );
317
+ }
318
318
}
319
319
320
320
// Copy icon to Resources folder
321
321
if (icon == null ) {
322
- copy (getClass ().getResource (DEFAULT_ICON_NAME ), new File (resourcesDirectory ,
323
- DEFAULT_ICON_NAME ));
322
+ copy (getClass ().getResource (DEFAULT_ICON_NAME ), new File (resourcesDirectory , DEFAULT_ICON_NAME ));
324
323
} else {
325
324
copy (icon , new File (resourcesDirectory , icon .getName ()));
326
325
}
0 commit comments