Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit 2e763c8

Browse files
committed
add support for cli
1 parent b5360b5 commit 2e763c8

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/arduino/arduino.ts

+13-4
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,10 @@ export class ArduinoApp {
515515
}
516516
const boardDescriptor = this.boardManager.currentBoard.getBuildConfig();
517517

518+
if (buildMode === BuildMode.Analyze) {
519+
args.push("compile");
520+
}
521+
518522
if (this.useArduinoCli()) {
519523
args.push("-b", boardDescriptor);
520524
} else {
@@ -636,7 +640,9 @@ export class ArduinoApp {
636640
}
637641

638642
// We always build verbosely but filter the output based on the settings
639-
args.push("--verbose-build");
643+
644+
this._settings.useArduinoCli ? args.push("--verbose") : args.push("--verbose-build");
645+
640646
if (verbose) {
641647
args.push("--verbose-upload");
642648
}
@@ -689,13 +695,16 @@ export class ArduinoApp {
689695
// TODO EW: What should we do with pre-/post build commands when running
690696
// analysis? Some could use it to generate/manipulate code which could
691697
// be a prerequisite for a successful build
692-
if (!await this.runPrePostBuildCommand(dc, env, "pre")) {
698+
if (dc.prebuild && !await this.runPrePostBuildCommand(dc, env, "pre")) {
693699
return false;
694700
}
695701

696702
// stop serial monitor when everything is prepared and good
697703
// what makes restoring of its previous state easier
698-
if (buildMode === BuildMode.Upload || buildMode === BuildMode.UploadProgrammer) {
704+
if (buildMode === BuildMode.Upload ||
705+
buildMode === BuildMode.UploadProgrammer ||
706+
buildMode === BuildMode.CliUpload ||
707+
buildMode === BuildMode.CliUploadProgrammer) {
699708
restoreSerialMonitor = await SerialMonitor.getInstance().closeSerialMonitor(dc.port);
700709
UsbDetector.getInstance().pauseListening();
701710
}
@@ -758,7 +767,7 @@ export class ArduinoApp {
758767
this._settings.commandPath,
759768
args,
760769
undefined,
761-
{ stdout: stdoutcb, stderr: stderrcb },
770+
{ channel: arduinoChannel.channel, stdout: stdoutcb, stderr: stderrcb },
762771
).then(async () => {
763772
const ret = await cleanup("ok");
764773
if (ret) {

0 commit comments

Comments
 (0)