diff --git a/app/src/processing/app/Library.java b/app/src/processing/app/Library.java index c6552514f..08fea85fa 100644 --- a/app/src/processing/app/Library.java +++ b/app/src/processing/app/Library.java @@ -26,6 +26,9 @@ public class Library extends InstalledContribution { /** Applet exports (cross-platform by definition). */ String[] appletExportList; + /** Android exports (single platform for now, may not exist). */ + String[] androidExportList; + /** True if there are separate 32/64 bit for the specified platform index. */ boolean[] multipleArch = new boolean[platformNames.length]; @@ -60,6 +63,7 @@ public class Library extends InstalledContribution { if (name.equals("linux")) return false; if (name.equals("linux32")) return false; if (name.equals("linux64")) return false; + if (name.equals("android")) return false; } return true; } @@ -100,6 +104,13 @@ public class Library extends InstalledContribution { appletExportList = baseList; } + String androidExportStr = exportTable.get("android"); + if (androidExportStr != null) { + androidExportList = PApplet.splitTokens(androidExportStr, ", "); + } else { + androidExportList = baseList; + } + // for the host platform, need to figure out what's available File nativeLibraryFolder = libraryFolder; String hostPlatform = Base.getPlatformName(); @@ -338,6 +349,11 @@ public class Library extends InstalledContribution { } return exportList.get(platformName); } + + + public File[] getAndroidExports() { + return wrapFiles(androidExportList); + } // public boolean hasMultiplePlatforms() { diff --git a/app/src/processing/mode/android/AndroidBuild.java b/app/src/processing/mode/android/AndroidBuild.java index 0f5a0b022..217e0d42e 100644 --- a/app/src/processing/mode/android/AndroidBuild.java +++ b/app/src/processing/mode/android/AndroidBuild.java @@ -22,7 +22,6 @@ package processing.mode.android; import java.io.*; -import java.util.*; import org.apache.tools.ant.*; @@ -589,50 +588,80 @@ class AndroidBuild extends JavaBuild { */ private void copyLibraries(final File libsFolder, final File assetsFolder) throws IOException { - // Copy any libraries to the 'libs' folder for (Library library : getImportedLibraries()) { - File libraryFolder = new File(library.getPath()); - // in the list is a File object that points the - // library sketch's "library" folder - final File exportSettings = new File(libraryFolder, "export.txt"); - final HashMap exportTable = - Base.readSettings(exportSettings); - final String androidList = exportTable.get("android"); - String exportList[] = null; - if (androidList != null) { - exportList = PApplet.splitTokens(androidList, ", "); - } else { - exportList = libraryFolder.list(); - } - for (int i = 0; i < exportList.length; i++) { - exportList[i] = PApplet.trim(exportList[i]); - if (exportList[i].equals("") || exportList[i].equals(".") - || exportList[i].equals("..")) { - continue; - } - - final File exportFile = new File(libraryFolder, exportList[i]); + // add each item from the library folder / export list to the output + for (File exportFile : library.getAndroidExports()) { + String exportName = exportFile.getName(); if (!exportFile.exists()) { - System.err.println("File " + exportList[i] + " does not exist"); + System.err.println(exportFile.getName() + + " is mentioned in export.txt, but it's " + + "a big fat lie and does not exist."); } else if (exportFile.isDirectory()) { - System.err.println("Ignoring sub-folder \"" + exportList[i] + "\""); + Base.copyDir(exportFile, new File(assetsFolder, exportName)); + + } else if (exportName.toLowerCase().endsWith(".zip")) { + // As of r4 of the Android SDK, it looks like .zip files + // are ignored in the libs folder, so rename to .jar + System.err.println(".zip files are not allowed in Android libraries."); + System.err.println("Please rename " + exportFile.getName() + " to be a .jar file."); + String jarName = exportName.substring(0, exportName.length() - 4) + ".jar"; + Base.copyFile(exportFile, new File(libsFolder, jarName)); + + } else if (exportName.toLowerCase().endsWith(".jar")) { + Base.copyFile(exportFile, new File(libsFolder, exportName)); + } else { - final String name = exportFile.getName(); - final String lcname = name.toLowerCase(); - if (lcname.endsWith(".zip") || lcname.endsWith(".jar")) { - // As of r4 of the Android SDK, it looks like .zip files - // are ignored in the libs folder, so rename to .jar - final String jarName = - name.substring(0, name.length() - 4) + ".jar"; - Base.copyFile(exportFile, new File(libsFolder, jarName)); - } else { - // just copy other files over directly - Base.copyFile(exportFile, new File(assetsFolder, name)); - } + Base.copyFile(exportFile, new File(assetsFolder, exportName)); } } } } +// private void copyLibraries(final File libsFolder, +// final File assetsFolder) throws IOException { +// // Copy any libraries to the 'libs' folder +// for (Library library : getImportedLibraries()) { +// File libraryFolder = new File(library.getPath()); +// // in the list is a File object that points the +// // library sketch's "library" folder +// final File exportSettings = new File(libraryFolder, "export.txt"); +// final HashMap exportTable = +// Base.readSettings(exportSettings); +// final String androidList = exportTable.get("android"); +// String exportList[] = null; +// if (androidList != null) { +// exportList = PApplet.splitTokens(androidList, ", "); +// } else { +// exportList = libraryFolder.list(); +// } +// for (int i = 0; i < exportList.length; i++) { +// exportList[i] = PApplet.trim(exportList[i]); +// if (exportList[i].equals("") || exportList[i].equals(".") +// || exportList[i].equals("..")) { +// continue; +// } +// +// final File exportFile = new File(libraryFolder, exportList[i]); +// if (!exportFile.exists()) { +// System.err.println("File " + exportList[i] + " does not exist"); +// } else if (exportFile.isDirectory()) { +// System.err.println("Ignoring sub-folder \"" + exportList[i] + "\""); +// } else { +// final String name = exportFile.getName(); +// final String lcname = name.toLowerCase(); +// if (lcname.endsWith(".zip") || lcname.endsWith(".jar")) { +// // As of r4 of the Android SDK, it looks like .zip files +// // are ignored in the libs folder, so rename to .jar +// final String jarName = +// name.substring(0, name.length() - 4) + ".jar"; +// Base.copyFile(exportFile, new File(libsFolder, jarName)); +// } else { +// // just copy other files over directly +// Base.copyFile(exportFile, new File(assetsFolder, name)); +// } +// } +// } +// } +// } private void copyCodeFolder(final File libsFolder) throws IOException { diff --git a/app/src/processing/mode/android/AndroidRunner.java b/app/src/processing/mode/android/AndroidRunner.java index 5a756a7cd..155169274 100644 --- a/app/src/processing/mode/android/AndroidRunner.java +++ b/app/src/processing/mode/android/AndroidRunner.java @@ -84,7 +84,7 @@ public class AndroidRunner implements DeviceListener { listener.statusNotice("Starting sketch on " + device.getId()); if (startSketch(build, device)) { listener.statusNotice("Sketch launched on the " - + (device.isEmulator() ? "emulator" : "phone") + "."); + + (device.isEmulator() ? "emulator" : "device") + "."); } else { listener.statusError("Could not start the sketch."); } @@ -174,7 +174,7 @@ public class AndroidRunner implements DeviceListener { listener.statusNotice("Starting sketch on " + device.getId()); if (startSketch(build, device)) { listener.statusNotice("Sketch launched on the " - + (device.isEmulator() ? "emulator" : "phone") + "."); + + (device.isEmulator() ? "emulator" : "device") + "."); } else { listener.statusError("Could not start the sketch."); } diff --git a/app/src/processing/mode/java/JavaBuild.java b/app/src/processing/mode/java/JavaBuild.java index a38cbea5b..e0ec47f26 100644 --- a/app/src/processing/mode/java/JavaBuild.java +++ b/app/src/processing/mode/java/JavaBuild.java @@ -1288,8 +1288,8 @@ public class JavaBuild { // Base.copyDir(exportFile, new File(destFolder, exportName)); // } - } else if (exportFile.getName().toLowerCase().endsWith(".zip") || - exportFile.getName().toLowerCase().endsWith(".jar")) { + } else if (exportName.toLowerCase().endsWith(".zip") || + exportName.toLowerCase().endsWith(".jar")) { Base.copyFile(exportFile, new File(jarFolder, exportName)); jarListVector.add(exportName); diff --git a/todo.txt b/todo.txt index c862f68df..c621500a3 100644 --- a/todo.txt +++ b/todo.txt @@ -3,7 +3,12 @@ X fix problem with serial not loading on macosx X fix problem with popup menus on the toolbar disappearing immediately (osx) X http://code.google.com/p/processing/issues/detail?id=846 X http://code.google.com/p/processing/issues/detail?id=887 +X Incorrect tab/line shown for preprocessor errors when more than 2 tabs +X http://code.google.com/p/processing/issues/detail?id=873 +earlier +X IDE Export Application button exports applet +X http://code.google.com/p/processing/issues/detail?id=863 _ make note of when library is not available (serial) with error msg _ i.e. if running in 64-bit mode on OS X, can't do serial