|
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.05.test 05 "; |
| 48 | + private static final String FIRST_SLOEBER_WORKAROUND_LINE = "#Sloeber created TXT file V2.00.test 04 "; |
49 | 49 |
|
50 | 50 | /**
|
51 | 51 | * workarounds done at installation time. I try to keep those at a minimum but
|
@@ -318,51 +318,57 @@ private static String platformApplyStandardWorkArounds(String inPlatformTxt) {
|
318 | 318 | String platformTXT = inPlatformTxt;
|
319 | 319 | String searchPlatformTXT = "\n" + inPlatformTxt;
|
320 | 320 |
|
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); |
| 321 | + String origRecipe = findLineStartingWith(platformTXT, RECIPE_C_to_O); |
| 322 | + if (null != origRecipe) { |
| 323 | + String changed = origRecipe.replace("\"{source_file}\"", "{INPUTS}"); |
| 324 | + changed = changed.replace("\"{object_file}\"", "{OUTPUT}"); |
| 325 | + changed = changed.replace("{includes}", "{FLAGS} -D__IN_ECLIPSE__=1"); |
| 326 | + changed = changed + " {sloeber.extra.compile} {sloeber.extra.c.compile} {sloeber.extra.all}"; |
| 327 | + platformTXT = platformTXT.replace(origRecipe, changed); |
328 | 328 | }
|
329 | 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); |
| 330 | + origRecipe = findLineStartingWith(platformTXT, RECIPE_CPP_to_O); |
| 331 | + if (null != origRecipe) { |
| 332 | + String changed = origRecipe.replace("\"{source_file}\"", "{INPUTS}"); |
| 333 | + changed = changed.replace("\"{object_file}\"", "{OUTPUT}"); |
| 334 | + changed = changed.replace("{includes}", "{FLAGS} -D__IN_ECLIPSE__=1"); |
| 335 | + changed = changed + " {sloeber.extra.compile} {sloeber.extra.cpp.compile} {sloeber.extra.all}"; |
| 336 | + platformTXT = platformTXT.replace(origRecipe, changed); |
337 | 337 | }
|
338 | 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); |
| 339 | + origRecipe = findLineStartingWith(platformTXT, RECIPE_S_to_O); |
| 340 | + if (null != origRecipe) { |
| 341 | + String changed = origRecipe.replace("\"{source_file}\"", "{INPUTS}"); |
| 342 | + changed = changed.replace("\"{object_file}\"", "{OUTPUT}"); |
| 343 | + changed = changed.replace("{includes}", "{FLAGS} -D__IN_ECLIPSE__=1"); |
| 344 | + changed = changed + " {sloeber.extra.assembly} {sloeber.extra.all}"; |
| 345 | + platformTXT = platformTXT.replace(origRecipe, changed); |
346 | 346 | }
|
347 | 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); |
| 348 | + origRecipe = findLineStartingWith(platformTXT, RECIPE_AR); |
| 349 | + if (null != origRecipe) { |
| 350 | + //archives should get a different key but for now I didn't get that to work |
| 351 | + String changed = origRecipe.replace("\"{archive_file_path}\"", "{OUTPUT}"); |
| 352 | + changed = changed.replace("{archive_file_path}", "{OUTPUT}"); |
| 353 | + changed = changed.replace("\"{object_file}\"", "{INPUTS}"); |
| 354 | + changed = changed.replace("{object_file}", "{INPUTS}"); |
| 355 | + changed = changed + " {sloeber.extra_archive} {sloeber.extra_all}"; |
| 356 | + platformTXT = platformTXT.replace(origRecipe, changed); |
354 | 357 | }
|
355 | 358 |
|
356 |
| - String inCombineRecipe = findLineStartingWith(platformTXT, RECIPE_C_COMBINE); |
357 |
| - if (null != inArRecipe) { |
| 359 | + origRecipe = findLineStartingWith(platformTXT, RECIPE_C_COMBINE); |
| 360 | + if (null != origRecipe) { |
358 | 361 | // the fix below seems no longer needed but is still on august 2021
|
359 | 362 | // Arduino treats core differently so we need to change the location of directly
|
360 | 363 | // referenced files this manifests only in the combine recipe
|
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}", " "); |
365 |
| - platformTXT = platformTXT.replace(inCombineRecipe, outCombineRecipe); |
| 364 | + String changed = origRecipe.replaceAll("(\\{build\\.path})(/core)?/sys", "$1/core/core/sys"); |
| 365 | + |
| 366 | + changed = changed.replace(" \"{build.path}/{archive_file}\"", " {ARCHIVES}"); |
| 367 | + changed = changed.replace(" {object_files}", " ${FLAGS} {INPUTS}"); |
| 368 | + String[] splits = changed.split("=", 2); |
| 369 | + changed = splits[0] + "={sloeber.pre.link}" + splits[1] |
| 370 | + + " {sloeber.extra_all} {sloeber.extra.link}{sloeber.post.link}"; |
| 371 | + platformTXT = platformTXT.replace(origRecipe, changed); |
366 | 372 | }
|
367 | 373 |
|
368 | 374 | // replace tools.x.y* {path}
|
|
0 commit comments