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

Commit 5eaa9fe

Browse files
elektronikworkshophlovdal
authored andcommitted
* Building always verbosely but upload only verbosely when requested
* Filtering of spurious messages now with regex list and for all platforms
1 parent 7328cb6 commit 5eaa9fe

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

src/arduino/arduino.ts

+28-5
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ Please make sure the folder is not occupied by other procedures .`);
433433
* manages the build state.
434434
* @param mode See build()
435435
* @param buildDir See build()
436+
* @see https://github.com/arduino/Arduino/blob/master/build/shared/manpage.adoc
436437
*/
437438
private async _build(mode: BuildMode, buildDir?: string): Promise<boolean> {
438439
const dc = DeviceContext.getInstance();
@@ -504,7 +505,10 @@ Please make sure the folder is not occupied by other procedures .`);
504505
}
505506

506507
// We always build verbosely but filter the output based on the settings
507-
args.push("--verbose");
508+
args.push("--verbose-build");
509+
if (verbose) {
510+
args.push("--verbose-upload");
511+
}
508512

509513
await vscode.workspace.saveAll(false);
510514

@@ -559,12 +563,31 @@ Please make sure the folder is not occupied by other procedures .`);
559563
const stderrcb = (line: string) => {
560564
if (os.platform() === "win32") {
561565
line = line.trim();
562-
if (line.length && !line.startsWith("DEBUG ") && !line.startsWith("TRACE ") && !line.startsWith("INFO ")) {
563-
arduinoChannel.channel.append(`${line}${os.EOL}`);
566+
if (line.length <= 0) {
567+
return;
568+
}
569+
line = `${line}${os.EOL}`;
570+
}
571+
if (!verbose) {
572+
// Don't spill log with spurious info from the backend
573+
// This list could be fetched from a config file to
574+
// accommodate messages of unknown board packages, newer
575+
// backend revisions etc.
576+
const filters = [
577+
/^Picked\sup\sJAVA_TOOL_OPTIONS:\s+/,
578+
/^\d+\d+-\d+-\d+T\d+:\d+:\d+.\d+Z\sINFO\s/,
579+
/^\d+\d+-\d+-\d+T\d+:\d+:\d+.\d+Z\sWARN\s/,
580+
/^DEBUG\s+/,
581+
/^TRACE\s+/,
582+
/^INFO\s+/,
583+
];
584+
for (const f of filters) {
585+
if (line.match(f)) {
586+
return;
587+
}
564588
}
565-
} else {
566-
arduinoChannel.channel.append(line);
567589
}
590+
arduinoChannel.channel.append(line);
568591
}
569592

570593
return await util.spawn(

0 commit comments

Comments
 (0)