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
static public PreferencesMap getPlatformPreferences(String platformName) {
if (platformName == null)
platformName = Preferences.get("platform");
TargetPackage pack = targetsTable.get(Preferences.get("target_package"));
TargetPlatform target = pack.get(platformName);
return target.getPlatform();
}
static public PreferencesMap getPlatformPreferences(String platformName) {
if (platformName == null)
platformName = Preferences.get("platform");
TargetPackage pack = targetsTable.get(Preferences.get("target_package"));
TargetPlatform target = pack.get(platformName);
return target.getPlatform();
}
static public PreferencesMap getBoardPreferences() {
TargetPlatform target = getTarget();

View File

@ -49,9 +49,10 @@ public class AvrdudeUploader extends Uploader {
TargetPlatform targetPlatform = Base.getTarget();
if (programmer.contains(":")) {
String[] split = programmer.split(":");
targetPlatform = Base.getTargetPlatform(split[0], split[1]);
programmer = split[2];
String[] split = programmer.split(":", 2);
targetPlatform = Base.getTargetPlatform(split[0], Preferences
.get("target_platform"));
programmer = split[1];
}
Collection<String> params = getProgrammerCommands(targetPlatform, programmer);
@ -91,9 +92,10 @@ public class AvrdudeUploader extends Uploader {
String programmer = Preferences.get("programmer");
TargetPlatform targetPlatform = Base.getTarget();
if (programmer.contains(":")) {
String[] split = programmer.split(":");
targetPlatform = Base.getTargetPlatform(split[0], split[1]);
programmer = split[2];
String[] split = programmer.split(":", 2);
targetPlatform = Base.getTargetPlatform(split[0], Preferences
.get("target_platform"));
programmer = split[1];
}
return burnBootloader(getProgrammerCommands(targetPlatform, programmer));
}
@ -146,24 +148,25 @@ public class AvrdudeUploader extends Uploader {
List<String> bootloader = new ArrayList<String>();
String bootloaderPath = boardPreferences.get("bootloader.path");
if (bootloaderPath != null) {
TargetPlatform targetPlatform;
if (bootloaderPath.contains(":")) {
// the current target (associated with the board)
targetPlatform = Base.getTarget();
} else {
String[] split = bootloaderPath.split(":", 3);
targetPlatform = Base.getTargetPlatform(split[0], split[1]);
bootloaderPath = split[2];
}
if (bootloaderPath != null) {
TargetPlatform targetPlatform;
if (bootloaderPath.contains(":")) {
// the current target (associated with the board)
targetPlatform = Base.getTarget();
} else {
String[] split = bootloaderPath.split(":", 2);
targetPlatform = Base.getTargetPlatform(split[0], Preferences
.get("target_platform"));
bootloaderPath = split[1];
}
File bootloadersFile = new File(targetPlatform.getFolder(), "bootloaders");
File bootloaderFile = new File(bootloadersFile, bootloaderPath);
bootloaderPath = bootloaderFile.getAbsolutePath();
File bootloadersFile = new File(targetPlatform.getFolder(), "bootloaders");
File bootloaderFile = new File(bootloadersFile, bootloaderPath);
bootloaderPath = bootloaderFile.getAbsolutePath();
bootloader.add("-Uflash:w:" + bootloaderPath + File.separator
+ boardPreferences.get("bootloader.file") + ":i");
}
bootloader.add("-Uflash:w:" + bootloaderPath + File.separator +
boardPreferences.get("bootloader.file") + ":i");
}
if (boardPreferences.get("bootloader.lock_bits") != null)
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(coreFolder, core);
} else {
String[] split = core.split(":", 3);
TargetPlatform t = Base.getTargetPlatform(split[0], split[1]);
String[] split = core.split(":", 2);
TargetPlatform t = Base.getTargetPlatform(split[0], Preferences
.get("target_platform"));
coreFolder = new File(t.getFolder(), "cores");
coreFolder = new File(coreFolder, split[2]);
coreFolder = new File(coreFolder, split[1]);
}
String corePath = coreFolder.getAbsolutePath();
@ -151,10 +152,11 @@ public class Compiler implements MessageConsumer {
variantFolder = new File(t.getFolder(), "variants");
variantFolder = new File(variantFolder, variant);
} else {
String[] split = variant.split(":");
TargetPlatform t = Base.getTargetPlatform(split[0], split[1]);
String[] split = variant.split(":", 2);
TargetPlatform t = Base.getTargetPlatform(split[0], Preferences
.get("target_platform"));
variantFolder = new File(t.getFolder(), "variants");
variantFolder = new File(variantFolder, split[2]);
variantFolder = new File(variantFolder, split[1]);
}
variantPath = variantFolder.getAbsolutePath();
}