@@ -439,7 +439,8 @@ Please make sure the folder is not occupied by other procedures .`);
439
439
const dc = DeviceContext . getInstance ( ) ;
440
440
const args : string [ ] = [ ] ;
441
441
let restoreSerialMonitor : boolean = false ;
442
- let cocopa : ICoCoPaContext ;
442
+ const cocopa = makeCompilerParserContext ( dc ) ;
443
+ const verbose = VscodeSettings . getInstance ( ) . logLevel === constants . LogLevel . Verbose ;
443
444
444
445
if ( ! this . boardManager . currentBoard ) {
445
446
if ( mode !== BuildMode . Analyze ) {
@@ -499,18 +500,12 @@ Please make sure the folder is not occupied by other procedures .`);
499
500
"--port" , dc . port ,
500
501
"--useprogrammer" ,
501
502
"--pref" , "programmer=" + programmer ) ;
502
-
503
- } else if ( mode === BuildMode . Analyze ) {
504
- cocopa = makeCompilerParserContext ( dc ) ;
505
- args . push ( "--verify" , "--verbose" ) ;
506
503
} else {
507
504
args . push ( "--verify" ) ;
508
505
}
509
506
510
- const verbose = VscodeSettings . getInstance ( ) . logLevel === "verbose" ;
511
- if ( mode !== BuildMode . Analyze && verbose ) {
512
- args . push ( "--verbose" ) ;
513
- }
507
+ // We always build verbosely but filter the output based on the settings
508
+ args . push ( "--verbose" ) ;
514
509
515
510
await vscode . workspace . saveAll ( false ) ;
516
511
@@ -530,7 +525,6 @@ Please make sure the folder is not occupied by other procedures .`);
530
525
logger . notifyUserError ( "InvalidOutPutPath" , new Error ( constants . messages . INVALID_OUTPUT_PATH + outputPath ) ) ;
531
526
return false ;
532
527
}
533
-
534
528
args . push ( "--pref" , `build.path=${ outputPath } ` ) ;
535
529
arduinoChannel . info ( `Please see the build logs in output path: ${ outputPath } ` ) ;
536
530
} else {
@@ -549,33 +543,31 @@ Please make sure the folder is not occupied by other procedures .`);
549
543
args . push ( path . join ( ArduinoWorkspace . rootPath , dc . sketch ) ) ;
550
544
551
545
const cleanup = async ( ) => {
552
- if ( cocopa ) {
553
- await cocopa . conclude ( ) ;
554
- }
546
+ await cocopa . conclude ( ) ;
555
547
if ( mode === BuildMode . Upload || mode === BuildMode . UploadProgrammer ) {
556
548
UsbDetector . getInstance ( ) . resumeListening ( ) ;
557
549
if ( restoreSerialMonitor ) {
558
550
await SerialMonitor . getInstance ( ) . openSerialMonitor ( ) ;
559
551
}
560
552
}
561
553
}
554
+ const stdoutcb = ( line : string ) => {
555
+ cocopa . callback ( line ) ;
556
+ if ( verbose ) {
557
+ arduinoChannel . channel . append ( line ) ;
558
+ }
559
+ }
560
+ const stderrcb = ( line : string ) => {
561
+ arduinoChannel . channel . append ( line ) ;
562
+ }
562
563
563
564
return await util . spawn (
564
565
this . _settings . commandPath ,
565
566
args ,
566
567
undefined ,
567
- {
568
- channel : ! cocopa || cocopa && verbose ? arduinoChannel . channel : undefined ,
569
- stdout : cocopa ? cocopa . callback : undefined ,
570
- } ,
568
+ { stdout : stdoutcb , stderr : stderrcb } ,
571
569
) . then ( async ( ) => {
572
570
await cleanup ( ) ;
573
- if ( mode !== BuildMode . Analyze ) {
574
- const cmd = os . platform ( ) === "darwin"
575
- ? "Cmd + Alt + I"
576
- : "Ctrl + Alt + I" ;
577
- arduinoChannel . info ( `To rebuild your IntelliSense configuration run "${ cmd } "` ) ;
578
- }
579
571
arduinoChannel . end ( `${ mode } sketch '${ dc . sketch } ${ os . EOL } ` ) ;
580
572
return true ;
581
573
} , async ( reason ) => {
0 commit comments