22
22
* To change this template use File | Settings | File Templates.
23
23
*/
24
24
public class MacBundler {
25
+
26
+ private static final String OSNAME = "mac" ;
25
27
26
28
public static void start (AppDescription app , String dest_dir ) throws Exception {
27
29
//create the dir structure
28
- File destDir = new File (dest_dir +"/mac /" );
30
+ File destDir = new File (dest_dir +"/" + OSNAME + " /" );
29
31
File appDir = new File (destDir ,app .getName ()+".app" );
30
32
appDir .mkdirs ();
31
33
p ("app dir exists = " + appDir .exists ());
@@ -40,10 +42,10 @@ public static void start(AppDescription app, String dest_dir) throws Exception {
40
42
41
43
42
44
for (Jar jar : app .getJars ()) {
43
- p ("processing jar = " + jar .getName () + " os = " +jar .getOS ());
45
+ // p("processing jar = " + jar.getName() + " os = "+jar.getOS());
44
46
if (jar .isOSSpecified ()) {
45
- if (!jar .matchesOS ("mac" )) {
46
- p (" skipping jar" );
47
+ if (!jar .matchesOS (OSNAME )) {
48
+ p (" skipping jar " + jar . getName () );
47
49
continue ;
48
50
}
49
51
}
@@ -109,13 +111,14 @@ public static void start(AppDescription app, String dest_dir) throws Exception {
109
111
110
112
// set the bundle bit
111
113
try {
112
- Runtime .getRuntime ().exec ("/Developer/Tools/SetFile -a B " +appDir );
114
+ // Runtime.getRuntime().exec("/Developer/Tools/SetFile -a B "+appDir);
113
115
} catch (Exception ex ) {
114
116
ex .printStackTrace ();
115
117
}
116
118
}
117
119
118
120
private static void processInfoPlist (AppDescription app , File contentsDir ) throws Exception {
121
+ p ("Processing the info plist" );
119
122
120
123
XMLWriter out = new XMLWriter (new File (contentsDir ,"Info.plist" ));
121
124
out .header ();
@@ -175,7 +178,15 @@ private static void processInfoPlist(AppDescription app, File contentsDir) throw
175
178
out .start ("string" ).text ("$JAVAROOT/" +jar .getName ()).end ();
176
179
}
177
180
for (NativeLib lib : app .getNativeLibs ()) {
178
- for (File jar : lib .getJars ()) {
181
+ p ("native lib: " + lib .getName ());
182
+ p ("getting the common jars" );
183
+ for (File jar : lib .getCommonJars ()) {
184
+ p ("adding native common jar to plist: " + jar .getName ());
185
+ out .start ("string" ).text ("$JAVAROOT/" +jar .getName ()).end ();
186
+ }
187
+ p ("getting the platform jars" );
188
+ for (File jar : lib .getPlatformJars (OSNAME )) {
189
+ p ("adding native only jar to plist: " + jar .getName ());
179
190
out .start ("string" ).text ("$JAVAROOT/" +jar .getName ()).end ();
180
191
}
181
192
}
@@ -206,18 +217,24 @@ private static void p(String s) {
206
217
private static void processNatives (File javaDir , AppDescription app ) throws IOException {
207
218
//track the list of files in the appbundler_tasks.xml
208
219
for (NativeLib lib : app .getNativeLibs ()) {
209
- p ("sucking in native lib: " + lib );
220
+ p ("=== sucking in native lib: " + lib . getName () );
210
221
for (File os : lib .getOSDirs ()) {
211
- p ("os = " + os .getName ());
212
- for (File file : os .listFiles ()) {
213
- p (" file = " + file .getName ());
214
- File destFile = new File (javaDir , file .getName ());
215
- p ("copying to file: " + destFile );
216
- Util .copyToFile (file , destFile );
222
+ //p("os = " + os.getName());
223
+ if (OSNAME .equals (os .getName ())) {
224
+ for (File file : os .listFiles ()) {
225
+ //p(" file = " + file.getName());
226
+ File destFile = new File (javaDir , file .getName ());
227
+ //p("copying to file: " + destFile);
228
+ Util .copyToFile (file , destFile );
229
+ }
217
230
}
218
231
}
219
- for (File jar : lib .getJars ()) {
220
- p ("copying over native lib jar: " + jar .getName ());
232
+ for (File jar : lib .getCommonJars ()) {
233
+ p ("copying over native common jar: " + jar .getName ());
234
+ Util .copyToFile (jar , new File (javaDir , jar .getName ()));
235
+ }
236
+ for (File jar : lib .getPlatformJars (OSNAME )) {
237
+ p ("copying over native only jar: " + jar .getName ());
221
238
Util .copyToFile (jar , new File (javaDir , jar .getName ()));
222
239
}
223
240
}
0 commit comments