Skip to content

Commit

Permalink
Move arg buildup earlier in functions
Browse files Browse the repository at this point in the history
  • Loading branch information
hlovdal authored and adiazulay committed Jan 19, 2021
1 parent 88bed5e commit e03dc38
Showing 1 changed file with 20 additions and 23 deletions.
43 changes: 20 additions & 23 deletions src/arduino/arduino.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,6 @@ export class ArduinoApp {
return;
}

arduinoChannel.show();
arduinoChannel.start(`Upload sketch - ${dc.sketch}`);

await vscode.workspace.saveAll(false);

if (!await this.runPreBuildCommand(dc)) {
return;
}

if (!compile && !this.useArduinoCli()) {
arduinoChannel.error("This command is only availble when using the Arduino CLI");
return;
Expand Down Expand Up @@ -176,14 +167,20 @@ export class ArduinoApp {
args.push("--port", dc.port);
}

if (!await this.runPreBuildCommand(dc)) {
return;
}

const verbose = VscodeSettings.getInstance().logLevel === "verbose";
if (verbose) {
args.push("--verbose");
}

await vscode.workspace.saveAll(false);

arduinoChannel.show();
arduinoChannel.start(`Upload sketch - ${dc.sketch}`);

if (!await this.runPreBuildCommand(dc)) {
return;
}

if (dc.output && compile) {
const outputPath = path.resolve(ArduinoWorkspace.rootPath, dc.output);
const dirPath = path.dirname(outputPath);
Expand Down Expand Up @@ -258,14 +255,6 @@ export class ArduinoApp {
await this.getMainSketch(dc);
}

await vscode.workspace.saveAll(false);

arduinoChannel.start(`Verify sketch - ${dc.sketch}`);

if (!await this.runPreBuildCommand(dc)) {
return false;
}

if (!this.useArduinoCli()) {
args.push("--verify");
} else {
Expand All @@ -276,6 +265,16 @@ export class ArduinoApp {
if (verbose) {
args.push("--verbose");
}

await vscode.workspace.saveAll(false);

arduinoChannel.show();
arduinoChannel.start(`Verify sketch - ${dc.sketch}`);

if (!await this.runPreBuildCommand(dc)) {
return false;
}

if (output || dc.output) {
const outputPath = path.resolve(ArduinoWorkspace.rootPath, output || dc.output);
const dirPath = path.dirname(outputPath);
Expand All @@ -297,8 +296,6 @@ export class ArduinoApp {
arduinoChannel.warning(msg);
}

arduinoChannel.show();

let success = false;
const compilerParserContext = makeCompilerParserContext(dc);

Expand Down

0 comments on commit e03dc38

Please sign in to comment.