Skip to content

Commit ada7bd0

Browse files
author
jantje
committed
#1339 fix build.system.path environment var
1 parent 4184d28 commit ada7bd0

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

-1
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

+17-12
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());
@@ -845,7 +847,7 @@ private Map<String, String> getEnVarPlatformInfo() {
845847

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

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

+1
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)