Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/check-i18n-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Install dependencies (Linux only)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libx11-dev libxkbfile-dev

- name: Install dependencies
run: yarn install --immutable
env:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/check-javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ jobs:
cache: yarn
node-version: ${{ env.NODE_VERSION }}

- name: Install dependencies (Linux only)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libx11-dev libxkbfile-dev

- name: Install npm package dependencies
env:
# Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/check-yarn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ jobs:
cache: yarn
node-version: ${{ env.NODE_VERSION }}

- name: Install dependencies (Linux only)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libx11-dev libxkbfile-dev

- name: Install npm package dependencies
env:
# Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/i18n-nightly-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Install dependencies (Linux only)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libx11-dev libxkbfile-dev

- name: Install dependencies
run: yarn install --immutable

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/i18n-weekly-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Install dependencies (Linux only)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libx11-dev libxkbfile-dev

- name: Install dependencies
run: yarn install --immutable

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/test-javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Install dependencies (Linux only)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libx11-dev libxkbfile-dev

- name: Install npm package dependencies
env:
# Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/themes-weekly-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Install dependencies (Linux only)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libx11-dev libxkbfile-dev

- name: Install dependencies
run: yarn install --immutable

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ import { OpenSketch } from './contributions/open-sketch';
import { Close } from './contributions/close';
import { SaveAsSketch } from './contributions/save-as-sketch';
import { SaveSketch } from './contributions/save-sketch';
import { VerifySketch } from './contributions/verify-sketch';
import {
CompileSummaryProvider,
VerifySketch,
} from './contributions/verify-sketch';
import { UploadSketch } from './contributions/upload-sketch';
import { CommonFrontendContribution } from './theia/core/common-frontend-contribution';
import { EditContributions } from './contributions/edit-contributions';
Expand Down Expand Up @@ -788,6 +791,8 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
Contribution.configure(bind, BoardsDataMenuUpdater);
Contribution.configure(bind, AutoSelectProgrammer);

bind(CompileSummaryProvider).toService(VerifySketch);

bindContributionProvider(bind, StartupTaskProvider);
bind(StartupTaskProvider).toService(BoardsServiceProvider); // to reuse the boards config in another window

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { DisposableCollection } from '@theia/core/lib/common/disposable';
import URI from '@theia/core/lib/common/uri';
import { inject, injectable } from '@theia/core/shared/inversify';
import { HostedPluginSupport } from '../hosted/hosted-plugin-support';
import type { ArduinoState } from 'vscode-arduino-api';
import {
BoardsConfig,
BoardsService,
CompileSummary,
isCompileSummary,
BoardsConfig,
PortIdentifier,
resolveDetectedPort,
} from '../../common/protocol';
Expand All @@ -18,8 +16,10 @@ import {
} from '../../common/protocol/arduino-context-mapper';
import { BoardsDataStore } from '../boards/boards-data-store';
import { BoardsServiceProvider } from '../boards/boards-service-provider';
import { HostedPluginSupport } from '../hosted/hosted-plugin-support';
import { CurrentSketch } from '../sketches-service-client-impl';
import { SketchContribution } from './contribution';
import { CompileSummaryProvider } from './verify-sketch';

/**
* (non-API) exported for tests
Expand All @@ -43,6 +43,8 @@ export class UpdateArduinoState extends SketchContribution {
private readonly boardsDataStore: BoardsDataStore;
@inject(HostedPluginSupport)
private readonly hostedPluginSupport: HostedPluginSupport;
@inject(CompileSummaryProvider)
private readonly compileSummaryProvider: CompileSummaryProvider;

private readonly toDispose = new DisposableCollection();

Expand All @@ -60,14 +62,9 @@ export class UpdateArduinoState extends SketchContribution {
this.configService.onDidChangeSketchDirUri((userDirUri) =>
this.updateUserDirPath(userDirUri)
),
this.commandService.onDidExecuteCommand(({ commandId, args }) => {
if (
commandId === 'arduino.languageserver.notifyBuildDidComplete' &&
isCompileSummary(args[0])
) {
this.updateCompileSummary(args[0]);
}
}),
this.compileSummaryProvider.onDidChangeCompileSummary(() =>
this.maybeUpdateCompileSummary()
),
this.boardsDataStore.onDidChange((event) => {
const selectedFqbn =
this.boardsServiceProvider.boardsConfig.selectedBoard?.fqbn;
Expand All @@ -88,12 +85,20 @@ export class UpdateArduinoState extends SketchContribution {
this.updateSketchPath(this.sketchServiceClient.tryGetCurrentSketch());
this.updateUserDirPath(this.configService.tryGetSketchDirUri());
this.updateDataDirPath(this.configService.tryGetDataDirUri());
this.maybeUpdateCompileSummary();
}

onStop(): void {
this.toDispose.dispose();
}

private maybeUpdateCompileSummary() {
const { compileSummary } = this.compileSummaryProvider;
if (compileSummary) {
this.updateCompileSummary(compileSummary);
}
}

private async updateSketchPath(
sketch: CurrentSketch | undefined
): Promise<void> {
Expand Down
56 changes: 52 additions & 4 deletions arduino-ide-extension/src/browser/contributions/verify-sketch.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Emitter } from '@theia/core/lib/common/event';
import { Emitter, Event } from '@theia/core/lib/common/event';
import { nls } from '@theia/core/lib/common/nls';
import { inject, injectable } from '@theia/core/shared/inversify';
import type { CoreService } from '../../common/protocol';
import type { CompileSummary, CoreService } from '../../common/protocol';
import { ArduinoMenus } from '../menu/arduino-menus';
import { CurrentSketch } from '../sketches-service-client-impl';
import { ArduinoToolbar } from '../toolbar/arduino-toolbar';
Expand All @@ -15,6 +15,12 @@ import {
} from './contribution';
import { CoreErrorHandler } from './core-error-handler';

export const CompileSummaryProvider = Symbol('CompileSummaryProvider');
export interface CompileSummaryProvider {
readonly compileSummary: CompileSummary | undefined;
readonly onDidChangeCompileSummary: Event<void>;
}

export type VerifySketchMode =
/**
* When the user explicitly triggers the verify command from the primary UI: menu, toolbar, or keybinding. The UI shows the output, updates the toolbar items state, etc.
Expand Down Expand Up @@ -46,13 +52,18 @@ export interface VerifySketchParams {
type VerifyProgress = 'idle' | VerifySketchMode;

@injectable()
export class VerifySketch extends CoreServiceContribution {
export class VerifySketch
extends CoreServiceContribution
implements CompileSummaryProvider
{
@inject(CoreErrorHandler)
private readonly coreErrorHandler: CoreErrorHandler;

private readonly onDidChangeEmitter = new Emitter<void>();
private readonly onDidChange = this.onDidChangeEmitter.event;
private readonly onDidChangeCompileSummaryEmitter = new Emitter<void>();
private verifyProgress: VerifyProgress = 'idle';
private _compileSummary: CompileSummary | undefined;

override registerCommands(registry: CommandRegistry): void {
registry.registerCommand(VerifySketch.Commands.VERIFY_SKETCH, {
Expand Down Expand Up @@ -117,6 +128,14 @@ export class VerifySketch extends CoreServiceContribution {
super.handleError(error);
}

get compileSummary(): CompileSummary | undefined {
return this._compileSummary;
}

get onDidChangeCompileSummary(): Event<void> {
return this.onDidChangeCompileSummaryEmitter.event;
}

private async verifySketch(
params?: VerifySketchParams
): Promise<CoreService.Options.Compile | undefined> {
Expand All @@ -141,7 +160,7 @@ export class VerifySketch extends CoreServiceContribution {
return options;
}

await this.doWithProgress({
const compileSummary = await this.doWithProgress({
progressText: nls.localize(
'arduino/sketch/compile',
'Compiling sketch...'
Expand All @@ -160,6 +179,13 @@ export class VerifySketch extends CoreServiceContribution {
nls.localize('arduino/sketch/doneCompiling', 'Done compiling.'),
{ timeout: 3000 }
);

this._compileSummary = compileSummary;
this.onDidChangeCompileSummaryEmitter.fire();
if (this._compileSummary) {
this.fireBuildDidComplete(this._compileSummary);
}

// Returns with the used options for the compilation
// so that follow-up tasks (such as upload) can reuse the compiled code.
// Note that the `fqbn` is already decorated with the board settings, if any.
Expand Down Expand Up @@ -201,6 +227,28 @@ export class VerifySketch extends CoreServiceContribution {
compilerWarnings,
};
}

// Execute the a command contributed by the Arduino Tools VSIX to send the `ino/buildDidComplete` notification to the language server
private fireBuildDidComplete(compileSummary: CompileSummary): void {
const params = {
...compileSummary,
};
console.info(
`Executing 'arduino.languageserver.notifyBuildDidComplete' with ${JSON.stringify(
params.buildOutputUri
)}`
);
this.commandService
.executeCommand('arduino.languageserver.notifyBuildDidComplete', params)
.catch((err) =>
console.error(
`Unexpected error when firing event on build did complete. ${JSON.stringify(
params.buildOutputUri
)}`,
err
)
);
}
}

export namespace VerifySketch {
Expand Down
2 changes: 1 addition & 1 deletion arduino-ide-extension/src/common/protocol/core-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export interface CoreService {
compile(
options: CoreService.Options.Compile,
cancellationToken?: CancellationToken
): Promise<void>;
): Promise<CompileSummary | undefined>;
upload(
options: CoreService.Options.Upload,
cancellationToken?: CancellationToken
Expand Down
Loading
Loading