mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
show proper library conflict message, and only show when a problem occurs
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
0204 android
|
||||
X Android emulator not launching on Windows with 2.0 alpha releases
|
||||
X http://code.google.com/p/processing/issues/detail?id=899
|
||||
X http://code.google.com/p/processing/issues/detail?id=769
|
||||
X /opt/android using version #s again? fix build script (earlier)
|
||||
X smooth() is now the default
|
||||
|
||||
|
||||
@@ -219,27 +219,33 @@ public class Library extends InstalledContribution {
|
||||
* imports to specific libraries.
|
||||
* @param importToLibraryTable mapping from package names to Library objects
|
||||
*/
|
||||
public void addPackageList(HashMap<String,Library> importToLibraryTable) {
|
||||
// public void addPackageList(HashMap<String,Library> importToLibraryTable) {
|
||||
public void addPackageList(HashMap<String,ArrayList<Library>> importToLibraryTable) {
|
||||
// PApplet.println(packages);
|
||||
for (String pkg : packageList) {
|
||||
// pw.println(pkg + "\t" + libraryFolder.getAbsolutePath());
|
||||
Library library = importToLibraryTable.get(pkg);
|
||||
if (library != null) {
|
||||
if (!packageWarningMap.containsKey(pkg)) {
|
||||
packageWarningMap.put(pkg, null);
|
||||
// pw.println(pkg + "\t" + libraryFolder.getAbsolutePath());
|
||||
// PApplet.println(pkg + "\t" + getName());
|
||||
// Library library = importToLibraryTable.get(pkg);
|
||||
ArrayList<Library> libraries = importToLibraryTable.get(pkg);
|
||||
if (libraries == null) {
|
||||
libraries = new ArrayList<Library>();
|
||||
importToLibraryTable.put(pkg, libraries);
|
||||
} else {
|
||||
if (Base.DEBUG) {
|
||||
System.err.println("The library found in");
|
||||
System.err.println(getPath());
|
||||
System.err.println("conflicts with");
|
||||
System.err.println(library.getPath());
|
||||
System.err.println("which already defines the package " + pkg);
|
||||
for (Library library : libraries) {
|
||||
System.err.println(library.getPath());
|
||||
}
|
||||
System.err.println("which already define(s) the package " + pkg);
|
||||
System.err.println("If you have a line in your sketch that reads");
|
||||
System.err.println("import " + pkg + ".*;");
|
||||
System.err.println("Then you'll need to first remove one of those libraries.");
|
||||
System.err.println();
|
||||
}
|
||||
} else {
|
||||
importToLibraryTable.put(pkg, this);
|
||||
}
|
||||
libraries.add(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ public abstract class Mode {
|
||||
// protected Tool formatter;
|
||||
|
||||
// maps imported packages to their library folder
|
||||
protected HashMap<String, Library> importToLibraryTable;
|
||||
// protected HashMap<String, Library> importToLibraryTable;
|
||||
protected HashMap<String, ArrayList<Library>> importToLibraryTable;
|
||||
|
||||
// these menus are shared so that they needn't be rebuilt for all windows
|
||||
// each time a sketch is created, renamed, or moved.
|
||||
@@ -115,7 +116,8 @@ public abstract class Mode {
|
||||
// System.out.println("rebuildLibraryList()");
|
||||
|
||||
// reset the table mapping imports to libraries
|
||||
importToLibraryTable = new HashMap<String, Library>();
|
||||
// importToLibraryTable = new HashMap<String, Library>();
|
||||
importToLibraryTable = new HashMap<String, ArrayList<Library>>();
|
||||
|
||||
coreLibraries = Library.list(librariesFolder);
|
||||
contribLibraries = Library.list(base.getSketchbookLibrariesFolder());
|
||||
@@ -129,8 +131,28 @@ public abstract class Mode {
|
||||
}
|
||||
|
||||
|
||||
public Library getLibrary(String name) {
|
||||
return importToLibraryTable.get(name);
|
||||
public Library getLibrary(String pkgName) throws SketchException {
|
||||
ArrayList<Library> libraries = importToLibraryTable.get(pkgName);
|
||||
if (libraries == null) {
|
||||
return null;
|
||||
|
||||
} else if (libraries.size() > 1) {
|
||||
String primary = "More than one library is competing for this sketch.";
|
||||
String secondary = "The import " + pkgName + " points to multiple libraries:<br>";
|
||||
for (Library library : libraries) {
|
||||
String location = library.getPath();
|
||||
if (location.startsWith(getLibrariesFolder().getAbsolutePath())) {
|
||||
location = "part of Processing";
|
||||
}
|
||||
secondary += "<b>" + library.getName() + "</b> (" + location + ")<br>";
|
||||
}
|
||||
secondary += "Extra libraries need to be removed before this sketch can be used.";
|
||||
Base.showWarningTiered("Duplicate Library Problem", primary, secondary, null);
|
||||
throw new SketchException("Duplicate libraries found for " + pkgName + ".");
|
||||
|
||||
} else {
|
||||
return libraries.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@ X http://code.google.com/p/processing/issues/detail?id=877
|
||||
X make note of when library is not available (serial) with error msg
|
||||
X i.e. if running in 64-bit mode on OS X, can't do serial
|
||||
X update to Java 6u29 for Linux and Windows (OS X now updated)
|
||||
X don't show library conflict warning until someone tries to build
|
||||
X with code that actually calls on one of those packages
|
||||
X too many people seem to think this is an error
|
||||
|
||||
fixed in 2.0a3
|
||||
X Commenting via menu or shortcut does not set sketch to "need save"
|
||||
@@ -18,10 +21,6 @@ X otherwise ppl are copying really large files into a jar...
|
||||
_ move Movie Maker out to its own separate tool package (with separate build)
|
||||
_ http://code.google.com/p/processing/issues/detail?id=837
|
||||
|
||||
_ don't show library conflict warning until someone tries to build
|
||||
_ with code that actually calls on one of those packages
|
||||
_ too many people seem to think this is an error
|
||||
|
||||
_ bad tool brings down the environment
|
||||
_ http://code.google.com/p/processing/issues/detail?id=798
|
||||
|
||||
|
||||
Reference in New Issue
Block a user