From 93bed5cdd1cc7deef60f816e5abe3f4b3cab1b48 Mon Sep 17 00:00:00 2001 From: benfry Date: Sun, 10 Apr 2011 20:14:39 +0000 Subject: [PATCH] deal with erroneous warning messages about missing libs with code folder, also if android.* classes are used (issue #568) --- android/todo.txt | 21 ++++---- .../processing/mode/android/AndroidBuild.java | 16 +++++++ app/src/processing/mode/java/Compiler.java | 17 ++++--- app/src/processing/mode/java/JavaBuild.java | 42 +++++++++++----- core/todo.txt | 32 ++++++------- todo.txt | 48 ++++++++++--------- 6 files changed, 109 insertions(+), 67 deletions(-) diff --git a/android/todo.txt b/android/todo.txt index f776940ad..4c710f80a 100644 --- a/android/todo.txt +++ b/android/todo.txt @@ -9,6 +9,8 @@ X modes/android/android-core.zip (No such file or directory) X problem was that the build was ignoring no sdk silently X need to require ANDROID_SDK set for build.xml dist X http://code.google.com/p/processing/issues/detail?id=577 +X No library found for android.content (and all the others) +X need to suppress the messages ala java.* _ "Unable to resolve target 'Google...'" when APIs aren't installed _ add an error message that explains what to do @@ -18,14 +20,18 @@ _ (Linux and Windows) _ crash when trying to change Android mode void sketch no Android SDK Installed _ http://code.google.com/p/processing/issues/detail?id=605 -_ Temp Files are not deleted -_ http://code.google.com/p/processing/issues/detail?id=562 - _ Device Killed or Disconnected Error Message with Libraries _ http://code.google.com/p/processing/issues/detail?id=565 -_ No library found for android.content (and all the others) -_ need to suppress the messages ala java.* +_ when returning to android application, sometimes screen stays black +_ http://code.google.com/p/processing/issues/detail?id=237 +Here's what is happening with the A2D renderer. When the user hits the home button, the Android framework calls PApplet.surfaceDestroyed(), which recycles the drawing surface by calling PGraphicsAndroid2D.dispose(). The surface is never recreated. The code path in PApplet.handleDraw() that reallocates the surface by calling PGraphicsAndroid2D.setSize() is missed because the dimensions of the sketch have not changed. +Removing "bitmap.recycle()" from PGraphicsAndroid2D.dispose() fixes the problem. + +. . . . + +_ Temp Files are not deleted +_ http://code.google.com/p/processing/issues/detail?id=562 _ pause/resume trickiness with interactive apps _ can we serialize objects (even if slow?) @@ -52,11 +58,6 @@ _ optimize for android use _ need sizeChanged() method... _ also add the param to the xml file saying that it can deal w/ rotation -_ when returning to android application, sometimes screen stays black -_ http://code.google.com/p/processing/issues/detail?id=237 -Here's what is happening with the A2D renderer. When the user hits the home button, the Android framework calls PApplet.surfaceDestroyed(), which recycles the drawing surface by calling PGraphicsAndroid2D.dispose(). The surface is never recreated. The code path in PApplet.handleDraw() that reallocates the surface by calling PGraphicsAndroid2D.setSize() is missed because the dimensions of the sketch have not changed. -Removing "bitmap.recycle()" from PGraphicsAndroid2D.dispose() fixes the problem. - _ check out andres' changes for PShape _ ctrl-shift-r (run on device) is totally hosed adb devices diff --git a/app/src/processing/mode/android/AndroidBuild.java b/app/src/processing/mode/android/AndroidBuild.java index d27b0ad1b..d7b0785e5 100644 --- a/app/src/processing/mode/android/AndroidBuild.java +++ b/app/src/processing/mode/android/AndroidBuild.java @@ -79,6 +79,22 @@ class AndroidBuild extends JavaBuild { } + /** + * Tell the PDE to not complain about android.* packages and others that are + * part of the OS library set as if they're missing. + */ + protected boolean ignorableImport(String pkg) { + if (pkg.startsWith("android.")) return true; + if (pkg.startsWith("java.")) return true; + if (pkg.startsWith("javax.")) return true; + if (pkg.startsWith("org.apache.http.")) return true; + if (pkg.startsWith("org.json.")) return true; + if (pkg.startsWith("org.w3c.dom.")) return true; + if (pkg.startsWith("org.xml.sax.")) return true; + return false; + } + + /** * Create an Android project folder, and run the preprocessor on the sketch. * Populates the 'src' folder with Java code, and 'libs' folder with the diff --git a/app/src/processing/mode/java/Compiler.java b/app/src/processing/mode/java/Compiler.java index 1b0f55301..7fc643403 100644 --- a/app/src/processing/mode/java/Compiler.java +++ b/app/src/processing/mode/java/Compiler.java @@ -216,15 +216,18 @@ public class Compiler { errorMessage.endsWith("cannot be resolved")) { // The import poo cannot be resolved //import poo.shoe.blah.*; - String what = errorMessage.substring("The import ".length()); - what = what.substring(0, what.indexOf(' ')); - System.err.println("Note that release 1.0, libraries must be " + + //String what = errorMessage.substring("The import ".length()); + String[] m = PApplet.match(errorMessage, "The import (.*) cannot be resolved"); + //what = what.substring(0, what.indexOf(' ')); + if (m != null) { + exception.setMessage("The package " + + "\u201C" + m[1] + "\u201D" + + " does not exist. " + + "You might be missing a library."); + } + System.err.println("As of release 1.0, libraries must be " + "installed in a folder named 'libraries' " + "inside the 'sketchbook' folder."); - exception.setMessage("The package " + - "\u201C" + what + "\u201D" + - " does not exist. " + - "You might be missing a library."); // // Actually create the folder and open it for the user // File sketchbookLibraries = Base.getSketchbookLibrariesFolder(); diff --git a/app/src/processing/mode/java/JavaBuild.java b/app/src/processing/mode/java/JavaBuild.java index 8ccfe7420..144a64a16 100644 --- a/app/src/processing/mode/java/JavaBuild.java +++ b/app/src/processing/mode/java/JavaBuild.java @@ -73,14 +73,8 @@ public class JavaBuild { * List of library folders, as figured out during preprocessing. */ private ArrayList importedLibraries; - //private ArrayList importedLibraries; -// public Build(Editor editor) { -// this.editor = editor; -// this.sketch = editor.getSketch(); -// } - public JavaBuild(Sketch sketch) { this.sketch = sketch; this.mode = sketch.getMode(); @@ -397,12 +391,22 @@ public class JavaBuild { javaLibraryPath += File.pathSeparator + library.getNativePath(); } } else { - // Don't bother complaining about java.* or javax.* because it's - // probably in boot.class.path. But we're not checking against that - // path since it's enormous. Unfortunately we do still have to check - // for libraries that begin with a prefix like javax, since that - // includes the OpenGL library. - if (!item.startsWith("java.") && !item.startsWith("javax.")) { + boolean found = false; + // If someone insists on unnecessarily repeating the code folder + // import, don't show an error for it. + if (codeFolderPackages != null) { + String itemPkg = item.substring(0, item.lastIndexOf('.')); + for (String pkg : codeFolderPackages) { + if (pkg.equals(itemPkg)) { + found = true; + break; + } + } + } + if (ignorableImport(item)) { + found = true; + } + if (!found) { System.err.println("No library found for " + entry); } } @@ -472,6 +476,20 @@ public class JavaBuild { foundMain = preprocessor.getFoundMain(); return result.className; } + + /** + * Returns true if this package isn't part of a library (it's a system import + * or something like that). Don't bother complaining about java.* or javax.* + * because it's probably in boot.class.path. But we're not checking against + * that path since it's enormous. Unfortunately we do still have to check + * for libraries that begin with a prefix like javax, since that includes + * the OpenGL library, even though we're just returning true here, hrm... + */ + protected boolean ignorableImport(String pkg) { + if (pkg.startsWith("java.")) return true; + if (pkg.startsWith("javax.")) return true; + return false; + } protected int findErrorFile(int errorLine) { diff --git a/core/todo.txt b/core/todo.txt index be581276d..9c06f3a86 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -7,8 +7,11 @@ X removed large synchronized block A OPENGL2 record only saves one line in a LINES shape A http://code.google.com/p/processing/issues/detail?id=579 X add isClosed() and getChildren() methods to PShape -_ questions re: final xml api changes -_ http://code.google.com/p/processing/issues/detail?id=612 +X Frame skipping with processor intensive applets using 1.6 +X http://dev.processing.org/bugs/show_bug.cgi?id=766 +X may be fixed, but not verified +o definite present-mode weirdness with background colors + _ save() no longer works at bottom of draw with JAVA2D X neither does loadPixels it seems @@ -16,8 +19,7 @@ X http://code.google.com/p/processing/issues/detail?id=594 X made an edit so that loadPixels will apply to the offscreen image, but... X ironing out more issues with set() and the latest release - -_ bug: textAlign(RIGHT) is shutting off native fonts +_ textAlign(RIGHT) is shutting off native fonts _ makes salaryper super ugly _ make sure that loadXxxx() methods are used after init() @@ -26,8 +28,6 @@ _ nasty errors when loadImage/Font/createFont/etc used outside _ selectInput() and selectOutput() freeze on OS X _ http://code.google.com/p/processing/issues/detail?id=445 -_ definite present-mode weirdness with background colors - _ OpenGL Applets won't load with JRE 6 update 21 or higher _ http://code.google.com/p/processing/issues/detail?id=429 @@ -69,9 +69,6 @@ _ OpenGL noSmooth() problems _ http://code.google.com/p/processing/issues/detail?id=328 hanging chads for the xml library -_ ref: constructor has changed to .parse(...) instead of new XMLElement(str) -_ add XMLElement.listChildren() to reference -_ document XMLElement save() and write(), and their differences _ possible addition for 'implementation' variable _ http://code.google.com/p/processing/issues/detail?id=281 @@ -240,8 +237,6 @@ _ noloop ref even says that redraw will be called on resize, make sure it is _ add version of math functions that use doubles? _ what other methods should work with doubles? all math functions? _ seems like internal (mostly static) things, but not graphics api -_ look into replacing nanoxml -_ http://www.exampledepot.com/egs/javax.xml.parsers/pkg.html [ known problems ] @@ -262,9 +257,6 @@ _ * this may just be an OutOfMemoryError happening [ needs verification ] -_ Frame skipping with processor intensive applets using 1.6 -_ http://dev.processing.org/bugs/show_bug.cgi?id=766 -_ may be fixed, but not verified _ focus not coming through, ESC no longer working(?) @@ -650,7 +642,6 @@ _ when using get(), reset the bounds for the objects _ otherwise it's always relative to the original document _ support for text (shouldn't be too bad, use createFont) _ implement text spans for svg output -_ get entity tags working in xml library _ try enabling blending modes _ add better support for attributes buried in styles (support ai9/10/11) _ test what happens when transparency is used with gradient fill @@ -687,11 +678,20 @@ _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs LIBRARIES / XML + +_ ref: constructor has changed to .parse(...) instead of new XMLElement(str) +_ add XMLElement.listChildren() to reference +_ document XMLElement save() and write(), and their differences +_ questions re: final xml api changes +_ http://code.google.com/p/processing/issues/detail?id=612 +_ look into replacing nanoxml +_ http://www.exampledepot.com/egs/javax.xml.parsers/pkg.html +_ need to handle bad solution for a symptom X in Editor, textarea.requestFocus -> requestFocusInWindow, watch the bool +X don't reload sketch on "save as" +X this can result in loss of data (undo is lost) +X http://code.google.com/p/processing/issues/detail?id=62 X smooth text on status bar (Linux) X clear up some issues with focus handling +X save as/rename don't properly set focus +X http://code.google.com/p/processing/issues/detail?id=13 +X "No library found" message when using import statements and the code folder +X http://code.google.com/p/processing/issues/detail?id=568 earlier X Unsatisfied Link Error running OPENGL on 64-bit ubuntu @@ -47,27 +54,34 @@ X is there a way to query the default browser? gnome-open? xdg-open? X cleaned up some things inside settings, but this was already done X 64-bit windows causes UnsatisfiedLinkError with OpenGL -0196 -_ help casey re-export all applets for the site -_ include a new version of the reference - -_ "No library found" message when using import statements and the code folder -_ http://code.google.com/p/processing/issues/detail?id=568 +_ even though it doesn't look modified in the GUI, sketch wants to be saved _ Subfolders in /libraries folder not supported anymore (toxi) _ http://code.google.com/p/processing/issues/detail?id=578 + +0196 +_ help casey re-export all applets for the site +_ remove .java files, use one central loading.gif and core.jar? +_ use a custom applet.html template for the export +_ the tool could copy this into the folder just before exporting +_ build a new version of the reference + from peter n lewis _ Use Selection For Find _ http://code.google.com/p/processing/issues/detail?id=571 _ Double and Triple click and drag behaviour _ http://code.google.com/p/processing/issues/detail?id=576 _ double-clicking whitespace selects adjacent chars +_ clicking i-- ) between -- and ) will select "-- )" +_ in eclipse, it looks to see which is closest and selects that +_ need to check behavior for word and bbedit _ http://code.google.com/p/processing/issues/detail?id=59 _ Find Previous and FindReplace dialog cleanup _ http://code.google.com/p/processing/issues/detail?id=580 _ bugs 67, 68, 69 (below) cover more of this + _ Internationalization _ http://code.google.com/p/processing/issues/detail?id=593 @@ -90,6 +104,12 @@ _ move Java-specific InputHandler to its own subclass _ remove any reference to 'Editor' from Sketch.java _ or is that excessive, since Document is in there, etc _ Build does the heavy lifting anyway... +_ TextAreaDefaults +_ is editable in use? +_ what's electricScroll? +_ caretBlinks always true.. just remove the pref? +_ blockCaret always false.. remove it? +_ EditorToolbar, two TODO items for open menu handling blob of mess _ multiple sketch windows.. having a windows menu? @@ -116,13 +136,6 @@ _ p5 assets need to be licensed differently from the source We're making an assumption that the idea of a "library" refers to a block of Java-based code. The reasoning is that from within the PDE, we anticipate that it will be Java-compatible versions of other languages (such as Jython, JRuby, or Scala) as opposed to more generic languages. In the future we could open this up, but we'd rather not complicate things for the moment. -_ TextAreaDefaults -_ is editable in use? -_ what's electricScroll? -_ caretBlinks always true.. just remove the pref? -_ blockCaret always false.. remove it? -_ EditorToolbar, two TODO items for open menu handling - libraries _ need to deal with classpath conflicts _ avoid garbage that people have installed on their machines @@ -192,11 +205,6 @@ _ http://dev.processing.org/bugs/show_bug.cgi?id=72 _ http://code.google.com/p/processing/issues/detail?id=27 Base.restoreSketches() has commented out code that checked for out of bounds windows with the preferences last.window.x and last.window.y. These prefs don't exist anymore, but it would be quick to implement it again using last.sketch.location instead. It would probably result in less code, because it would mean we could get rid of the windowPositionValid stuff. -_ don't reload sketch on "save as" -_ this can result in loss of data (undo is lost) -_ http://code.google.com/p/processing/issues/detail?id=62 -Chris has attached a patch for this one. - _ sketch marked as modified too aggressively _ http://dev.processing.org/bugs/show_bug.cgi?id=328 @@ -1019,10 +1027,6 @@ _ http://processing.org/bugs/show_bug.cgi?id=51 _ code coloring is imperfect because it's not based on a parser _ i.e. mousePressed() is red but mouseMoved() is brown _ http://dev.processing.org/bugs/show_bug.cgi?id=113 -_ clicking i-- ) between -- and ) will select "-- )" -_ in eclipse, it looks to see which is closest and selects that -_ need to check behavior for word and bbedit -_ http://dev.processing.org/bugs/show_bug.cgi?id=348 _ implement emacs keybindings (list is at the bug report) _ http://dev.processing.org/bugs/show_bug.cgi?id=401 _ implement better method of showing curly brace closure