remove opengl in preproc, fix permissions, debug bunk

This commit is contained in:
benfry
2010-08-08 22:28:22 +00:00
parent ea6b9dbdaf
commit ef64341d14
7 changed files with 52 additions and 35 deletions

View File

@@ -61,6 +61,19 @@ _ StreamPump has been quieted, but maybe this needs to be a global log setting
X fix the width of the build window
X some sort of warning re: messing with AndroidManifest.xml
X added to the wiki
X implement createGraphics() for A3D/P3D/OPENGL
X http://dev.processing.org/bugs/show_bug.cgi?id=1488
X http://code.google.com/p/processing/issues/detail?id=240
X added a note to the wiki
X make sure that AndroidManifest and other files are copied on Save As
X icons.. any others?
X Errors show up that .java files are duplicates with the Android tools.
X problem is with the packages and where the preproc is putting the file
X example sketch added to bug report
X http://code.google.com/p/processing/issues/detail?id=232
X prevent adding the opengl library when it's not needed
X preprocessor removes the code by before export
X added a note to the wiki
earlier
X if sketchRenderer() et al are used in android, need to add to desktop
@@ -117,15 +130,6 @@ confirm: [ ]
alias, password, confirm, validity (years)
first/last name, ounit, org, city/locale, state/province, country code (xx)
_ make sure that AndroidManifest and other files are copied on Save As
_ icons.. any others?
P3 _ Errors show up that .java files are duplicates with the Android tools.
P3 _ problem is with the packages and where the preproc is putting the file
P3 _ example sketch added to bug report
P3 _ http://dev.processing.org/bugs/show_bug.cgi?id=1472
P3 _ http://code.google.com/p/processing/issues/detail?id=232
_ seems to have problems on 64-bit windows
_ removing local version of java helped someone fix it
@@ -148,10 +152,10 @@ _ "Unable to resolve target 'Google...'" when APIs aren't installed
_ add an error message that explains what to do
_ for libraries that don't work with android, don't let them export
_ e.g. people adding the opengl library when it's not needed
_ http://dev.processing.org/bugs/show_bug.cgi?id=1524
_ http://code.google.com/p/processing/issues/detail?id=248
_ add line for export in libraries to say whether they're compatible
_ even just 'android=' will be ok
_ or 'mode=java,android,python'
_ error messages in runner that are handled special (OOME) need different
_ handling for android vs others.. argh
@@ -179,9 +183,6 @@ CORE (PApplet, P2D et al)
P2 _ too many temporary objects (particularly w/ color) created with A2D
P2 _ http://dev.processing.org/bugs/show_bug.cgi?id=1399
P3 _ implement createGraphics() for A3D/P3D/OPENGL
P3 _ http://dev.processing.org/bugs/show_bug.cgi?id=1488
P3 _ mouseClicked() is currently missing
P3 _ implement tap methods to handle mouseClicked()
P3 _ http://dev.processing.org/bugs/show_bug.cgi?id=1406

View File

@@ -170,7 +170,7 @@ class AndroidDevice implements AndroidDeviceProperties {
final List<String> stackCopy = Collections
.unmodifiableList(new ArrayList<String>(stackTrace));
for (final DeviceListener listener : listeners) {
listener.stacktrace(stackCopy);
listener.stackTrace(stackCopy);
}
stackTrace.clear();
}

View File

@@ -53,9 +53,11 @@ class AndroidEnvironment {
}
}
private AndroidEnvironment() {
System.out.println("Starting up AndroidEnvironment");
if (AndroidTool.DEBUG) {
System.out.println("Starting up AndroidEnvironment");
}
// killAdbServer();
Runtime.getRuntime().addShutdownHook(
new Thread("AndroidEnvironment Shutdown") {

View File

@@ -43,6 +43,8 @@ public class AndroidTool implements Tool, DeviceListener {
private AndroidSDK sdk;
private Editor editor;
private Build build;
static public boolean DEBUG = true;
private static final String ANDROID_CORE_FILENAME =
"processing-android-core-" + Base.VERSION_NAME + ".zip";
@@ -258,13 +260,13 @@ public class AndroidTool implements Tool, DeviceListener {
}
private void buildReleaseForExport() throws MonitorCanceled {
private void buildReleaseForExport(String target) throws MonitorCanceled {
final IndeterminateProgressMonitor monitor =
new IndeterminateProgressMonitor(editor,
"Building and exporting...",
"Creating project...");
try {
File tempFolder = build.createProject("release");
File tempFolder = build.createProject(target);
if (tempFolder == null) {
return;
}
@@ -273,9 +275,9 @@ public class AndroidTool implements Tool, DeviceListener {
throw new MonitorCanceled();
}
monitor.setNote("Building release version...");
if (!build.antBuild("release")) {
return;
}
// if (!build.antBuild("release")) {
// return;
// }
if (monitor.isCanceled()) {
throw new MonitorCanceled();
@@ -377,7 +379,7 @@ public class AndroidTool implements Tool, DeviceListener {
* in the package. If the packaging for droid sketches changes,
* this method will have to change too.
*/
public void stacktrace(final List<String> trace) {
public void stackTrace(final List<String> trace) {
final Iterator<String> frames = trace.iterator();
final String exceptionLine = frames.next();
@@ -460,7 +462,7 @@ public class AndroidTool implements Tool, DeviceListener {
private class ExportHandler implements Runnable {
public void run() {
try {
buildReleaseForExport();
buildReleaseForExport("debug");
} catch (final MonitorCanceled ok) {
editor.statusNotice("Canceled.");
} finally {
@@ -475,6 +477,8 @@ public class AndroidTool implements Tool, DeviceListener {
*/
private class ExportAppHandler implements Runnable {
public void run() {
//buildReleaseForExport("release");
// Need to implement an entire signing setup first
// http://dev.processing.org/bugs/show_bug.cgi?id=1430
editor.statusError("Export application not yet implemented.");

View File

@@ -113,16 +113,17 @@ class Build {
// Create the 'src' folder with the preprocessed code.
final File srcFolder = new File(tempBuildFolder, "src");
Base.openFolder(tempBuildFolder);
if (AndroidTool.DEBUG) Base.openFolder(tempBuildFolder);
try {
manifest = new Manifest(editor);
// System.out.println(manifest + " " + manifest.getPackageName());
final File javaFolder =
mkdirs(srcFolder, manifest.getPackageName().replace('.', '/'));
// File srcFile = new File(actualSrc, className + ".java");
final String buildPath = javaFolder.getAbsolutePath();
// the preproc should take care of this now
// final File javaFolder =
// mkdirs(srcFolder, manifest.getPackageName().replace('.', '/'));
// // File srcFile = new File(actualSrc, className + ".java");
// final String buildPath = javaFolder.getAbsolutePath();
// String prefsLine = Preferences.get("preproc.imports");
// System.out.println("imports are " + prefsLine);
@@ -136,7 +137,9 @@ class Build {
editor.statusError("Could not parse the size() command.");
return null;
}
className = sketch.preprocess(buildPath, new Preproc(sketch.getName()));
className = sketch.preprocess(srcFolder.getAbsolutePath(), //buildPath,
manifest.getPackageName(),
new Preproc(sketch.getName()));
if (className != null) {
// final File androidXML = new File(tempBuildFolder, "AndroidManifest.xml");
// writeAndroidManifest(androidXML, sketch.getName(), className);
@@ -377,6 +380,11 @@ class Build {
program = program.substring(0, start) +
program.substring(start + sizeStatement.length());
}
// String[] found = PApplet.match(program, "import\\s+processing.opengl.*\\s*");
// if (found != null) {
// }
program = program.replaceAll("import\\s+processing\\.opengl\\.\\S+;", "");
// PApplet.println(program);
return super.write(out, program, codeFolderPackages);
}

View File

@@ -3,7 +3,7 @@ package processing.app.tools.android;
import java.util.List;
public interface DeviceListener {
void stacktrace(final List<String> trace);
void stackTrace(final List<String> trace);
void sketchStopped();
}

View File

@@ -84,14 +84,16 @@ public class Manifest {
}
// writer.println(" <uses-permission android:name=\"android.permission.INTERNET\" />");
// writer.println(" <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />");
//writer.println(" <uses-permission android:name=\"android.permission.INTERNET\" />");
//writer.println(" <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />");
static final String PERMISSION_PREFIX = "android.permission.";
public String[] getPermissions() {
XMLElement[] elements = xml.getChildren("uses-permission");
int count = elements.length;
String[] names = new String[count];
for (int i = 0; i < count; i++) {
names[i] = elements[i].getString("android:name");
names[i] = elements[i].getString("android:name").substring(PERMISSION_PREFIX.length());
}
return names;
}
@@ -105,7 +107,7 @@ public class Manifest {
// ...and add the new kids back
for (String name : names) {
XMLElement newbie = new XMLElement("uses-permission");
newbie.setString("android:name", name);
newbie.setString("android:name", PERMISSION_PREFIX + name);
xml.addChild(newbie);
}
save();