mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-18 12:54:25 +01:00
Added the possibility to override library compatibility check
This commit is contained in:
parent
512925a812
commit
2b53d6988a
@ -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<String> archs = new ArrayList<String>();
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -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 <b>true</b> 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 <b>true</b> 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<String> reqArchs) {
|
||||
if (reqArchs.contains("*"))
|
||||
return true;
|
||||
for (String reqArch : reqArchs)
|
||||
if (supportsArchitecture(reqArch))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user