mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-08 11:56:36 +00:00
clear the output before upload/verify
use the same channel for stdout and and stderr Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
parent
deea43008d
commit
cc76f2bbc8
@ -28,6 +28,7 @@
|
|||||||
"@theia/navigator": "next",
|
"@theia/navigator": "next",
|
||||||
"@theia/outline-view": "next",
|
"@theia/outline-view": "next",
|
||||||
"@theia/preferences": "next",
|
"@theia/preferences": "next",
|
||||||
|
"@theia/output": "next",
|
||||||
"@theia/search-in-workspace": "next",
|
"@theia/search-in-workspace": "next",
|
||||||
"@theia/terminal": "next",
|
"@theia/terminal": "next",
|
||||||
"@theia/workspace": "next",
|
"@theia/workspace": "next",
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { inject, injectable } from 'inversify';
|
import { inject, injectable } from 'inversify';
|
||||||
|
import { OutputChannelManager } from '@theia/output/lib/common/output-channel';
|
||||||
import { CoreService } from '../../common/protocol';
|
import { CoreService } from '../../common/protocol';
|
||||||
import { MonitorConnection } from '../monitor/monitor-connection';
|
|
||||||
import { BoardsDataStore } from '../boards/boards-data-store';
|
|
||||||
import { BoardsServiceClientImpl } from '../boards/boards-service-client-impl';
|
|
||||||
import { ArduinoMenus } from '../menu/arduino-menus';
|
import { ArduinoMenus } from '../menu/arduino-menus';
|
||||||
import { ArduinoToolbar } from '../toolbar/arduino-toolbar';
|
import { ArduinoToolbar } from '../toolbar/arduino-toolbar';
|
||||||
|
import { BoardsDataStore } from '../boards/boards-data-store';
|
||||||
|
import { MonitorConnection } from '../monitor/monitor-connection';
|
||||||
|
import { BoardsServiceClientImpl } from '../boards/boards-service-client-impl';
|
||||||
import { SketchContribution, Command, CommandRegistry, MenuModelRegistry, KeybindingRegistry, TabBarToolbarRegistry } from './contribution';
|
import { SketchContribution, Command, CommandRegistry, MenuModelRegistry, KeybindingRegistry, TabBarToolbarRegistry } from './contribution';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
@ -22,6 +23,9 @@ export class UploadSketch extends SketchContribution {
|
|||||||
@inject(BoardsServiceClientImpl)
|
@inject(BoardsServiceClientImpl)
|
||||||
protected readonly boardsServiceClientImpl: BoardsServiceClientImpl;
|
protected readonly boardsServiceClientImpl: BoardsServiceClientImpl;
|
||||||
|
|
||||||
|
@inject(OutputChannelManager)
|
||||||
|
protected readonly outputChannelManager: OutputChannelManager;
|
||||||
|
|
||||||
registerCommands(registry: CommandRegistry): void {
|
registerCommands(registry: CommandRegistry): void {
|
||||||
registry.registerCommand(UploadSketch.Commands.UPLOAD_SKETCH, {
|
registry.registerCommand(UploadSketch.Commands.UPLOAD_SKETCH, {
|
||||||
execute: () => this.uploadSketch()
|
execute: () => this.uploadSketch()
|
||||||
@ -78,6 +82,7 @@ export class UploadSketch extends SketchContribution {
|
|||||||
throw new Error(`No core is installed for the '${boardsConfig.selectedBoard.name}' board. Please install the core.`);
|
throw new Error(`No core is installed for the '${boardsConfig.selectedBoard.name}' board. Please install the core.`);
|
||||||
}
|
}
|
||||||
const fqbn = await this.boardsDataStore.appendConfigToFqbn(boardsConfig.selectedBoard.fqbn);
|
const fqbn = await this.boardsDataStore.appendConfigToFqbn(boardsConfig.selectedBoard.fqbn);
|
||||||
|
this.outputChannelManager.getChannel('Arduino: upload').clear();
|
||||||
await this.coreService.upload({
|
await this.coreService.upload({
|
||||||
sketchUri: uri,
|
sketchUri: uri,
|
||||||
fqbn,
|
fqbn,
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { inject, injectable } from 'inversify';
|
import { inject, injectable } from 'inversify';
|
||||||
|
import { OutputChannelManager } from '@theia/output/lib/common/output-channel';
|
||||||
|
import { CoreService } from '../../common/protocol';
|
||||||
import { ArduinoMenus } from '../menu/arduino-menus';
|
import { ArduinoMenus } from '../menu/arduino-menus';
|
||||||
import { ArduinoToolbar } from '../toolbar/arduino-toolbar';
|
import { ArduinoToolbar } from '../toolbar/arduino-toolbar';
|
||||||
import { BoardsDataStore } from '../boards/boards-data-store';
|
import { BoardsDataStore } from '../boards/boards-data-store';
|
||||||
import { BoardsServiceClientImpl } from '../boards/boards-service-client-impl';
|
import { BoardsServiceClientImpl } from '../boards/boards-service-client-impl';
|
||||||
import { SketchContribution, Command, CommandRegistry, MenuModelRegistry, KeybindingRegistry, TabBarToolbarRegistry } from './contribution';
|
import { SketchContribution, Command, CommandRegistry, MenuModelRegistry, KeybindingRegistry, TabBarToolbarRegistry } from './contribution';
|
||||||
import { CoreService } from '../../common/protocol';
|
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class VerifySketch extends SketchContribution {
|
export class VerifySketch extends SketchContribution {
|
||||||
@ -18,6 +19,9 @@ export class VerifySketch extends SketchContribution {
|
|||||||
@inject(BoardsServiceClientImpl)
|
@inject(BoardsServiceClientImpl)
|
||||||
protected readonly boardsServiceClientImpl: BoardsServiceClientImpl;
|
protected readonly boardsServiceClientImpl: BoardsServiceClientImpl;
|
||||||
|
|
||||||
|
@inject(OutputChannelManager)
|
||||||
|
protected readonly outputChannelManager: OutputChannelManager;
|
||||||
|
|
||||||
registerCommands(registry: CommandRegistry): void {
|
registerCommands(registry: CommandRegistry): void {
|
||||||
registry.registerCommand(VerifySketch.Commands.VERIFY_SKETCH, {
|
registry.registerCommand(VerifySketch.Commands.VERIFY_SKETCH, {
|
||||||
execute: () => this.verifySketch()
|
execute: () => this.verifySketch()
|
||||||
@ -66,6 +70,7 @@ export class VerifySketch extends SketchContribution {
|
|||||||
throw new Error(`No core is installed for the '${boardsConfig.selectedBoard.name}' board. Please install the core.`);
|
throw new Error(`No core is installed for the '${boardsConfig.selectedBoard.name}' board. Please install the core.`);
|
||||||
}
|
}
|
||||||
const fqbn = await this.boardsDataStore.appendConfigToFqbn(boardsConfig.selectedBoard.fqbn);
|
const fqbn = await this.boardsDataStore.appendConfigToFqbn(boardsConfig.selectedBoard.fqbn);
|
||||||
|
this.outputChannelManager.getChannel('Arduino: compile').clear();
|
||||||
await this.coreService.compile({
|
await this.coreService.compile({
|
||||||
sketchUri: uri,
|
sketchUri: uri,
|
||||||
fqbn,
|
fqbn,
|
||||||
|
@ -35,7 +35,7 @@ export class CoreServiceImpl implements CoreService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async compile(options: CoreService.Compile.Options): Promise<void> {
|
async compile(options: CoreService.Compile.Options): Promise<void> {
|
||||||
console.log('compile', options);
|
this.toolOutputService.publishNewOutput('compile', 'Compiling...\n' + JSON.stringify(options, null, 2) + '\n');
|
||||||
const { sketchUri, fqbn } = options;
|
const { sketchUri, fqbn } = options;
|
||||||
const sketchFilePath = await this.fileSystem.getFsPath(sketchUri);
|
const sketchFilePath = await this.fileSystem.getFsPath(sketchUri);
|
||||||
if (!sketchFilePath) {
|
if (!sketchFilePath) {
|
||||||
@ -67,21 +67,21 @@ export class CoreServiceImpl implements CoreService {
|
|||||||
await new Promise<void>((resolve, reject) => {
|
await new Promise<void>((resolve, reject) => {
|
||||||
result.on('data', (cr: CompileResp) => {
|
result.on('data', (cr: CompileResp) => {
|
||||||
this.toolOutputService.publishNewOutput("compile", Buffer.from(cr.getOutStream_asU8()).toString());
|
this.toolOutputService.publishNewOutput("compile", Buffer.from(cr.getOutStream_asU8()).toString());
|
||||||
this.toolOutputService.publishNewOutput("compile error", Buffer.from(cr.getErrStream_asU8()).toString());
|
this.toolOutputService.publishNewOutput("compile", Buffer.from(cr.getErrStream_asU8()).toString());
|
||||||
});
|
});
|
||||||
result.on('error', error => reject(error));
|
result.on('error', error => reject(error));
|
||||||
result.on('end', () => resolve());
|
result.on('end', () => resolve());
|
||||||
});
|
});
|
||||||
this.toolOutputService.publishNewOutput("compile", "Compilation complete\n");
|
this.toolOutputService.publishNewOutput("compile", "Compilation complete.\n");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.toolOutputService.publishNewOutput("compile error", `Compilation error: ${e}\n`);
|
this.toolOutputService.publishNewOutput("compile", `Compilation error: ${e}\n`);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async upload(options: CoreService.Upload.Options): Promise<void> {
|
async upload(options: CoreService.Upload.Options): Promise<void> {
|
||||||
await this.compile(options);
|
await this.compile(options);
|
||||||
console.log('upload', options);
|
this.toolOutputService.publishNewOutput('upload', 'Uploading...\n' + JSON.stringify(options, null, 2) + '\n');
|
||||||
const { sketchUri, fqbn } = options;
|
const { sketchUri, fqbn } = options;
|
||||||
const sketchFilePath = await this.fileSystem.getFsPath(sketchUri);
|
const sketchFilePath = await this.fileSystem.getFsPath(sketchUri);
|
||||||
if (!sketchFilePath) {
|
if (!sketchFilePath) {
|
||||||
@ -111,14 +111,14 @@ export class CoreServiceImpl implements CoreService {
|
|||||||
await new Promise<void>((resolve, reject) => {
|
await new Promise<void>((resolve, reject) => {
|
||||||
result.on('data', (cr: UploadResp) => {
|
result.on('data', (cr: UploadResp) => {
|
||||||
this.toolOutputService.publishNewOutput("upload", Buffer.from(cr.getOutStream_asU8()).toString());
|
this.toolOutputService.publishNewOutput("upload", Buffer.from(cr.getOutStream_asU8()).toString());
|
||||||
this.toolOutputService.publishNewOutput("upload error", Buffer.from(cr.getErrStream_asU8()).toString());
|
this.toolOutputService.publishNewOutput("upload", Buffer.from(cr.getErrStream_asU8()).toString());
|
||||||
});
|
});
|
||||||
result.on('error', error => reject(error));
|
result.on('error', error => reject(error));
|
||||||
result.on('end', () => resolve());
|
result.on('end', () => resolve());
|
||||||
});
|
});
|
||||||
this.toolOutputService.publishNewOutput("upload", "Upload complete\n");
|
this.toolOutputService.publishNewOutput("upload", "Upload complete.\n");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.toolOutputService.publishNewOutput("upload error", `Upload error: ${e}\n`);
|
this.toolOutputService.publishNewOutput("upload", `Upload error: ${e}\n`);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user