@@ -68,8 +68,8 @@ public class AppBundlerTask extends Task {
6868 // JVM info properties
6969 private String mainClassName = null ;
7070 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 <>();
7373 private ArrayList <String > options = new ArrayList <>();
7474 private ArrayList <String > arguments = new ArrayList <>();
7575
@@ -130,25 +130,11 @@ public void addConfiguredRuntime(FileSet runtime) throws BuildException {
130130 }
131131
132132 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 );
141134 }
142135
143136 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 );
152138 }
153139
154140 public void addConfiguredOption (Option option ) throws BuildException {
@@ -249,9 +235,6 @@ public void execute() throws BuildException {
249235 File javaDirectory = new File (contentsDirectory , "Java" );
250236 javaDirectory .mkdir ();
251237
252- File classesDirectory = new File (javaDirectory , "Classes" );
253- classesDirectory .mkdir ();
254-
255238 File plugInsDirectory = new File (contentsDirectory , "PlugIns" );
256239 plugInsDirectory .mkdir ();
257240
@@ -270,11 +253,11 @@ public void execute() throws BuildException {
270253
271254 // Copy executable to MacOS folder
272255 File executableFile = new File (macOSDirectory , EXECUTABLE_NAME );
273- copy (getClass ().getResource (EXECUTABLE_NAME ), executableFile );
256+ copy (getClass ().getResource (executableFile . getName () ), executableFile );
274257
275258 executableFile .setExecutable (true );
276259
277- // Copy runtime to PlugIns folder (if specified)
260+ // Copy runtime to PlugIns folder
278261 if (runtime != null ) {
279262 // Create root directory
280263 File runtimeDirectory = runtime .getDir ();
@@ -299,28 +282,44 @@ public void execute() throws BuildException {
299282 String [] includedFiles = directoryScanner .getIncludedFiles ();
300283
301284 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 );
303289 }
304290 }
305291
306292 // 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 );
312303 }
313304 }
314305
315306 // 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+ }
318318 }
319319
320320 // Copy icon to Resources folder
321321 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 ));
324323 } else {
325324 copy (icon , new File (resourcesDirectory , icon .getName ()));
326325 }
0 commit comments