Skip to content

Commit f5520fc

Browse files
author
Federico Fissore
committed
Compiler: removed duplicated functions compileEep and compileHex in favour of generic runRecipe
1 parent 980709f commit f5520fc

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

arduino-core/src/processing/app/debug/Compiler.java

+4-20
Original file line numberDiff line numberDiff line change
@@ -401,11 +401,11 @@ public boolean compile(boolean _verbose) throws RunnerException, PreferencesMapE
401401

402402
// 5. extract EEPROM data (from EEMEM directive) to .eep file.
403403
progressListener.progress(70);
404-
compileEep();
404+
runRecipe("recipe.objcopy.eep.pattern");
405405

406406
// 6. build the .hex file
407407
progressListener.progress(80);
408-
compileHex();
408+
runRecipe("recipe.objcopy.hex.pattern");
409409

410410
progressListener.progress(90);
411411
return true;
@@ -1069,28 +1069,12 @@ void compileLink()
10691069
execAsynchronously(cmdArray);
10701070
}
10711071

1072-
// 5. extract EEPROM data (from EEMEM directive) to .eep file.
1073-
void compileEep() throws RunnerException, PreferencesMapException {
1072+
void runRecipe(String recipe) throws RunnerException, PreferencesMapException {
10741073
PreferencesMap dict = new PreferencesMap(prefs);
10751074
dict.put("ide_version", "" + BaseNoGui.REVISION);
10761075

10771076
String[] cmdArray;
1078-
String cmd = prefs.getOrExcept("recipe.objcopy.eep.pattern");
1079-
try {
1080-
cmdArray = StringReplacer.formatAndSplit(cmd, dict, true);
1081-
} catch (Exception e) {
1082-
throw new RunnerException(e);
1083-
}
1084-
execAsynchronously(cmdArray);
1085-
}
1086-
1087-
// 6. build the .hex file
1088-
void compileHex() throws RunnerException, PreferencesMapException {
1089-
PreferencesMap dict = new PreferencesMap(prefs);
1090-
dict.put("ide_version", "" + BaseNoGui.REVISION);
1091-
1092-
String[] cmdArray;
1093-
String cmd = prefs.getOrExcept("recipe.objcopy.hex.pattern");
1077+
String cmd = prefs.getOrExcept(recipe);
10941078
try {
10951079
cmdArray = StringReplacer.formatAndSplit(cmd, dict, true);
10961080
} catch (Exception e) {

0 commit comments

Comments
 (0)