Skip to content

Commit fef4e56

Browse files
author
Federico Fissore
committed
Tools path unversioned properties are adjusted right before compiling.
This way, when multiple versions of, e.g., bossac are installed and a platform uses bossac 1.5, core author will be able to specify just tools.bossac.path={runtime.tools.bossac.path} and the IDE will set it to right version of bossac Fixes #3325
1 parent 32cf196 commit fef4e56

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

arduino-core/src/processing/app/BaseNoGui.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import processing.app.packages.UserLibrary;
2222

2323
import java.io.*;
24-
import java.net.URISyntaxException;
2524
import java.util.*;
2625
import java.util.logging.Level;
2726
import java.util.logging.Logger;
@@ -635,7 +634,7 @@ static public void initPackages() throws Exception {
635634
loadHardware(getHardwareFolder());
636635
loadContributedHardware(indexer);
637636
loadHardware(getSketchbookHardwareFolder());
638-
createToolPreferences(indexer);
637+
createToolPreferences(indexer.getInstalledTools(), true);
639638

640639
librariesIndexer = new LibrariesIndexer(BaseNoGui.getSettingsFolder(), indexer);
641640
File librariesIndexFile = librariesIndexer.getIndexFile();
@@ -826,12 +825,13 @@ static protected void loadContributedHardware(ContributionsIndexer indexer) {
826825
}
827826
}
828827

829-
static private void createToolPreferences(ContributionsIndexer indexer) {
830-
// Remove previous runtime preferences
831-
final String prefix = "runtime.tools.";
832-
PreferencesData.removeAllKeysWithPrefix(prefix);
828+
public static void createToolPreferences(Collection<ContributedTool> installedTools, boolean removeOldKeys) {
829+
String prefix = "runtime.tools.";
830+
if (removeOldKeys) {
831+
PreferencesData.removeAllKeysWithPrefix(prefix);
832+
}
833833

834-
for (ContributedTool tool : indexer.getInstalledTools()) {
834+
for (ContributedTool tool : installedTools) {
835835
File installedFolder = tool.getDownloadableContribution(getPlatform()).getInstalledFolder();
836836
if (installedFolder != null) {
837837
PreferencesData.set(prefix + tool.getName() + ".path", installedFolder.getAbsolutePath());

arduino-core/src/processing/app/debug/Compiler.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
import java.util.stream.Stream;
3535

3636
import cc.arduino.MyStreamPumper;
37+
import cc.arduino.contributions.packages.ContributedPlatform;
38+
import cc.arduino.contributions.packages.ContributedTool;
3739
import cc.arduino.packages.BoardPort;
3840
import cc.arduino.packages.Uploader;
3941
import cc.arduino.packages.UploaderFactory;
@@ -613,7 +615,13 @@ private PreferencesMap createBuildPreferences(String _buildPath,
613615
} else {
614616
p.put("build.variant.path", "");
615617
}
616-
618+
619+
ContributedPlatform installedPlatform = BaseNoGui.indexer.getInstalled(referencePlatform.getContainerPackage().getId(), referencePlatform.getId());
620+
if (installedPlatform != null) {
621+
List<ContributedTool> tools = installedPlatform.getResolvedTools();
622+
BaseNoGui.createToolPreferences(tools, false);
623+
}
624+
617625
// Build Time
618626
Date d = new Date();
619627
GregorianCalendar cal = new GregorianCalendar();

0 commit comments

Comments
 (0)