Skip to content

Commit d75df94

Browse files
author
gk_brown
committed
git-svn-id: https://svn.java.net/svn/appbundler~svn@14 07572b26-92e5-4d45-f66a-c18421440a21
1 parent 0bcc65f commit d75df94

File tree

2 files changed

+47
-47
lines changed

2 files changed

+47
-47
lines changed

appbundler/doc/appbundler.html

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,44 +51,44 @@ <h3>Parameters</h3>
5151
</tr>
5252
<tr>
5353
<td valign="top">name</td>
54-
<td valign="top">The name of the generated bundle.
54+
<td valign="top">The name of the application.
5555
Corresponds to the <code>CFBundleName</code> key in the <tt>Info.plist</tt> file.</td>
5656
<td align="center" valign="top">Yes</td>
5757
</tr>
5858
<tr>
5959
<td valign="top">displayname</td>
60-
<td valign="top">The display name of the generated bundle.
60+
<td valign="top">The display name of the application.
6161
Corresponds to the <code>CFBundleDisplayName</code> key in the <tt>Info.plist</tt> file.</td>
6262
<td align="center" valign="top">Yes</td>
6363
</tr>
6464
<tr>
6565
<td valign="top">identifier</td>
66-
<td valign="top">An identifier string that specifies the application type of the bundle.
66+
<td valign="top">An identifier string that specifies the application type.
6767
Corresponds to the <code>CFBundleIdentifier</code> key in the <tt>Info.plist</tt> file.</td>
6868
<td align="center" valign="top">Yes</td>
6969
</tr>
7070
<tr>
7171
<td valign="top">icon</td>
72-
<td valign="top">The icon file for the bundle.
72+
<td valign="top">The icon file for the application.
7373
Corresponds to the <code>CFBundleIconFile</code> key in the <tt>Info.plist</tt> file.</td>
7474
<td align="center" valign="top">No</td>
7575
</tr>
7676
<tr>
7777
<td valign="top">shortversion</td>
78-
<td valign="top">The release version number string for the bundle.
78+
<td valign="top">The release version number string for the application.
7979
Corresponds to the <code>CFBundleShortVersionString</code> key in the <tt>Info.plist</tt>
8080
file.</td>
8181
<td align="center" valign="top">No</td>
8282
</tr>
8383
<tr>
8484
<td valign="top">signature</td>
85-
<td valign="top">The four-letter code identifying the bundle creator.
85+
<td valign="top">The four-letter code identifying the application creator.
8686
Corresponds to the <code>CFBundleSignature</code> key in the <tt>Info.plist</tt> file.</td>
8787
<td align="center" valign="top">No</td>
8888
</tr>
8989
<tr>
9090
<td valign="top">copyright</td>
91-
<td valign="top">The copyright notice for the bundle.
91+
<td valign="top">The copyright notice for the application.
9292
Corresponds to the <code>NSHumanReadableCopyright</code> key in the <tt>Info.plist</tt>
9393
file.</td>
9494
<td align="center" valign="top">No</td>
@@ -105,22 +105,23 @@ <h3>Parameters</h3>
105105
<h3>Parameters specified as nested elements</h3>
106106
<h4>runtime</h4>
107107
<p>A <a href="http://ant.apache.org/manual/Types/fileset.html">fileset</a> representing the Java
108-
runtime to embed in the bundle. Corresponds to the <code>JVMRuntime</code> key in the
108+
runtime to embed in the application. Corresponds to the <code>JVMRuntime</code> key in the
109109
<tt>Info.plist</tt> file. If specified, the contents of this directory will be copied to the
110110
<tt>Contents/PlugIns/</tt> folder of the generated bundle. If unspecified, the target system must
111-
have a shared JRE installed in <tt>/Library/Internet Plug-Ins/JavaAppletPlugin.plugin</tt>.</p>
111+
have a shared JRE installed in <tt>/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/</tt>.</p>
112+
<p>This element is optional.</p>
112113

113114
<h4>classpath</h4>
114115
<p>A <a href="http://ant.apache.org/manual/Types/fileset.html">fileset</a> representing the class
115-
path of the bundled application. Corresponds to the <tt>java.class.path</tt> system property. If
116-
an entry refers to a directory, it will be recursively copied to the <tt>Contents/Java/Classes/</tt>
117-
folder of the generated bundle. Otherwise, the entry will be copied to the <tt>Contents/Java/</tt>
118-
folder of the generated bundle.</p>
116+
path of the bundled application. Corresponds to the <tt>java.class.path</tt> system property.
117+
Entries will be copied to the <tt>Contents/Java/</tt> folder of the generated bundle.</p>
118+
<p>This element is required.</p>
119119

120120
<h4>librarypath</h4>
121121
<p>A <a href="http://ant.apache.org/manual/Types/fileset.html">fileset</a> representing the library
122122
path of the bundled application. Corresponds to the <tt>java.library.path</tt> system property.
123123
Entries will be copied to the <tt>Contents/MacOS/</tt> folder of the generated bundle.</p>
124+
<p>This element is optional.</p>
124125

125126
<h4>option</h4>
126127
<p>Specifies a command-line option to be passed to the JVM at startup.</p>
@@ -138,7 +139,7 @@ <h4>option</h4>
138139
</table>
139140

140141
<h4>argument</h4>
141-
<p>Specifies a command-line argument to be passed to the application at startup.</p>
142+
<p>Specifies a command-line argument to be passed to the bundled application at startup.</p>
142143
<table border="1" cellpadding="2" cellspacing="0">
143144
<tr>
144145
<td valign="top"><b>Attribute</b></td>

appbundler/src/com/oracle/appbundler/AppBundlerTask.java

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)