1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-03-14 11:29:26 +01:00

Platform is now implicit when referring to other packages, e.g. 'arduino:avr:arduino' becomes 'arduino:arduino'

This commit is contained in:
Cristian Maglie 2011-12-31 15:23:54 +01:00
parent 770c8dfe35
commit a417455d5a
3 changed files with 40 additions and 35 deletions

View File

@ -1587,13 +1587,13 @@ public class Base {
} }
// Get a specific platform preferences inside actual package // Get a specific platform preferences inside actual package
static public PreferencesMap getPlatformPreferences(String platformName) { static public PreferencesMap getPlatformPreferences(String platformName) {
if (platformName == null) if (platformName == null)
platformName = Preferences.get("platform"); platformName = Preferences.get("platform");
TargetPackage pack = targetsTable.get(Preferences.get("target_package")); TargetPackage pack = targetsTable.get(Preferences.get("target_package"));
TargetPlatform target = pack.get(platformName); TargetPlatform target = pack.get(platformName);
return target.getPlatform(); return target.getPlatform();
} }
static public PreferencesMap getBoardPreferences() { static public PreferencesMap getBoardPreferences() {
TargetPlatform target = getTarget(); TargetPlatform target = getTarget();

View File

@ -49,9 +49,10 @@ public class AvrdudeUploader extends Uploader {
TargetPlatform targetPlatform = Base.getTarget(); TargetPlatform targetPlatform = Base.getTarget();
if (programmer.contains(":")) { if (programmer.contains(":")) {
String[] split = programmer.split(":"); String[] split = programmer.split(":", 2);
targetPlatform = Base.getTargetPlatform(split[0], split[1]); targetPlatform = Base.getTargetPlatform(split[0], Preferences
programmer = split[2]; .get("target_platform"));
programmer = split[1];
} }
Collection<String> params = getProgrammerCommands(targetPlatform, programmer); Collection<String> params = getProgrammerCommands(targetPlatform, programmer);
@ -91,9 +92,10 @@ public class AvrdudeUploader extends Uploader {
String programmer = Preferences.get("programmer"); String programmer = Preferences.get("programmer");
TargetPlatform targetPlatform = Base.getTarget(); TargetPlatform targetPlatform = Base.getTarget();
if (programmer.contains(":")) { if (programmer.contains(":")) {
String[] split = programmer.split(":"); String[] split = programmer.split(":", 2);
targetPlatform = Base.getTargetPlatform(split[0], split[1]); targetPlatform = Base.getTargetPlatform(split[0], Preferences
programmer = split[2]; .get("target_platform"));
programmer = split[1];
} }
return burnBootloader(getProgrammerCommands(targetPlatform, programmer)); return burnBootloader(getProgrammerCommands(targetPlatform, programmer));
} }
@ -146,24 +148,25 @@ public class AvrdudeUploader extends Uploader {
List<String> bootloader = new ArrayList<String>(); List<String> bootloader = new ArrayList<String>();
String bootloaderPath = boardPreferences.get("bootloader.path"); String bootloaderPath = boardPreferences.get("bootloader.path");
if (bootloaderPath != null) { if (bootloaderPath != null) {
TargetPlatform targetPlatform; TargetPlatform targetPlatform;
if (bootloaderPath.contains(":")) { if (bootloaderPath.contains(":")) {
// the current target (associated with the board) // the current target (associated with the board)
targetPlatform = Base.getTarget(); targetPlatform = Base.getTarget();
} else { } else {
String[] split = bootloaderPath.split(":", 3); String[] split = bootloaderPath.split(":", 2);
targetPlatform = Base.getTargetPlatform(split[0], split[1]); targetPlatform = Base.getTargetPlatform(split[0], Preferences
bootloaderPath = split[2]; .get("target_platform"));
} bootloaderPath = split[1];
}
File bootloadersFile = new File(targetPlatform.getFolder(), "bootloaders"); File bootloadersFile = new File(targetPlatform.getFolder(), "bootloaders");
File bootloaderFile = new File(bootloadersFile, bootloaderPath); File bootloaderFile = new File(bootloadersFile, bootloaderPath);
bootloaderPath = bootloaderFile.getAbsolutePath(); bootloaderPath = bootloaderFile.getAbsolutePath();
bootloader.add("-Uflash:w:" + bootloaderPath + File.separator bootloader.add("-Uflash:w:" + bootloaderPath + File.separator +
+ boardPreferences.get("bootloader.file") + ":i"); boardPreferences.get("bootloader.file") + ":i");
} }
if (boardPreferences.get("bootloader.lock_bits") != null) if (boardPreferences.get("bootloader.lock_bits") != null)
bootloader.add("-Ulock:w:" + boardPreferences.get("bootloader.lock_bits") + ":m"); bootloader.add("-Ulock:w:" + boardPreferences.get("bootloader.lock_bits") + ":m");

View File

@ -135,10 +135,11 @@ public class Compiler implements MessageConsumer {
coreFolder = new File(t.getFolder(), "cores"); coreFolder = new File(t.getFolder(), "cores");
coreFolder = new File(coreFolder, core); coreFolder = new File(coreFolder, core);
} else { } else {
String[] split = core.split(":", 3); String[] split = core.split(":", 2);
TargetPlatform t = Base.getTargetPlatform(split[0], split[1]); TargetPlatform t = Base.getTargetPlatform(split[0], Preferences
.get("target_platform"));
coreFolder = new File(t.getFolder(), "cores"); coreFolder = new File(t.getFolder(), "cores");
coreFolder = new File(coreFolder, split[2]); coreFolder = new File(coreFolder, split[1]);
} }
String corePath = coreFolder.getAbsolutePath(); String corePath = coreFolder.getAbsolutePath();
@ -151,10 +152,11 @@ public class Compiler implements MessageConsumer {
variantFolder = new File(t.getFolder(), "variants"); variantFolder = new File(t.getFolder(), "variants");
variantFolder = new File(variantFolder, variant); variantFolder = new File(variantFolder, variant);
} else { } else {
String[] split = variant.split(":"); String[] split = variant.split(":", 2);
TargetPlatform t = Base.getTargetPlatform(split[0], split[1]); TargetPlatform t = Base.getTargetPlatform(split[0], Preferences
.get("target_platform"));
variantFolder = new File(t.getFolder(), "variants"); variantFolder = new File(t.getFolder(), "variants");
variantFolder = new File(variantFolder, split[2]); variantFolder = new File(variantFolder, split[1]);
} }
variantPath = variantFolder.getAbsolutePath(); variantPath = variantFolder.getAbsolutePath();
} }