Skip to content

Commit c2c3f3d

Browse files
author
jantje
committed
#661 workaround the regex awk incompatibility
1 parent cbd07c3 commit c2c3f3d

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

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

+16-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 01 ";
46+
private static final String FIRST_SLOEBER_WORKAROUND_LINE = "#Sloeber created workaound file V1.03.test 03 ";
4747
// + String.valueOf(System.currentTimeMillis());
4848

4949
/**
@@ -359,6 +359,21 @@ private static String platformApplyStandardWorkArounds(String inPlatformTxt) {
359359
platformTXT = platformTXT.replace(replaceSet.getKey(), replaceSet.getValue());
360360
}
361361

362+
// make the size regex expressions compatible with awk
363+
Pattern regex_pattern = Pattern.compile("(?m)^recipe\\.size\\.regex.*=.*$");
364+
Matcher regex_macher = regex_pattern.matcher(platformTXT);
365+
replaceInfo.clear();
366+
while (regex_macher.find()) {
367+
String origLine = platformTXT.substring(regex_macher.start(), regex_macher.end());
368+
String workedAroundLine = origLine.replace("(?:", "(");
369+
if (!origLine.equals(workedAroundLine)) {
370+
replaceInfo.put(origLine, workedAroundLine);
371+
}
372+
}
373+
for (Entry<String, String> replaceSet : replaceInfo.entrySet()) {
374+
platformTXT = platformTXT.replace(replaceSet.getKey(), replaceSet.getValue());
375+
}
376+
362377
// replace FI '-DUSB_PRODUCT={build.usb_product}' with
363378
// "-DUSB_PRODUCT=\"{build.usb_product}\""
364379
platformTXT = platformTXT.replaceAll("\\'-D(\\S+)=\\{(\\S+)}\\'", "\"-D$1=\\\\\"{$2}\\\\\"\"");

0 commit comments

Comments
 (0)