Skip to content

Commit a417455

Browse files
committed
Platform is now implicit when referring to other packages, e.g. 'arduino:avr:arduino' becomes 'arduino:arduino'
1 parent 770c8df commit a417455

File tree

3 files changed

+42
-37
lines changed

3 files changed

+42
-37
lines changed

app/src/processing/app/Base.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,13 +1587,13 @@ static public TargetPlatform getTargetPlatform(String pack, String platform) {
15871587
}
15881588

15891589
// Get a specific platform preferences inside actual package
1590-
static public PreferencesMap getPlatformPreferences(String platformName) {
1591-
if (platformName == null)
1592-
platformName = Preferences.get("platform");
1593-
TargetPackage pack = targetsTable.get(Preferences.get("target_package"));
1594-
TargetPlatform target = pack.get(platformName);
1595-
return target.getPlatform();
1596-
}
1590+
static public PreferencesMap getPlatformPreferences(String platformName) {
1591+
if (platformName == null)
1592+
platformName = Preferences.get("platform");
1593+
TargetPackage pack = targetsTable.get(Preferences.get("target_package"));
1594+
TargetPlatform target = pack.get(platformName);
1595+
return target.getPlatform();
1596+
}
15971597

15981598
static public PreferencesMap getBoardPreferences() {
15991599
TargetPlatform target = getTarget();

app/src/processing/app/debug/AvrdudeUploader.java

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ public boolean uploadUsingPreferences(String buildPath, String className, boolea
4949
TargetPlatform targetPlatform = Base.getTarget();
5050

5151
if (programmer.contains(":")) {
52-
String[] split = programmer.split(":");
53-
targetPlatform = Base.getTargetPlatform(split[0], split[1]);
54-
programmer = split[2];
52+
String[] split = programmer.split(":", 2);
53+
targetPlatform = Base.getTargetPlatform(split[0], Preferences
54+
.get("target_platform"));
55+
programmer = split[1];
5556
}
5657

5758
Collection<String> params = getProgrammerCommands(targetPlatform, programmer);
@@ -91,9 +92,10 @@ public boolean burnBootloader() throws RunnerException {
9192
String programmer = Preferences.get("programmer");
9293
TargetPlatform targetPlatform = Base.getTarget();
9394
if (programmer.contains(":")) {
94-
String[] split = programmer.split(":");
95-
targetPlatform = Base.getTargetPlatform(split[0], split[1]);
96-
programmer = split[2];
95+
String[] split = programmer.split(":", 2);
96+
targetPlatform = Base.getTargetPlatform(split[0], Preferences
97+
.get("target_platform"));
98+
programmer = split[1];
9799
}
98100
return burnBootloader(getProgrammerCommands(targetPlatform, programmer));
99101
}
@@ -146,24 +148,25 @@ protected boolean burnBootloader(Collection<String> params)
146148
List<String> bootloader = new ArrayList<String>();
147149
String bootloaderPath = boardPreferences.get("bootloader.path");
148150

149-
if (bootloaderPath != null) {
150-
TargetPlatform targetPlatform;
151-
if (bootloaderPath.contains(":")) {
152-
// the current target (associated with the board)
153-
targetPlatform = Base.getTarget();
154-
} else {
155-
String[] split = bootloaderPath.split(":", 3);
156-
targetPlatform = Base.getTargetPlatform(split[0], split[1]);
157-
bootloaderPath = split[2];
158-
}
159-
160-
File bootloadersFile = new File(targetPlatform.getFolder(), "bootloaders");
161-
File bootloaderFile = new File(bootloadersFile, bootloaderPath);
162-
bootloaderPath = bootloaderFile.getAbsolutePath();
163-
164-
bootloader.add("-Uflash:w:" + bootloaderPath + File.separator
165-
+ boardPreferences.get("bootloader.file") + ":i");
166-
}
151+
if (bootloaderPath != null) {
152+
TargetPlatform targetPlatform;
153+
if (bootloaderPath.contains(":")) {
154+
// the current target (associated with the board)
155+
targetPlatform = Base.getTarget();
156+
} else {
157+
String[] split = bootloaderPath.split(":", 2);
158+
targetPlatform = Base.getTargetPlatform(split[0], Preferences
159+
.get("target_platform"));
160+
bootloaderPath = split[1];
161+
}
162+
163+
File bootloadersFile = new File(targetPlatform.getFolder(), "bootloaders");
164+
File bootloaderFile = new File(bootloadersFile, bootloaderPath);
165+
bootloaderPath = bootloaderFile.getAbsolutePath();
166+
167+
bootloader.add("-Uflash:w:" + bootloaderPath + File.separator +
168+
boardPreferences.get("bootloader.file") + ":i");
169+
}
167170
if (boardPreferences.get("bootloader.lock_bits") != null)
168171
bootloader.add("-Ulock:w:" + boardPreferences.get("bootloader.lock_bits") + ":m");
169172

app/src/processing/app/debug/Compiler.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,11 @@ public boolean compile(Sketch _sketch, String _buildPath,
135135
coreFolder = new File(t.getFolder(), "cores");
136136
coreFolder = new File(coreFolder, core);
137137
} else {
138-
String[] split = core.split(":", 3);
139-
TargetPlatform t = Base.getTargetPlatform(split[0], split[1]);
138+
String[] split = core.split(":", 2);
139+
TargetPlatform t = Base.getTargetPlatform(split[0], Preferences
140+
.get("target_platform"));
140141
coreFolder = new File(t.getFolder(), "cores");
141-
coreFolder = new File(coreFolder, split[2]);
142+
coreFolder = new File(coreFolder, split[1]);
142143
}
143144
String corePath = coreFolder.getAbsolutePath();
144145

@@ -151,10 +152,11 @@ public boolean compile(Sketch _sketch, String _buildPath,
151152
variantFolder = new File(t.getFolder(), "variants");
152153
variantFolder = new File(variantFolder, variant);
153154
} else {
154-
String[] split = variant.split(":");
155-
TargetPlatform t = Base.getTargetPlatform(split[0], split[1]);
155+
String[] split = variant.split(":", 2);
156+
TargetPlatform t = Base.getTargetPlatform(split[0], Preferences
157+
.get("target_platform"));
156158
variantFolder = new File(t.getFolder(), "variants");
157-
variantFolder = new File(variantFolder, split[2]);
159+
variantFolder = new File(variantFolder, split[1]);
158160
}
159161
variantPath = variantFolder.getAbsolutePath();
160162
}

0 commit comments

Comments
 (0)