Skip to content

Commit 475e9d4

Browse files
author
jantje
committed
#1498 stuff mostly seems to work but discovery no longer works
1 parent 863f5d3 commit 475e9d4

File tree

3 files changed

+39
-29
lines changed

3 files changed

+39
-29
lines changed

io.sloeber.core/plugin.xml

+1-7
Original file line numberDiff line numberDiff line change
@@ -355,13 +355,7 @@
355355
id="io.sloeber.tool.combiner.ar.input"
356356
multipleOfType="true"
357357
name="Build Archives"
358-
primaryInput="false"
359-
sources="ar">
360-
</inputType>
361-
<inputType
362-
id="io.sloeber.tool.combiner.fixed.ar.input"
363-
multipleOfType="true"
364-
name="provided archives"
358+
option="ARCHIVES"
365359
primaryInput="false"
366360
sources="ar">
367361
</inputType>

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

+11
Original file line numberDiff line numberDiff line change
@@ -1648,6 +1648,17 @@ protected boolean addRuleForTool(ITool tool, StringBuffer buffer, boolean bTarge
16481648
// resolve any remaining macros in the command after it has been
16491649
// generated
16501650
try {
1651+
//TOFIX JABA heavy hack to get the combiner to work properly
1652+
//if the command contains ${ARCHIVES}
1653+
//remove the ${AR}
1654+
//replace ${ARCHIVES} with ${AR}
1655+
String ARCHIVES = " ${ARCHIVES} ";
1656+
String AR = " $(AR) ";
1657+
if (buildCmd.contains(ARCHIVES)) {
1658+
buildCmd = buildCmd.replace(AR, " ");
1659+
buildCmd = buildCmd.replace(ARCHIVES, AR);
1660+
}
1661+
//end JABA heavy hack
16511662
String resolvedCommand = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(
16521663
buildCmd, EMPTY_STRING, WHITESPACE, IBuildMacroProvider.CONTEXT_FILE,
16531664
new FileContextData(null, null, null, tool));

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

+27-22
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
public class WorkAround extends Const {
4646
// Each time this class is touched consider changing the String below to enforce
4747
// updates
48-
private static final String FIRST_SLOEBER_WORKAROUND_LINE = "#Sloeber created TXT file V2.00.test 04 ";
48+
private static final String FIRST_SLOEBER_WORKAROUND_LINE = "#Sloeber created TXT file V2.00.test 07 ";
4949

5050
/**
5151
* workarounds done at installation time. I try to keep those at a minimum but
@@ -320,39 +320,43 @@ private static String platformApplyStandardWorkArounds(String inPlatformTxt) {
320320

321321
String origRecipe = findLineStartingWith(platformTXT, RECIPE_C_to_O);
322322
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}";
323+
String changed = origRecipe + " ";
324+
changed = changed.replace(" \"{source_file}\" ", " {INPUTS} ");
325+
changed = changed.replace(" \"{object_file}\" ", " {OUTPUT} ");
326+
changed = changed.replace(" {includes} ", " {FLAGS} -D__IN_ECLIPSE__=1 ");
327+
changed = changed + "{sloeber.extra.compile} {sloeber.extra.c.compile} {sloeber.extra.all}";
327328
platformTXT = platformTXT.replace(origRecipe, changed);
328329
}
329330

330331
origRecipe = findLineStartingWith(platformTXT, RECIPE_CPP_to_O);
331332
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}";
333+
String changed = origRecipe + " ";
334+
changed = changed.replace(" \"{source_file}\" ", " {INPUTS} ");
335+
changed = changed.replace(" \"{object_file}\" ", " {OUTPUT} ");
336+
changed = changed.replace(" {includes} ", " {FLAGS} -D__IN_ECLIPSE__=1 ");
337+
changed = changed + "{sloeber.extra.compile} {sloeber.extra.cpp.compile} {sloeber.extra.all}";
336338
platformTXT = platformTXT.replace(origRecipe, changed);
337339
}
338340

339341
origRecipe = findLineStartingWith(platformTXT, RECIPE_S_to_O);
340342
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}";
343+
String changed = origRecipe + " ";
344+
changed = changed.replace(" \"{source_file}\" ", " {INPUTS} ");
345+
changed = changed.replace(" \"{object_file}\" ", " {OUTPUT} ");
346+
changed = changed.replace(" {includes} ", " {FLAGS} -D__IN_ECLIPSE__=1 ");
347+
changed = changed + "{sloeber.extra.assembly} {sloeber.extra.all}";
345348
platformTXT = platformTXT.replace(origRecipe, changed);
346349
}
347350

348351
origRecipe = findLineStartingWith(platformTXT, RECIPE_AR);
349352
if (null != origRecipe) {
350353
//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}";
354+
String changed = origRecipe + " ";
355+
changed = changed.replace(" \"{archive_file_path}\" ", " {OUTPUT} ");
356+
changed = changed.replace(" {archive_file_path} ", " {OUTPUT} ");
357+
changed = changed.replace(" \"{object_file}\" ", " {INPUTS} ");
358+
changed = changed.replace(" {object_file} ", " {INPUTS} ");
359+
changed = changed + "{sloeber.extra_archive} {sloeber.extra_all}";
356360
platformTXT = platformTXT.replace(origRecipe, changed);
357361
}
358362

@@ -361,13 +365,14 @@ private static String platformApplyStandardWorkArounds(String inPlatformTxt) {
361365
// the fix below seems no longer needed but is still on august 2021
362366
// Arduino treats core differently so we need to change the location of directly
363367
// referenced files this manifests only in the combine recipe
364-
String changed = origRecipe.replaceAll("(\\{build\\.path})(/core)?/sys", "$1/core/core/sys");
368+
String changed = origRecipe.replaceAll("(\\{build\\.path})(/core)?/sys", "$1/core/core/sys") + " ";
365369

366-
changed = changed.replace(" \"{build.path}/{archive_file}\"", " {ARCHIVES}");
367-
changed = changed.replace(" {object_files}", " ${FLAGS} {INPUTS}");
370+
changed = changed.replace(" \"{build.path}/{archive_file}\" ", " {ARCHIVES} ");
371+
changed = changed.replace(" \"{archive_file_path}\" ", " {ARCHIVES} ");
372+
changed = changed.replace(" {object_files} ", " {FLAGS} {INPUTS} ");
368373
String[] splits = changed.split("=", 2);
369374
changed = splits[0] + "={sloeber.pre.link}" + splits[1]
370-
+ " {sloeber.extra_all} {sloeber.extra.link}{sloeber.post.link}";
375+
+ "{sloeber.extra_all} {sloeber.extra.link}{sloeber.post.link}";
371376
platformTXT = platformTXT.replace(origRecipe, changed);
372377
}
373378

0 commit comments

Comments
 (0)