|
45 | 45 | public class WorkAround extends Const {
|
46 | 46 | // Each time this class is touched consider changing the String below to enforce
|
47 | 47 | // updates
|
48 |
| - private static final String FIRST_SLOEBER_WORKAROUND_LINE = "#Sloeber created workaound file V1.04.test 04 "; |
| 48 | + private static final String FIRST_SLOEBER_WORKAROUND_LINE = "#Sloeber created workaound file V1.05.test 05 "; |
49 | 49 |
|
50 | 50 | /**
|
51 | 51 | * workarounds done at installation time. I try to keep those at a minimum but
|
@@ -318,12 +318,50 @@ private static String platformApplyStandardWorkArounds(String inPlatformTxt) {
|
318 | 318 | String platformTXT = inPlatformTxt;
|
319 | 319 | String searchPlatformTXT = "\n" + inPlatformTxt;
|
320 | 320 |
|
321 |
| - // the fix below seems no longer needed but is still on august 2021 |
322 |
| - // Arduino treats core differently so we need to change the location of directly |
323 |
| - // referenced files this manifests only in the combine recipe |
324 |
| - String inCombineRecipe = findLineStartingWith(platformTXT, "recipe.c.combine.pattern"); |
325 |
| - if (null != inCombineRecipe) { |
| 321 | + //C o need the input and output file stuff removed as CDT wants thes at the command level |
| 322 | + String inCORecipe = findLineStartingWith(platformTXT, RECIPE_C_to_O); |
| 323 | + if (null != inCORecipe) { |
| 324 | + String outCORecipe = inCORecipe.replace(" -o ", " "); |
| 325 | + outCORecipe = outCORecipe.replace(" \"{source_file}\"", " "); |
| 326 | + outCORecipe = outCORecipe.replace(" \"{object_file}\"", " "); |
| 327 | + platformTXT = platformTXT.replace(inCORecipe, outCORecipe); |
| 328 | + } |
| 329 | + |
| 330 | + //Cpp o need the input and output file stuff removed as CDT wants thes at the command level |
| 331 | + String inCppORecipe = findLineStartingWith(platformTXT, RECIPE_CPP_to_O); |
| 332 | + if (null != inCppORecipe) { |
| 333 | + String outCppORecipe = inCppORecipe.replace(" -o ", " "); |
| 334 | + outCppORecipe = outCppORecipe.replace(" \"{source_file}\"", " "); |
| 335 | + outCppORecipe = outCppORecipe.replace(" \"{object_file}\"", " "); |
| 336 | + platformTXT = platformTXT.replace(inCppORecipe, outCppORecipe); |
| 337 | + } |
| 338 | + |
| 339 | + //S o need the input and output file stuff removed as CDT wants thes at the command level |
| 340 | + String inSORecipe = findLineStartingWith(platformTXT, RECIPE_S_to_O); |
| 341 | + if (null != inSORecipe) { |
| 342 | + String outSORecipe = inSORecipe.replace(" -o ", " "); |
| 343 | + outSORecipe = outSORecipe.replace(" \"{source_file}\"", " "); |
| 344 | + outSORecipe = outSORecipe.replace(" \"{object_file}\"", " "); |
| 345 | + platformTXT = platformTXT.replace(inSORecipe, outSORecipe); |
| 346 | + } |
| 347 | + |
| 348 | + //Archiver needs the "{archive_file_path}" "{object_file}" file stuff removed as CDT wants thes at the command level |
| 349 | + String inArRecipe = findLineStartingWith(platformTXT, RECIPE_AR); |
| 350 | + if (null != inArRecipe) { |
| 351 | + String outArRecipe = inArRecipe.replace(" {archive_file_path} ", " "); |
| 352 | + outArRecipe = outArRecipe.replace(" {object_file}", " "); |
| 353 | + platformTXT = platformTXT.replace(inArRecipe, outArRecipe); |
| 354 | + } |
| 355 | + |
| 356 | + String inCombineRecipe = findLineStartingWith(platformTXT, RECIPE_C_COMBINE); |
| 357 | + if (null != inArRecipe) { |
| 358 | + // the fix below seems no longer needed but is still on august 2021 |
| 359 | + // Arduino treats core differently so we need to change the location of directly |
| 360 | + // referenced files this manifests only in the combine recipe |
326 | 361 | String outCombineRecipe = inCombineRecipe.replaceAll("(\\{build\\.path})(/core)?/sys", "$1/core/core/sys");
|
| 362 | + |
| 363 | + outCombineRecipe = outCombineRecipe.replace(" \"{build.path}/{archive_file}\"", " "); |
| 364 | + outCombineRecipe = outCombineRecipe.replace(" {object_files}", " "); |
327 | 365 | platformTXT = platformTXT.replace(inCombineRecipe, outCombineRecipe);
|
328 | 366 | }
|
329 | 367 |
|
@@ -411,7 +449,7 @@ private static String platformApplyStandardWorkArounds(String inPlatformTxt) {
|
411 | 449 | private static String findLineStartingWith(String text, String startOfLine) {
|
412 | 450 | int lineStartIndex = text.indexOf("\n" + startOfLine) + 1;
|
413 | 451 | if (lineStartIndex > 0) {
|
414 |
| - int lineEndIndex = text.indexOf("\n", lineStartIndex) - 1; |
| 452 | + int lineEndIndex = text.indexOf("\n", lineStartIndex); |
415 | 453 | if (lineEndIndex > 0) {
|
416 | 454 | return text.substring(lineStartIndex, lineEndIndex);
|
417 | 455 | }
|
|
0 commit comments