mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
@ -294,8 +294,6 @@ public class Base {
|
|||||||
System.out.println(_("No valid configured cores found! Exiting..."));
|
System.out.println(_("No valid configured cores found! Exiting..."));
|
||||||
System.exit(3);
|
System.exit(3);
|
||||||
}
|
}
|
||||||
for (TargetPackage pack : packages.values())
|
|
||||||
pack.resolveReferencedPlatforms(packages);
|
|
||||||
|
|
||||||
// Setup board-dependent variables.
|
// Setup board-dependent variables.
|
||||||
onBoardOrPortChange();
|
onBoardOrPortChange();
|
||||||
@ -1087,19 +1085,23 @@ public class Base {
|
|||||||
importMenu.add(addLibraryMenuItem);
|
importMenu.add(addLibraryMenuItem);
|
||||||
|
|
||||||
// Split between user supplied libraries and IDE libraries
|
// Split between user supplied libraries and IDE libraries
|
||||||
TargetBoard board = getTargetBoard();
|
TargetPlatform targetPlatform = getTargetPlatform();
|
||||||
|
|
||||||
if (board != null) {
|
if (targetPlatform != null) {
|
||||||
LibraryList ideLibs = getIDELibs();
|
LibraryList ideLibs = getIDELibs();
|
||||||
LibraryList userLibs = getUserLibs();
|
LibraryList userLibs = getUserLibs();
|
||||||
try {
|
try {
|
||||||
// Find the current target. Get the platform, and then select the
|
// Find the current target. Get the platform, and then select the
|
||||||
// correct name and core path.
|
// correct name and core path.
|
||||||
PreferencesMap prefs = board.getMergedPlatformPreferences();
|
PreferencesMap prefs = targetPlatform.getPreferences();
|
||||||
String platformName = prefs.get("name");
|
if (prefs != null) {
|
||||||
JMenuItem platformItem = new JMenuItem(_(platformName));
|
String platformName = prefs.get("name");
|
||||||
platformItem.setEnabled(false);
|
if (platformName != null) {
|
||||||
importMenu.add(platformItem);
|
JMenuItem platformItem = new JMenuItem(_(platformName));
|
||||||
|
platformItem.setEnabled(false);
|
||||||
|
importMenu.add(platformItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (ideLibs.size() > 0) {
|
if (ideLibs.size() > 0) {
|
||||||
importMenu.addSeparator();
|
importMenu.addSeparator();
|
||||||
addLibraries(importMenu, ideLibs);
|
addLibraries(importMenu, ideLibs);
|
||||||
|
@ -132,13 +132,30 @@ public class Compiler implements MessageConsumer {
|
|||||||
throw re;
|
throw re;
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetBoard targetBoard = Base.getTargetBoard();
|
// Check if the board needs a platform from another package
|
||||||
TargetPlatform targetPlatform = targetBoard.getContainerPlatform();
|
TargetPlatform targetPlatform = Base.getTargetPlatform();
|
||||||
|
TargetPlatform corePlatform = null;
|
||||||
|
PreferencesMap boardPreferences = Base.getBoardPreferences();
|
||||||
|
String core = boardPreferences.get("build.core");
|
||||||
|
if (core.contains(":")) {
|
||||||
|
String[] split = core.split(":");
|
||||||
|
core = split[1];
|
||||||
|
corePlatform = Base.getTargetPlatform(split[0], targetPlatform.getId());
|
||||||
|
if (corePlatform == null) {
|
||||||
|
RunnerException re = new RunnerException(I18n
|
||||||
|
.format(_("Selected board depends on '{0}' core (not installed)."),
|
||||||
|
split[0]));
|
||||||
|
re.hideStackTrace();
|
||||||
|
throw re;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Merge all the global preference configuration in order of priority
|
// Merge all the global preference configuration in order of priority
|
||||||
PreferencesMap p = new PreferencesMap();
|
PreferencesMap p = new PreferencesMap();
|
||||||
p.putAll(Preferences.getMap());
|
p.putAll(Preferences.getMap());
|
||||||
p.putAll(targetBoard.getMergedPlatformPreferences());
|
if (corePlatform != null)
|
||||||
|
p.putAll(corePlatform.getPreferences());
|
||||||
|
p.putAll(targetPlatform.getPreferences());
|
||||||
p.putAll(Base.getBoardPreferences());
|
p.putAll(Base.getBoardPreferences());
|
||||||
for (String k : p.keySet()) {
|
for (String k : p.keySet()) {
|
||||||
if (p.get(k) == null)
|
if (p.get(k) == null)
|
||||||
@ -154,12 +171,12 @@ public class Compiler implements MessageConsumer {
|
|||||||
p.put("compiler.path", Base.getAvrBasePath());
|
p.put("compiler.path", Base.getAvrBasePath());
|
||||||
|
|
||||||
// Core folder
|
// Core folder
|
||||||
TargetPlatform tp = targetBoard.getReferencedPlatform();
|
TargetPlatform tp = corePlatform;
|
||||||
if (tp == null)
|
if (tp == null)
|
||||||
tp = targetBoard.getContainerPlatform();
|
tp = targetPlatform;
|
||||||
File coreFolder = new File(tp.getFolder(), "cores");
|
File coreFolder = new File(tp.getFolder(), "cores");
|
||||||
String core = p.get("build.core");
|
|
||||||
coreFolder = new File(coreFolder, core);
|
coreFolder = new File(coreFolder, core);
|
||||||
|
p.put("build.core", core);
|
||||||
p.put("build.core.path", coreFolder.getAbsolutePath());
|
p.put("build.core.path", coreFolder.getAbsolutePath());
|
||||||
|
|
||||||
// System Folder
|
// System Folder
|
||||||
@ -175,8 +192,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
t = targetPlatform;
|
t = targetPlatform;
|
||||||
} else {
|
} else {
|
||||||
String[] split = variant.split(":", 2);
|
String[] split = variant.split(":", 2);
|
||||||
t = Base
|
t = Base.getTargetPlatform(split[0], targetPlatform.getId());
|
||||||
.getTargetPlatform(split[0], Preferences.get("target_platform"));
|
|
||||||
variant = split[1];
|
variant = split[1];
|
||||||
}
|
}
|
||||||
File variantFolder = new File(t.getFolder(), "variants");
|
File variantFolder = new File(t.getFolder(), "variants");
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package processing.app.debug;
|
package processing.app.debug;
|
||||||
|
|
||||||
import static processing.app.I18n._;
|
|
||||||
import static processing.app.I18n.format;
|
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -16,10 +13,6 @@ public class TargetBoard {
|
|||||||
private Map<String, PreferencesMap> menuOptions = new LinkedHashMap<String, PreferencesMap>();
|
private Map<String, PreferencesMap> menuOptions = new LinkedHashMap<String, PreferencesMap>();
|
||||||
private TargetPlatform containerPlatform;
|
private TargetPlatform containerPlatform;
|
||||||
|
|
||||||
private String referencedPackageId;
|
|
||||||
private TargetPlatform referencedPlatform;
|
|
||||||
private TargetPackage referencedPackage;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a TargetBoard based on preferences passed as argument.
|
* Create a TargetBoard based on preferences passed as argument.
|
||||||
*
|
*
|
||||||
@ -35,14 +28,6 @@ public class TargetBoard {
|
|||||||
PreferencesMap menus = prefs.firstLevelMap().get("menu");
|
PreferencesMap menus = prefs.firstLevelMap().get("menu");
|
||||||
if (menus != null)
|
if (menus != null)
|
||||||
menuOptions = menus.firstLevelMap();
|
menuOptions = menus.firstLevelMap();
|
||||||
|
|
||||||
// Setup referenced platform
|
|
||||||
String core = prefs.get("build.core");
|
|
||||||
if (core.contains(":")) {
|
|
||||||
String[] split = core.split(":");
|
|
||||||
referencedPackageId = split[0];
|
|
||||||
prefs.put("build.core", split[1]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,15 +48,6 @@ public class TargetBoard {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the package this board refers to
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getReferencedPackageId() {
|
|
||||||
return referencedPackageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the full preferences map of the board with a given identifier
|
* Get the full preferences map of the board with a given identifier
|
||||||
*
|
*
|
||||||
@ -138,38 +114,4 @@ public class TargetBoard {
|
|||||||
return containerPlatform;
|
return containerPlatform;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resolveReferencedPlatforms(Map<String, TargetPackage> packages)
|
|
||||||
throws Exception {
|
|
||||||
if (referencedPackageId == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!packages.containsKey(referencedPackageId))
|
|
||||||
throw new Exception(
|
|
||||||
format(_("Can't find referenced package ({1}) for board {0}"), id,
|
|
||||||
referencedPackageId));
|
|
||||||
referencedPackage = packages.get(referencedPackageId);
|
|
||||||
|
|
||||||
Map<String, TargetPlatform> platforms = referencedPackage.getPlatforms();
|
|
||||||
|
|
||||||
String ourPlatformId = getContainerPlatform().getId();
|
|
||||||
if (!platforms.containsKey(ourPlatformId))
|
|
||||||
throw new Exception(
|
|
||||||
format(_("Can't find referenced package ({1}) for board {0}"), id,
|
|
||||||
referencedPackageId));
|
|
||||||
referencedPlatform = platforms.get(ourPlatformId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TargetPlatform getReferencedPlatform() {
|
|
||||||
return referencedPlatform;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PreferencesMap getMergedPlatformPreferences() {
|
|
||||||
PreferencesMap res = new PreferencesMap();
|
|
||||||
if (referencedPlatform != null)
|
|
||||||
res.putAll(referencedPlatform.getPreferences());
|
|
||||||
if (containerPlatform.getPreferences() != null)
|
|
||||||
res.putAll(containerPlatform.getPreferences());
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -64,12 +64,6 @@ public class TargetPackage {
|
|||||||
return platforms.get(platform);
|
return platforms.get(platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resolveReferencedPlatforms(Map<String, TargetPackage> packages)
|
|
||||||
throws Exception {
|
|
||||||
for (TargetPlatform platform : getPlatforms().values())
|
|
||||||
platform.resolveReferencedPlatforms(packages);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -163,12 +163,6 @@ public class TargetPlatform {
|
|||||||
return containerPackage;
|
return containerPackage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resolveReferencedPlatforms(Map<String, TargetPackage> packages)
|
|
||||||
throws Exception {
|
|
||||||
for (TargetBoard board : getBoards().values())
|
|
||||||
board.resolveReferencedPlatforms(packages);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String res = "TargetPlatform: name=" + id + " boards={\n";
|
String res = "TargetPlatform: name=" + id + " boards={\n";
|
||||||
|
Reference in New Issue
Block a user