Skip to content

Commit 4b6659d

Browse files
author
jantje
committed
#1339 fix build.system.path environment var
1 parent 979f0ed commit 4b6659d

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

io.sloeber.core/config/pre_processing_platform_default.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ recipe.objcopy.hex.pattern=${recipe.objcopy.bin.pattern}
44
archive_file=arduino.ar
55
archive_file_path=${build.path}/${archive_file}
66
runtime.ide.version=10812
7-
build.system.path=${runtime.platform.path}${DirectoryDelimiter}system
87
serial.port=${com_port}
98
build.project_name=${ProjName}
109

io.sloeber.core/src/io/sloeber/core/api/BoardDescription.java

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public class BoardDescription {
4545
private static final String ENV_KEY_SERIAL_DOT_PORT = "serial.port"; //$NON-NLS-1$
4646
private static final String ENV_KEY_SERIAL_PORT_FILE = "serial.port.file"; //$NON-NLS-1$
4747
private static final String ENV_KEY_BUILD_VARIANT_PATH = BUILD + DOT + VARIANT + DOT + PATH;
48+
private static final String ENV_KEY_BUILD_SYSTEM_PATH = BUILD + DOT + SYSTEM + DOT + PATH;
4849
private static final String ENV_KEY_BUILD_ACTUAL_CORE_PATH = BUILD + DOT + CORE + DOT + PATH;
4950
private static final String ENV_KEY_BUILD_ARCH = BUILD + DOT + "arch"; //$NON-NLS-1$
5051
private static final String ENV_KEY_HARDWARE_PATH = RUNTIME + DOT + HARDWARE + DOT + PATH;
@@ -611,10 +612,9 @@ public String getUploadPatternKey() {
611612
public IPath getreferencedHardwarePath() {
612613
updateWhenDirty();
613614
if (myReferencedPlatformCore == null) {
614-
return new Path(myBoardTxtFile.getLoadedFile().toString()).removeLastSegments(2);
615+
return new Path(myBoardTxtFile.getLoadedFile().toString()).removeLastSegments(1);
615616
}
616-
IPath platformPath = myReferencedPlatformCore.getInstallPath();
617-
return platformPath.removeLastSegments(1);
617+
return myReferencedPlatformCore.getInstallPath();
618618
}
619619

620620
/*
@@ -773,8 +773,10 @@ public Map<String, String> getEnvVars() {
773773
allVars.putAll(pluginPreProcessingBoardsTxt.getBoardEnvironVars(getBoardID()));
774774

775775
String architecture = getArchitecture();
776+
IPath coreHardwarePath = getreferencedHardwarePath();
776777
allVars.put(ENV_KEY_BUILD_ARCH, architecture.toUpperCase());
777-
allVars.put(ENV_KEY_HARDWARE_PATH, getreferencedHardwarePath().toOSString());
778+
allVars.put(ENV_KEY_HARDWARE_PATH, coreHardwarePath.removeLastSegments(1).toOSString());
779+
allVars.put(ENV_KEY_BUILD_SYSTEM_PATH, coreHardwarePath.append(SYSTEM).toOSString());
778780
allVars.put(ENV_KEY_PLATFORM_PATH, getreferencingPlatformPath().toOSString());
779781

780782
allVars.put(ENV_KEY_SERIAL_PORT, getActualUploadPort());
@@ -846,7 +848,7 @@ private Map<String, String> getEnVarPlatformInfo() {
846848

847849
if (referencingPlatform == null) {
848850
// This is the case for private hardware
849-
//there is no need to specidy tool path as they do not use them
851+
//there is no need to specify tool path as they do not use them
850852
return ret;
851853
}
852854
ArduinoPlatformVersion latestArduinoPlatform = BoardsManager.getNewestInstalledPlatform(Const.ARDUINO,
@@ -886,13 +888,16 @@ private Map<String, String> getEnVarPlatformInfo() {
886888
private static Map<String, String> getEnvVarPlatformFileTools(ArduinoPlatformVersion platformVersion) {
887889
HashMap<String, String> vars = new HashMap<>();
888890
for (ArduinoPlatformTooldDependency tool : platformVersion.getToolsDependencies()) {
889-
String installPath = tool.getInstallPath().toOSString();
890-
String keyString = RUNTIME_TOOLS + tool.getName() + tool.getVersion() + DOT_PATH;
891-
vars.put(keyString, installPath);
892-
keyString = RUNTIME_TOOLS + tool.getName() + '-' + tool.getVersion() + DOT_PATH;
893-
vars.put(keyString, installPath);
894-
keyString = RUNTIME_TOOLS + tool.getName() + DOT_PATH;
895-
vars.put(keyString, installPath);
891+
IPath installPath = tool.getInstallPath();
892+
if (installPath.toFile().exists()) {
893+
String value = installPath.toOSString();
894+
String keyString = RUNTIME_TOOLS + tool.getName() + tool.getVersion() + DOT_PATH;
895+
vars.put(keyString, value);
896+
keyString = RUNTIME_TOOLS + tool.getName() + '-' + tool.getVersion() + DOT_PATH;
897+
vars.put(keyString, value);
898+
keyString = RUNTIME_TOOLS + tool.getName() + DOT_PATH;
899+
vars.put(keyString, value);
900+
}
896901
}
897902
return vars;
898903
}

io.sloeber.core/src/io/sloeber/core/common/Const.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public class Const {
5050
public static final String AUTH = "auth";
5151
public static final String RECIPE = "recipe";
5252
public static final String BUILD = "build";
53+
public static final String SYSTEM = "system";
5354
public static final String COM_PORT = "com_port";
5455
public static final String ARDUINO = "arduino";
5556
public static final String PATH = "path";

0 commit comments

Comments
 (0)