1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-17 06:52:18 +01:00

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
This commit is contained in:
Federico Fissore 2015-07-01 16:19:41 +02:00
parent 32cf196271
commit fef4e56044
2 changed files with 16 additions and 8 deletions

View File

@ -21,7 +21,6 @@ import processing.app.packages.LibraryList;
import processing.app.packages.UserLibrary;
import java.io.*;
import java.net.URISyntaxException;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -635,7 +634,7 @@ public class BaseNoGui {
loadHardware(getHardwareFolder());
loadContributedHardware(indexer);
loadHardware(getSketchbookHardwareFolder());
createToolPreferences(indexer);
createToolPreferences(indexer.getInstalledTools(), true);
librariesIndexer = new LibrariesIndexer(BaseNoGui.getSettingsFolder(), indexer);
File librariesIndexFile = librariesIndexer.getIndexFile();
@ -826,12 +825,13 @@ public class BaseNoGui {
}
}
static private void createToolPreferences(ContributionsIndexer indexer) {
// Remove previous runtime preferences
final String prefix = "runtime.tools.";
PreferencesData.removeAllKeysWithPrefix(prefix);
public static void createToolPreferences(Collection<ContributedTool> installedTools, boolean removeOldKeys) {
String prefix = "runtime.tools.";
if (removeOldKeys) {
PreferencesData.removeAllKeysWithPrefix(prefix);
}
for (ContributedTool tool : indexer.getInstalledTools()) {
for (ContributedTool tool : installedTools) {
File installedFolder = tool.getDownloadableContribution(getPlatform()).getInstalledFolder();
if (installedFolder != null) {
PreferencesData.set(prefix + tool.getName() + ".path", installedFolder.getAbsolutePath());

View File

@ -34,6 +34,8 @@ import java.util.*;
import java.util.stream.Stream;
import cc.arduino.MyStreamPumper;
import cc.arduino.contributions.packages.ContributedPlatform;
import cc.arduino.contributions.packages.ContributedTool;
import cc.arduino.packages.BoardPort;
import cc.arduino.packages.Uploader;
import cc.arduino.packages.UploaderFactory;
@ -613,7 +615,13 @@ public class Compiler implements MessageConsumer {
} else {
p.put("build.variant.path", "");
}
ContributedPlatform installedPlatform = BaseNoGui.indexer.getInstalled(referencePlatform.getContainerPackage().getId(), referencePlatform.getId());
if (installedPlatform != null) {
List<ContributedTool> tools = installedPlatform.getResolvedTools();
BaseNoGui.createToolPreferences(tools, false);
}
// Build Time
Date d = new Date();
GregorianCalendar cal = new GregorianCalendar();