Skip to content

Commit 9945af5

Browse files
committed
#661 on linux environment vars with . fail with ENVIRON + mawk issue
mawk does not like th \s for space and I didn't find a good solution so I removed the space then numbers part of the regex This should not be a problem because it is not a line selection criteria but a way to select the second column As the awk solution already assumed the interesting data is in the second column we already lost this capability Also the ENVIRON[XX.YY] did not work. Not in mawk nor in gawk though it works fine on windows Therefore I expanded the max sizes specified in the board.txt file in the awk file
1 parent 6e2e474 commit 9945af5

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

io.sloeber.core/src/io/sloeber/core/toolchain/ArduinoGnuMakefileGenerator.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -906,17 +906,17 @@ public MultiStatus regenerateMakefiles() throws CoreException {
906906
IFile sizeAwkFile1 = root.getFile(topBuildDir.append("size.awk"));
907907
File sizeAwkFile = sizeAwkFile1.getLocation().toFile();
908908
String regex = Common.getBuildEnvironmentVariable(confDesc, "recipe.size.regex", EMPTY);
909-
String awkContent = "BEGIN {maximum_size=ENVIRON[\"upload.maximum_size\"]\n"
910-
+ " maximum_data_size=ENVIRON[\"upload.maximum_data_size\"]}";
911-
awkContent += "/" + regex + "/ {arduino_size += $2 }\n";
909+
String awkContent = "/" + regex + "/ {arduino_size += $2 }\n";
912910
regex = Common.getBuildEnvironmentVariable(confDesc, "recipe.size.regex.data", EMPTY);
913911
awkContent += "/" + regex + "/ {arduino_data += $2 }\n";
914912
regex = Common.getBuildEnvironmentVariable(confDesc, "recipe.size.regex.eeprom", EMPTY);
915913
awkContent += "/" + regex + "/ {arduino_eeprom += $2 }\n";
916914
awkContent += "END { print \"\\n";
917-
awkContent += Messages.sizeReportSketch;
915+
String max = Common.getBuildEnvironmentVariable(confDesc, "upload.maximum_size", "10000");
916+
awkContent += Messages.sizeReportSketch.replace("maximum_size", max);
918917
awkContent += "\\n";
919-
awkContent += Messages.sizeReportData;
918+
max = Common.getBuildEnvironmentVariable(confDesc, "upload.maximum_data_size", "10000");
919+
awkContent += Messages.sizeReportData.replace("maximum_data_size", max);
920920
awkContent += "\\n";
921921
awkContent += "\"}";
922922

io.sloeber.core/src/io/sloeber/core/txt/WorkAround.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class WorkAround extends Const {
4343
// Each time this class is touched consider changing the String below to enforce
4444
// updates
4545
// for debugging I added the system time so the files get refresed at each run
46-
private static final String FIRST_SLOEBER_WORKAROUND_LINE = "#Sloeber created workaound file V1.03.test 03 ";
46+
private static final String FIRST_SLOEBER_WORKAROUND_LINE = "#Sloeber created workaound file V1.04.test 02 ";
4747
// + String.valueOf(System.currentTimeMillis());
4848

4949
/**
@@ -366,6 +366,10 @@ private static String platformApplyStandardWorkArounds(String inPlatformTxt) {
366366
while (regex_macher.find()) {
367367
String origLine = platformTXT.substring(regex_macher.start(), regex_macher.end());
368368
String workedAroundLine = origLine.replace("(?:", "(");
369+
String badSuffix="\\s+([0-9]+).*";
370+
if(workedAroundLine.endsWith(badSuffix)) {
371+
workedAroundLine=workedAroundLine.substring(0, workedAroundLine.length()-badSuffix.length());
372+
}
369373
if (!origLine.equals(workedAroundLine)) {
370374
replaceInfo.put(origLine, workedAroundLine);
371375
}

0 commit comments

Comments
 (0)