@@ -107,7 +107,7 @@ enum BuilderAction {
107
107
private final String pathToSketch ;
108
108
private final SketchData sketch ;
109
109
private final String buildPath ;
110
- private boolean verbose ;
110
+ private final boolean verbose ;
111
111
private RunnerException exception ;
112
112
113
113
public Compiler (SketchData data , String buildPath ) {
@@ -172,8 +172,7 @@ private void callArduinoBuilder(TargetBoard board, TargetPlatform platform, Targ
172
172
File executable = BaseNoGui .getContentFile ("arduino-builder" );
173
173
CommandLine commandLine = new CommandLine (executable );
174
174
commandLine .addArgument (action .value , false );
175
- commandLine .addArgument ("-logger" , false );
176
- commandLine .addArgument ("machine" , false );
175
+ commandLine .addArgument ("-logger=machine" , false );
177
176
178
177
Stream .of (BaseNoGui .getHardwarePath (), new File (BaseNoGui .getSettingsFolder (), "packages" ).getAbsolutePath (), BaseNoGui .getSketchbookHardwareFolder ().getAbsolutePath ())
179
178
.forEach (p -> {
@@ -197,30 +196,22 @@ private void callArduinoBuilder(TargetBoard board, TargetPlatform platform, Targ
197
196
commandLine .addArgument ("\" " + BaseNoGui .getContentFile ("libraries" ).getAbsolutePath () + "\" " , false );
198
197
199
198
String fqbn = Stream .of (aPackage .getId (), platform .getId (), board .getId (), boardOptions (board )).filter (s -> !s .isEmpty ()).collect (Collectors .joining (":" ));
200
- commandLine .addArgument ("-fqbn" , false );
201
- commandLine .addArgument (fqbn , false );
199
+ commandLine .addArgument ("-fqbn=" + fqbn , false );
202
200
203
- commandLine .addArgument ("-ide-version" , false );
204
- commandLine .addArgument (Integer .toString (BaseNoGui .REVISION ), false );
201
+ commandLine .addArgument ("-ide-version=" + BaseNoGui .REVISION , false );
205
202
commandLine .addArgument ("-build-path" , false );
206
203
commandLine .addArgument ("\" " + buildPath + "\" " , false );
207
- commandLine .addArgument ("-warnings" , false );
208
- commandLine .addArgument (PreferencesData .get ("compiler.warning_level" ), false );
204
+ commandLine .addArgument ("-warnings=" + PreferencesData .get ("compiler.warning_level" ), false );
209
205
210
206
PreferencesData .getMap ()
211
207
.subTree ("build_properties_custom" )
212
208
.entrySet ()
213
209
.stream ()
214
- .forEach (kv -> {
215
- commandLine .addArgument ("-prefs" , false );
216
- commandLine .addArgument ("\" " + kv .getKey () + "=" + kv .getValue () + "\" " , false );
217
- });
210
+ .forEach (kv -> commandLine .addArgument ("-prefs=\" " + kv .getKey () + "=" + kv .getValue () + "\" " , false ));
218
211
219
- commandLine .addArgument ("-prefs" , false );
220
- commandLine .addArgument ("build.warn_data_percentage=" + PreferencesData .get ("build.warn_data_percentage" ), false );
212
+ commandLine .addArgument ("-prefs=build.warn_data_percentage=" + PreferencesData .get ("build.warn_data_percentage" ));
221
213
222
- //commandLine.addArgument("-debug-level", false);
223
- //commandLine.addArgument("10", false);
214
+ //commandLine.addArgument("-debug-level=10", false);
224
215
225
216
if (verbose ) {
226
217
commandLine .addArgument ("-verbose" , false );
@@ -260,7 +251,7 @@ private void callArduinoBuilder(TargetBoard board, TargetPlatform platform, Targ
260
251
}
261
252
}
262
253
263
- protected void size (PreferencesMap prefs ) throws RunnerException {
254
+ private void size (PreferencesMap prefs ) throws RunnerException {
264
255
String maxTextSizeString = prefs .get ("upload.maximum_size" );
265
256
String maxDataSizeString = prefs .get ("upload.maximum_data_size" );
266
257
@@ -310,7 +301,7 @@ protected void size(PreferencesMap prefs) throws RunnerException {
310
301
}
311
302
}
312
303
313
- void saveHex (PreferencesMap prefs ) throws RunnerException {
304
+ private void saveHex (PreferencesMap prefs ) throws RunnerException {
314
305
List <String > compiledSketches = new ArrayList <>(prefs .subTree ("recipe.output.tmp_file" , 1 ).values ());
315
306
List <String > copyOfCompiledSketches = new ArrayList <>(prefs .subTree ("recipe.output.save_file" , 1 ).values ());
316
307
@@ -365,19 +356,15 @@ private boolean isExportCompiledSketchSupported(List<String> compiledSketches, L
365
356
return (compiledSketches .isEmpty () || copyOfCompiledSketches .isEmpty () || copyOfCompiledSketches .size () < compiledSketches .size ()) && (!prefs .containsKey ("recipe.output.tmp_file" ) || !prefs .containsKey ("recipe.output.save_file" ));
366
357
}
367
358
368
- void runActions (String recipeClass , PreferencesMap prefs ) throws RunnerException , PreferencesMapException {
369
- List <String > patterns = new ArrayList <>();
370
- for (String key : prefs .keySet ()) {
371
- if (key .startsWith ("recipe." + recipeClass ) && key .endsWith (".pattern" ))
372
- patterns .add (key );
373
- }
359
+ private void runActions (String recipeClass , PreferencesMap prefs ) throws RunnerException , PreferencesMapException {
360
+ List <String > patterns = prefs .keySet ().stream ().filter (key -> key .startsWith ("recipe." + recipeClass ) && key .endsWith (".pattern" )).collect (Collectors .toList ());
374
361
Collections .sort (patterns );
375
362
for (String recipe : patterns ) {
376
363
runRecipe (recipe , prefs );
377
364
}
378
365
}
379
366
380
- void runRecipe (String recipe , PreferencesMap prefs ) throws RunnerException , PreferencesMapException {
367
+ private void runRecipe (String recipe , PreferencesMap prefs ) throws RunnerException , PreferencesMapException {
381
368
PreferencesMap dict = new PreferencesMap (prefs );
382
369
dict .put ("ide_version" , "" + BaseNoGui .REVISION );
383
370
dict .put ("sketch_path" , sketch .getFolder ().getAbsolutePath ());
@@ -394,7 +381,7 @@ void runRecipe(String recipe, PreferencesMap prefs) throws RunnerException, Pref
394
381
395
382
private void exec (String [] command ) throws RunnerException {
396
383
// eliminate any empty array entries
397
- List <String > stringList = new ArrayList <String >();
384
+ List <String > stringList = new ArrayList <>();
398
385
for (String string : command ) {
399
386
string = string .trim ();
400
387
if (string .length () != 0 )
@@ -582,9 +569,9 @@ public void message(String s) {
582
569
System .err .println (s );
583
570
}
584
571
585
- public RunnerException placeException (String message ,
586
- String dotJavaFilename ,
587
- int dotJavaLine ) {
572
+ private RunnerException placeException (String message ,
573
+ String dotJavaFilename ,
574
+ int dotJavaLine ) {
588
575
// Placing errors is simple, because we inserted #line directives
589
576
// into the preprocessed source. The compiler gives us correct
590
577
// the file name and line number. :-)
0 commit comments