diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java index 12641e709..ae3f7e763 100644 --- a/app/src/processing/app/debug/Compiler.java +++ b/app/src/processing/app/debug/Compiler.java @@ -30,6 +30,7 @@ import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map; @@ -102,14 +103,19 @@ public class Compiler implements MessageConsumer { if (verbose) System.out.println(); - String arch = Base.getTargetPlatform().getId(); + List archs = new ArrayList(); + archs.add(Base.getTargetPlatform().getId()); + if (prefs.containsKey("architecture.override_check")) { + String[] overrides = prefs.get("architecture.override_check").split(","); + archs.addAll(Arrays.asList(overrides)); + } for (Library lib : sketch.getImportedLibraries()) { - if (!lib.supportsArchitecture(arch)) { + if (!lib.supportsArchitecture(archs)) { System.err.println(I18n .format(_("WARNING: library {0} claims to run on {1} " + "architecture(s) and may be incompatible with your" - + " current board which runs on [{2}] architecture."), lib - .getName(), lib.getArchitectures(), arch)); + + " current board which runs on {2} architecture(s)."), lib + .getName(), lib.getArchitectures(), archs)); System.err.println(); } } diff --git a/app/src/processing/app/packages/Library.java b/app/src/processing/app/packages/Library.java index 67b8865a3..2ac8e5a43 100644 --- a/app/src/processing/app/packages/Library.java +++ b/app/src/processing/app/packages/Library.java @@ -1,7 +1,5 @@ package processing.app.packages; -import static processing.app.helpers.StringUtils.wildcardMatch; - import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -160,9 +158,30 @@ public class Library { return res; } + /** + * Returns true if the library declares to support the specified + * architecture (through the "architectures" property field). + * + * @param reqArch + * @return + */ public boolean supportsArchitecture(String reqArch) { - for (String arch : architectures) - if (wildcardMatch(reqArch, arch)) + return architectures.contains(reqArch) || architectures.contains("*"); + } + + /** + * Returns true if the library declares to support at least one of the + * specified architectures. + * + * @param reqArchs + * A List of architectures to check + * @return + */ + public boolean supportsArchitecture(List reqArchs) { + if (reqArchs.contains("*")) + return true; + for (String reqArch : reqArchs) + if (supportsArchitecture(reqArch)) return true; return false; }