Compare commits

..

2 Commits

Author SHA1 Message Date
Christian Sarnataro
0b41378dca Added timeout to yarn install 2025-03-12 17:26:20 +07:00
Giacomo Cusinato
8ec96fc891 Test light version 2025-01-30 13:50:07 +07:00
46 changed files with 337 additions and 618 deletions

View File

@@ -14,7 +14,6 @@ module.exports = {
'.browser_modules/*',
'docs/*',
'scripts/*',
'browser-app/*',
'electron-app/lib/*',
'electron-app/src-gen/*',
'electron-app/gen-webpack*.js',

View File

@@ -203,7 +203,7 @@ jobs:
echo "is-nightly=$is_nightly" >> $GITHUB_OUTPUT
echo "channel-name=$channel_name" >> $GITHUB_OUTPUT
# Only attempt upload to Amazon S3 if the credentials are available.
echo "publish-to-s3=${{ secrets.AWS_ROLE_ARN != '' }}" >> $GITHUB_OUTPUT
echo "publish-to-s3=${{ secrets.AWS_SECRET_ACCESS_KEY != '' }}" >> $GITHUB_OUTPUT
select-targets:
needs: build-type-determination
@@ -284,6 +284,8 @@ jobs:
- build-type-determination
- select-targets
env:
# https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
# Location of artifacts generated by build.
BUILD_ARTIFACTS_PATH: electron-app/dist/build-artifacts
# to skip passing signing credentials to electron-builder
@@ -361,6 +363,8 @@ jobs:
AC_USERNAME: ${{ secrets.AC_USERNAME }}
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
AC_TEAM_ID: ${{ secrets.AC_TEAM_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
IS_NIGHTLY: ${{ needs.build-type-determination.outputs.is-nightly }}
IS_RELEASE: ${{ needs.build-type-determination.outputs.is-release }}
CAN_SIGN: ${{ secrets[matrix.config.certificate-secret] != '' }}
@@ -584,12 +588,6 @@ jobs:
env:
ARTIFACTS_FOLDER: build-artifacts
environment: production
permissions:
id-token: write
contents: read
steps:
- name: Download all job transfer artifacts
uses: actions/download-artifact@v4
@@ -598,15 +596,15 @@ jobs:
path: ${{ env.ARTIFACTS_FOLDER }}
pattern: ${{ env.JOB_TRANSFER_ARTIFACT_PREFIX }}*
- name: Configure AWS Credentials for Nightly [S3]
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
- name: Publish Nightly [S3]
run: |
aws s3 sync ${{ env.ARTIFACTS_FOLDER }} s3://${{ secrets.DOWNLOADS_BUCKET }}/arduino-ide/nightly
uses: docker://plugins/s3
env:
PLUGIN_SOURCE: '${{ env.ARTIFACTS_FOLDER }}/*'
PLUGIN_STRIP_PREFIX: '${{ env.ARTIFACTS_FOLDER }}/'
PLUGIN_TARGET: '/arduino-ide/nightly'
PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
release:
needs:
@@ -627,12 +625,6 @@ jobs:
env:
ARTIFACTS_FOLDER: build-artifacts
environment: production
permissions:
id-token: write
contents: read
steps:
- name: Download all job transfer artifacts
uses: actions/download-artifact@v4
@@ -656,17 +648,16 @@ jobs:
file_glob: true
body: ${{ needs.changelog.outputs.BODY }}
- name: Configure AWS Credentials for Release [S3]
if: needs.build-type-determination.outputs.publish-to-s3 == 'true'
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
- name: Publish Release [S3]
if: needs.build-type-determination.outputs.publish-to-s3 == 'true'
run: |
aws s3 sync ${{ env.ARTIFACTS_FOLDER }} s3://${{ secrets.DOWNLOADS_BUCKET }}/arduino-ide
uses: docker://plugins/s3
env:
PLUGIN_SOURCE: '${{ env.ARTIFACTS_FOLDER }}/*'
PLUGIN_STRIP_PREFIX: '${{ env.ARTIFACTS_FOLDER }}/'
PLUGIN_TARGET: '/arduino-ide'
PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
clean:
# This job must run after all jobs that use the transfer artifact.

View File

@@ -76,12 +76,6 @@ 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 libsecret-1-dev
- name: Install dependencies
run: yarn install --immutable
env:

View File

@@ -73,12 +73,6 @@ 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 libsecret-1-dev
- name: Install npm package dependencies
env:
# Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting:

View File

@@ -72,12 +72,6 @@ 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 libsecret-1-dev
- name: Install npm package dependencies
env:
# Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting:

View File

@@ -14,11 +14,6 @@ jobs:
create-changelog:
if: github.repository == 'arduino/arduino-ide'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
environment: production
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -49,12 +44,12 @@ jobs:
# Compose changelog
yarn run compose-changelog "${{ github.workspace }}/${{ env.CHANGELOG_ARTIFACTS }}/$CHANGELOG_FILE_NAME"
- name: Configure AWS Credentials for Changelog [S3]
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
- name: Publish Changelog [S3]
run: |
aws s3 sync ${{ env.CHANGELOG_ARTIFACTS }} s3://${{ secrets.DOWNLOADS_BUCKET }}/arduino-ide/changelog
uses: docker://plugins/s3
env:
PLUGIN_SOURCE: '${{ env.CHANGELOG_ARTIFACTS }}/*'
PLUGIN_STRIP_PREFIX: '${{ env.CHANGELOG_ARTIFACTS }}/'
PLUGIN_TARGET: '/arduino-ide/changelog'
PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

View File

@@ -34,12 +34,6 @@ 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 libsecret-1-dev
- name: Install dependencies
run: yarn install --immutable

View File

@@ -34,12 +34,6 @@ 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 libsecret-1-dev
- name: Install dependencies
run: yarn install --immutable

View File

@@ -107,12 +107,6 @@ 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 libsecret-1-dev
- name: Install npm package dependencies
env:
# Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting:

View File

@@ -36,12 +36,6 @@ 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 libsecret-1-dev
- name: Install dependencies
run: yarn install --immutable

1
.nvmrc
View File

@@ -1 +0,0 @@
18

31
.vscode/launch.json vendored
View File

@@ -80,37 +80,6 @@
"port": 9222,
"webRoot": "${workspaceFolder}/electron-app"
},
{
"type": "node",
"request": "launch",
"name": "App (Browser)",
"program": "${workspaceRoot}/browser-app/src-gen/backend/main.js",
"args": [
"--hostname=0.0.0.0",
"--port=3000",
"--no-cluster",
"--no-app-auto-install",
"--plugins=local-dir:plugins"
],
"windows": {
"env": {
"NODE_ENV": "development",
"NODE_PRESERVE_SYMLINKS": "1"
}
},
"env": {
"NODE_ENV": "development"
},
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/browser-app/src-gen/backend/*.js",
"${workspaceRoot}/browser-app/lib/**/*.js",
"${workspaceRoot}/arduino-ide-extension/lib/**/*.js"
],
"smartStep": true,
"internalConsoleOptions": "openOnSessionStart",
"outputCapture": "std"
},
{
"type": "node",
"request": "launch",

30
.vscode/tasks.json vendored
View File

@@ -15,17 +15,6 @@
"clear": false
}
},
{
"label": "Arduino IDE - Start Browser App",
"type": "shell",
"command": "yarn --cwd ./browser-app start",
"group": "build",
"presentation": {
"reveal": "always",
"panel": "new",
"clear": true
}
},
{
"label": "Watch Extension",
"type": "shell",
@@ -37,17 +26,6 @@
"clear": false
}
},
{
"label": "Arduino IDE - Watch Browser App",
"type": "shell",
"command": "yarn --cwd ./browser-app watch",
"group": "build",
"presentation": {
"reveal": "always",
"panel": "new",
"clear": false
}
},
{
"label": "Watch App",
"type": "shell",
@@ -59,14 +37,6 @@
"clear": false
}
},
{
"label": "Arduino IDE - Watch All [Browser]",
"type": "shell",
"dependsOn": [
"Arduino IDE - Watch IDE Extension",
"Arduino IDE - Watch Browser App"
]
},
{
"label": "Watch All",
"type": "shell",

View File

@@ -158,8 +158,16 @@
"frontend": "lib/browser/arduino-ide-frontend-module"
},
{
"frontend": "lib/browser/theia/core/browser-menu-module",
"frontendElectron": "lib/electron-browser/theia/core/electron-menu-module"
},
{
"frontendElectron": "lib/electron-browser/theia/core/electron-window-module"
},
{
"frontendElectron": "lib/electron-browser/electron-arduino-module"
},
{
"electronMain": "lib/electron-main/arduino-electron-main-module"
}
],
"arduino": {

View File

@@ -1,7 +1,7 @@
// @ts-check
// The version to use.
const version = '1.10.2';
const version = '1.10.1';
(async () => {
const os = require('node:os');

View File

@@ -2,6 +2,7 @@ import { ColorContribution } from '@theia/core/lib/browser/color-application-con
import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
import { CommonMenus } from '@theia/core/lib/browser/common-frontend-contribution';
import { FrontendApplicationContribution } from '@theia/core/lib/browser/frontend-application';
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
import {
TabBarToolbarContribution,
TabBarToolbarRegistry,
@@ -23,6 +24,7 @@ import {
import { MessageService } from '@theia/core/lib/common/message-service';
import { nls } from '@theia/core/lib/common/nls';
import { isHighContrast } from '@theia/core/lib/common/theme';
import { ElectronWindowPreferences } from '@theia/core/lib/electron-browser/window/electron-window-preferences';
import {
inject,
injectable,
@@ -40,6 +42,7 @@ import { ArduinoMenus } from './menu/arduino-menus';
import { MonitorViewContribution } from './serial/monitor/monitor-view-contribution';
import { SerialPlotterContribution } from './serial/plotter/plotter-frontend-contribution';
import { ArduinoToolbar } from './toolbar/arduino-toolbar';
import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider';
@injectable()
export class ArduinoFrontendContribution
@@ -60,11 +63,11 @@ export class ArduinoFrontendContribution
@inject(CommandRegistry)
private readonly commandRegistry: CommandRegistry;
// @inject(ElectronWindowPreferences)
// private readonly electronWindowPreferences: ElectronWindowPreferences;
@inject(ElectronWindowPreferences)
private readonly electronWindowPreferences: ElectronWindowPreferences;
// @inject(FrontendApplicationStateService)
// private readonly appStateService: FrontendApplicationStateService;
@inject(FrontendApplicationStateService)
private readonly appStateService: FrontendApplicationStateService;
@postConstruct()
protected init(): void {
@@ -80,27 +83,33 @@ export class ArduinoFrontendContribution
}
onStart(): void {
// this.electronWindowPreferences.onPreferenceChanged((event) => {
// if (event.newValue !== event.oldValue) {
// switch (event.preferenceName) {
// case 'window.zoomLevel':
// if (typeof event.newValue === 'number') {
// window.electronTheiaCore.setZoomLevel(event.newValue || 0);
// }
// break;
// }
// }
// });
// this.appStateService.reachedState('ready').then(() =>
// this.electronWindowPreferences.ready.then(() => {
// const zoomLevel =
// this.electronWindowPreferences.get('window.zoomLevel');
// window.electronTheiaCore.setZoomLevel(zoomLevel);
// })
// );
this.electronWindowPreferences.onPreferenceChanged((event) => {
if (event.newValue !== event.oldValue) {
switch (event.preferenceName) {
case 'window.zoomLevel':
if (typeof event.newValue === 'number') {
window.electronTheiaCore.setZoomLevel(event.newValue || 0);
}
break;
}
}
});
this.appStateService.reachedState('ready').then(() =>
this.electronWindowPreferences.ready.then(() => {
const zoomLevel =
this.electronWindowPreferences.get('window.zoomLevel');
window.electronTheiaCore.setZoomLevel(zoomLevel);
})
);
}
registerToolbarItems(registry: TabBarToolbarRegistry): void {
const config = FrontendApplicationConfigProvider.get();
debugger;
if (config.isLightVersion) {
return;
}
registry.registerItem({
id: BoardsToolBarItem.TOOLBAR_ID,
render: () => (

View File

@@ -85,7 +85,6 @@ import { TabBarDecoratorService as TheiaTabBarDecoratorService } from '@theia/co
import { TabBarDecoratorService } from './theia/core/tab-bar-decorator';
import { ProblemManager as TheiaProblemManager } from '@theia/markers/lib/browser';
import { ProblemManager } from './theia/markers/problem-manager';
import { BoardsAutoInstaller } from './boards/boards-auto-installer';
import { ShellLayoutRestorer } from './theia/core/shell-layout-restorer';
import {
ArduinoComponentContextMenuRenderer,
@@ -131,10 +130,7 @@ 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 {
CompileSummaryProvider,
VerifySketch,
} from './contributions/verify-sketch';
import { 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';
@@ -225,9 +221,6 @@ import { NotificationsRenderer as TheiaNotificationsRenderer } from '@theia/mess
import { NotificationsRenderer } from './theia/messages/notifications-renderer';
import { SketchbookWidgetContribution } from './widgets/sketchbook/sketchbook-widget-contribution';
import { LocalCacheFsProvider } from './local-cache/local-cache-fs-provider';
import { CloudSketchbookWidget } from './widgets/cloud-sketchbook/cloud-sketchbook-widget';
import { CloudSketchbookTreeWidget } from './widgets/cloud-sketchbook/cloud-sketchbook-tree-widget';
import { createCloudSketchbookTreeWidget } from './widgets/cloud-sketchbook/cloud-sketchbook-tree-container';
import { CreateApi } from './create/create-api';
import { ShareSketchDialog } from './dialogs/cloud-share-sketch-dialog';
import { AuthenticationClientService } from './auth/authentication-client-service';
@@ -265,12 +258,17 @@ import {
} from './dialogs/user-fields/user-fields-dialog';
import { nls } from '@theia/core/lib/common';
import { IDEUpdaterCommands } from './ide-updater/ide-updater-commands';
import { IDEUpdater, IDEUpdaterClient } from '../common/protocol/ide-updater';
import {
IDEUpdater,
IDEUpdaterClient,
IDEUpdaterPath,
} from '../common/protocol/ide-updater';
import { IDEUpdaterClientImpl } from './ide-updater/ide-updater-client-impl';
import {
IDEUpdaterDialog,
IDEUpdaterDialogProps,
} from './dialogs/ide-updater/ide-updater-dialog';
import { ElectronIpcConnectionProvider } from '@theia/core/lib/electron-browser/messaging/electron-ipc-connection-provider';
import { MonitorModel } from './monitor-model';
import { MonitorManagerProxyClientImpl } from './monitor-manager-proxy-client-impl';
import { EditorManager as TheiaEditorManager } from '@theia/editor/lib/browser/editor-manager';
@@ -290,7 +288,10 @@ import { PreferenceTreeGenerator } from './theia/preferences/preference-tree-gen
import { PreferenceTreeGenerator as TheiaPreferenceTreeGenerator } from '@theia/preferences/lib/browser/util/preference-tree-generator';
import { AboutDialog } from './theia/core/about-dialog';
import { AboutDialog as TheiaAboutDialog } from '@theia/core/lib/browser/about-dialog';
import { SurveyNotificationService } from '../common/protocol/survey-service';
import {
SurveyNotificationService,
SurveyNotificationServicePath,
} from '../common/protocol/survey-service';
import { WindowContribution } from './theia/core/window-contribution';
import { WindowContribution as TheiaWindowContribution } from '@theia/core/lib/browser/window-contribution';
import { CoreErrorHandler } from './contributions/core-error-handler';
@@ -386,8 +387,6 @@ import {
VersionWelcomeDialog,
VersionWelcomeDialogProps,
} from './dialogs/version-welcome-dialog';
import { DialogService } from './dialog-service';
import { AppInfo, AppService } from './app-service';
// Hack to fix copy/cut/paste issue after electron version update in Theia.
// https://github.com/eclipse-theia/theia/issues/12487
@@ -494,8 +493,8 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
.whenTargetNamed('store');
// Boards auto-installer
bind(BoardsAutoInstaller).toSelf().inSingletonScope();
bind(FrontendApplicationContribution).toService(BoardsAutoInstaller);
// bind(BoardsAutoInstaller).toSelf().inSingletonScope();
// bind(FrontendApplicationContribution).toService(BoardsAutoInstaller);
// Boards list widget
bind(BoardsListWidget).toSelf();
@@ -568,15 +567,14 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
WorkspaceVariableContribution
);
bind(SurveyNotificationService).toConstantValue(
{} as SurveyNotificationService
);
// return ElectronIpcConnectionProvider.createProxy(
// context.container,
// SurveyNotificationServicePath
// );
// })
// .inSingletonScope();
bind(SurveyNotificationService)
.toDynamicValue((context) => {
return ElectronIpcConnectionProvider.createProxy(
context.container,
SurveyNotificationServicePath
);
})
.inSingletonScope();
// Layout and shell customizations.
rebind(TheiaOutlineViewContribution)
@@ -786,8 +784,6 @@ 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
@@ -970,11 +966,11 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
createWidget: () => ctx.container.get(SketchbookCompositeWidget),
}));
bind(CloudSketchbookWidget).toSelf();
rebind(SketchbookWidget).toService(CloudSketchbookWidget);
bind(CloudSketchbookTreeWidget).toDynamicValue(({ container }) =>
createCloudSketchbookTreeWidget(container)
);
// bind(CloudSketchbookWidget).toSelf();
// rebind(SketchbookWidget).toService(CloudSketchbookWidget);
// bind(CloudSketchbookTreeWidget).toDynamicValue(({ container }) =>
// createCloudSketchbookTreeWidget(container)
// );
bind(CreateApi).toSelf().inSingletonScope();
bind(SketchCache).toSelf().inSingletonScope();
bind(CreateFeatures).toSelf().inSingletonScope();
@@ -1034,16 +1030,16 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
// Frontend binding for the IDE Updater service
bind(IDEUpdaterClientImpl).toSelf().inSingletonScope();
bind(IDEUpdaterClient).toService(IDEUpdaterClientImpl);
bind(IDEUpdater).toConstantValue({} as IDEUpdater);
// .toDynamicValue((context) => {
// const client = context.container.get(IDEUpdaterClientImpl);
// return ElectronIpcConnectionProvider.createProxy(
// context.container,
// IDEUpdaterPath,
// client
// );
// })
// .inSingletonScope();
bind(IDEUpdater)
.toDynamicValue((context) => {
const client = context.container.get(IDEUpdaterClientImpl);
return ElectronIpcConnectionProvider.createProxy(
context.container,
IDEUpdaterPath,
client
);
})
.inSingletonScope();
bind(HostedPluginSupportImpl).toSelf().inSingletonScope();
bind(HostedPluginSupport).toService(HostedPluginSupportImpl);
@@ -1108,32 +1104,6 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
);
bindViewsWelcome_TheiaGH14309({ bind, widget: TreeViewWidget });
bind(DialogService).toConstantValue(<DialogService>{});
bind(AppService).toConstantValue(<AppService>{
quit() {
console.log('Quitting application...');
// Implement quit logic here
},
async info() {
return {
name: 'MyApp',
version: '1.0.0',
description: 'An example application',
appVersion: '1.0.0',
cliVersion: '1.0.0',
buildDate: new Date().toISOString(),
} as AppInfo;
},
registerStartupTasksHandler(_) {
console.log('registerStartupTasksHandler', _);
return { dispose: () => {} };
},
scheduleDeletion(_) {
console.log(`Scheduled deletion for sketch}`, _);
// Implement deletion logic
},
});
});
// Align the viewsWelcome rendering with VS Code (https://github.com/eclipse-theia/theia/issues/14309)

View File

@@ -52,6 +52,10 @@ export class BoardsAutoInstaller implements FrontendApplicationContribution {
private readonly toDispose = new DisposableCollection();
onStart(): void {
if (process.env.IS_LIGHT_VERSION) {
return;
}
this.toDispose.pushAll([
this.boardsServiceProvider.onBoardsConfigDidChange((event) => {
if (isBoardIdentifierChangeEvent(event)) {

View File

@@ -35,6 +35,10 @@ export class BoardsDataMenuUpdater extends Contribution {
private readonly toDisposeOnBoardChange = new DisposableCollection();
override onStart(): void {
if (process.env.IS_LIGHT_VERSION) {
return;
}
this.boardsDataStore.onDidChange(() =>
this.updateMenuActions(
this.boardsServiceProvider.boardsConfig.selectedBoard

View File

@@ -47,6 +47,10 @@ export class CheckForIDEUpdates extends Contribution {
}
override async onReady(): Promise<void> {
if (process.env.IS_LIGHT_VERSION) {
return;
}
this.updater
.init(
this.preferences.get('arduino.ide.updateChannel'),

View File

@@ -15,6 +15,7 @@ import { Installable } from '../../common/protocol/installable';
import { ExecuteWithProgress } from '../../common/protocol/progressible';
import { BoardsListWidgetFrontendContribution } from '../boards/boards-widget-frontend-contribution';
import { LibraryListWidgetFrontendContribution } from '../library/library-widget-frontend-contribution';
import { WindowServiceExt } from '../theia/core/window-service-ext';
import type { ListWidget } from '../widgets/component-list/list-widget';
import { Command, CommandRegistry, Contribution } from './contribution';
@@ -52,8 +53,8 @@ const Updatable = { type: 'Updatable' } as const;
@injectable()
export class CheckForUpdates extends Contribution {
// @inject(WindowServiceExt)
// private readonly windowService: WindowServiceExt;
@inject(WindowServiceExt)
private readonly windowService: WindowServiceExt;
@inject(ResponseServiceClient)
private readonly responseService: ResponseServiceClient;
@inject(BoardsService)
@@ -71,16 +72,16 @@ export class CheckForUpdates extends Contribution {
});
}
// override async onReady(): Promise<void> {
// const checkForUpdates = this.preferences['arduino.checkForUpdates'];
// if (checkForUpdates) {
// this.windowService.isFirstWindow().then((firstWindow) => {
// if (firstWindow) {
// this.checkForUpdates();
// }
// });
// }
// }
override async onReady(): Promise<void> {
const checkForUpdates = this.preferences['arduino.checkForUpdates'];
if (checkForUpdates) {
this.windowService.isFirstWindow().then((firstWindow) => {
if (firstWindow) {
this.checkForUpdates();
}
});
}
}
private async checkForUpdates(silent = true) {
const [boardsPackages, libraryPackages] = await Promise.all([

View File

@@ -7,10 +7,11 @@ import { ApplicationShell } from '@theia/core/lib/browser/shell/application-shel
import { nls } from '@theia/core/lib/common/nls';
import type { MaybePromise } from '@theia/core/lib/common/types';
import { toArray } from '@theia/core/shared/@phosphor/algorithm';
import { injectable } from '@theia/core/shared/inversify';
import { inject, injectable } from '@theia/core/shared/inversify';
import { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor';
import { ArduinoMenus } from '../menu/arduino-menus';
import { CurrentSketch } from '../sketches-service-client-impl';
import { WindowServiceExt } from '../theia/core/window-service-ext';
import {
Command,
CommandRegistry,
@@ -27,8 +28,8 @@ import { SaveAsSketch } from './save-as-sketch';
*/
@injectable()
export class Close extends SketchContribution {
// @inject(WindowServiceExt)
// private readonly windowServiceExt: WindowServiceExt;
@inject(WindowServiceExt)
private readonly windowServiceExt: WindowServiceExt;
private shell: ApplicationShell | undefined;
@@ -58,7 +59,7 @@ export class Close extends SketchContribution {
}
}
}
// return this.windowServiceExt.close();
return this.windowServiceExt.close();
},
});
}

View File

@@ -16,6 +16,10 @@ export class IndexesUpdateProgress extends Contribution {
| undefined;
override onStart(): void {
if (process.env.IS_LIGHT_VERSION) {
return;
}
this.notificationCenter.onIndexUpdateWillStart(({ progressId }) =>
this.getOrCreateProgress(progressId)
);

View File

@@ -8,7 +8,6 @@ import {
ArduinoDaemon,
BoardIdentifier,
BoardsService,
CompileSummary,
ExecutableService,
isBoardIdentifierChangeEvent,
sanitizeFqbn,
@@ -24,7 +23,6 @@ import { HostedPluginEvents } from '../hosted/hosted-plugin-events';
import { NotificationCenter } from '../notification-center';
import { CurrentSketch } from '../sketches-service-client-impl';
import { SketchContribution, URI } from './contribution';
import { CompileSummaryProvider } from './verify-sketch';
interface DaemonAddress {
/**
@@ -109,14 +107,16 @@ export class InoLanguage extends SketchContribution {
private readonly notificationCenter: NotificationCenter;
@inject(BoardsDataStore)
private readonly boardDataStore: BoardsDataStore;
@inject(CompileSummaryProvider)
private readonly compileSummaryProvider: CompileSummaryProvider;
private readonly toDispose = new DisposableCollection();
private readonly languageServerStartMutex = new Mutex();
private languageServerFqbn?: string;
override onReady(): void {
if (process.env.IS_LIGHT_VERSION) {
return;
}
const start = (
selectedBoard: BoardIdentifier | undefined,
forceStart = false
@@ -177,13 +177,6 @@ export class InoLanguage extends SketchContribution {
}
}
}),
this.compileSummaryProvider.onDidChangeCompileSummary(
(compileSummary) => {
if (compileSummary) {
this.fireBuildDidComplete(compileSummary);
}
}
),
]);
Promise.all([
this.boardsServiceProvider.ready,
@@ -202,6 +195,10 @@ export class InoLanguage extends SketchContribution {
name: string | undefined,
forceStart = false
): Promise<void> {
if (process.env.IS_LIGHT_VERSION) {
return;
}
const port = await this.daemon.tryGetPort();
if (typeof port !== 'number') {
return;
@@ -328,32 +325,4 @@ export class InoLanguage extends SketchContribution {
params
);
}
// Execute the a command contributed by the Arduino Tools VSIX to send the `ino/buildDidComplete` notification to the language server
private async fireBuildDidComplete(
compileSummary: CompileSummary
): Promise<void> {
const params = {
...compileSummary,
};
console.info(
`Executing 'arduino.languageserver.notifyBuildDidComplete' with ${JSON.stringify(
params.buildOutputUri
)}`
);
try {
await 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
);
}
}
}

View File

@@ -1,11 +1,13 @@
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';
@@ -16,10 +18,8 @@ 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
@@ -43,8 +43,6 @@ 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();
@@ -62,13 +60,14 @@ export class UpdateArduinoState extends SketchContribution {
this.configService.onDidChangeSketchDirUri((userDirUri) =>
this.updateUserDirPath(userDirUri)
),
this.compileSummaryProvider.onDidChangeCompileSummary(
(compilerSummary) => {
if (compilerSummary) {
this.updateCompileSummary(compilerSummary);
}
this.commandService.onDidExecuteCommand(({ commandId, args }) => {
if (
commandId === 'arduino.languageserver.notifyBuildDidComplete' &&
isCompileSummary(args[0])
) {
this.updateCompileSummary(args[0]);
}
),
}),
this.boardsDataStore.onDidChange((event) => {
const selectedFqbn =
this.boardsServiceProvider.boardsConfig.selectedBoard?.fqbn;
@@ -89,10 +88,6 @@ export class UpdateArduinoState extends SketchContribution {
this.updateSketchPath(this.sketchServiceClient.tryGetCurrentSketch());
this.updateUserDirPath(this.configService.tryGetSketchDirUri());
this.updateDataDirPath(this.configService.tryGetDataDirUri());
const { compileSummary } = this.compileSummaryProvider;
if (compileSummary) {
this.updateCompileSummary(compileSummary);
}
}
onStop(): void {

View File

@@ -3,12 +3,13 @@ import { nls } from '@theia/core/lib/common/nls';
import { inject, injectable } from '@theia/core/shared/inversify';
import { CoreService, IndexType } from '../../common/protocol';
import { NotificationCenter } from '../notification-center';
import { WindowServiceExt } from '../theia/core/window-service-ext';
import { Command, CommandRegistry, Contribution } from './contribution';
@injectable()
export class UpdateIndexes extends Contribution {
// @inject(WindowServiceExt)
// private readonly windowService: WindowServiceExt;
@inject(WindowServiceExt)
private readonly windowService: WindowServiceExt;
@inject(LocalStorageService)
private readonly localStorage: LocalStorageService;
@inject(CoreService)
@@ -44,6 +45,10 @@ export class UpdateIndexes extends Contribution {
}
private async checkForUpdates(): Promise<void> {
if (process.env.IS_LIGHT_VERSION) {
return;
}
const checkForUpdates = this.preferences['arduino.checkForUpdates'];
if (!checkForUpdates) {
console.debug(
@@ -52,34 +57,40 @@ export class UpdateIndexes extends Contribution {
return;
}
const summary = await this.coreService.indexUpdateSummaryBeforeInit();
if (summary.message) {
this.messageService.error(summary.message);
if (await this.windowService.isFirstWindow()) {
const summary = await this.coreService.indexUpdateSummaryBeforeInit();
if (summary.message) {
this.messageService.error(summary.message);
}
const typesToCheck = IndexType.All.filter((type) => !(type in summary));
if (Object.keys(summary).length) {
console.debug(
`[update-indexes]: Detected an index update summary before the core gRPC client initialization. Updating local storage with ${JSON.stringify(
summary
)}`
);
} else {
console.debug(
'[update-indexes]: No index update summary was available before the core gRPC client initialization. Checking the status of the all the index types.'
);
}
await Promise.allSettled([
...Object.entries(summary).map(([type, updatedAt]) =>
this.setLastUpdateDateTime(type as IndexType, updatedAt)
),
this.updateIndexes(typesToCheck),
]);
}
const typesToCheck = IndexType.All.filter((type) => !(type in summary));
if (Object.keys(summary).length) {
console.debug(
`[update-indexes]: Detected an index update summary before the core gRPC client initialization. Updating local storage with ${JSON.stringify(
summary
)}`
);
} else {
console.debug(
'[update-indexes]: No index update summary was available before the core gRPC client initialization. Checking the status of the all the index types.'
);
}
await Promise.allSettled([
...Object.entries(summary).map(([type, updatedAt]) =>
this.setLastUpdateDateTime(type as IndexType, updatedAt)
),
this.updateIndexes(typesToCheck),
]);
}
private async updateIndexes(
types: IndexType[],
force = false
): Promise<void> {
if (process.env.IS_LIGHT_VERSION) {
return;
}
const updatedAt = new Date().toISOString();
return Promise.all(
types.map((type) => this.needsIndexUpdate(type, updatedAt, force))
@@ -101,6 +112,10 @@ export class UpdateIndexes extends Contribution {
now: string,
force = false
): Promise<IndexType | false> {
if (process.env.IS_LIGHT_VERSION) {
return false;
}
if (force) {
console.debug(
`[update-indexes]: Update for index type: '${type}' was forcefully requested.`

View File

@@ -1,7 +1,7 @@
import { Emitter, Event } from '@theia/core/lib/common/event';
import { Emitter } from '@theia/core/lib/common/event';
import { nls } from '@theia/core/lib/common/nls';
import { inject, injectable } from '@theia/core/shared/inversify';
import type { CompileSummary, CoreService } from '../../common/protocol';
import type { CoreService } from '../../common/protocol';
import { ArduinoMenus } from '../menu/arduino-menus';
import { CurrentSketch } from '../sketches-service-client-impl';
import { ArduinoToolbar } from '../toolbar/arduino-toolbar';
@@ -15,12 +15,6 @@ import {
} from './contribution';
import { CoreErrorHandler } from './core-error-handler';
export const CompileSummaryProvider = Symbol('CompileSummaryProvider');
export interface CompileSummaryProvider {
readonly compileSummary: CompileSummary | undefined;
readonly onDidChangeCompileSummary: Event<CompileSummary | undefined>;
}
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.
@@ -52,20 +46,13 @@ export interface VerifySketchParams {
type VerifyProgress = 'idle' | VerifySketchMode;
@injectable()
export class VerifySketch
extends CoreServiceContribution
implements CompileSummaryProvider
{
export class VerifySketch extends CoreServiceContribution {
@inject(CoreErrorHandler)
private readonly coreErrorHandler: CoreErrorHandler;
private readonly onDidChangeEmitter = new Emitter<void>();
private readonly onDidChange = this.onDidChangeEmitter.event;
private readonly onDidChangeCompileSummaryEmitter = new Emitter<
CompileSummary | undefined
>();
private verifyProgress: VerifyProgress = 'idle';
private _compileSummary: CompileSummary | undefined;
override registerCommands(registry: CommandRegistry): void {
registry.registerCommand(VerifySketch.Commands.VERIFY_SKETCH, {
@@ -130,21 +117,6 @@ export class VerifySketch
super.handleError(error);
}
get compileSummary(): CompileSummary | undefined {
return this._compileSummary;
}
private updateCompileSummary(
compileSummary: CompileSummary | undefined
): void {
this._compileSummary = compileSummary;
this.onDidChangeCompileSummaryEmitter.fire(this._compileSummary);
}
get onDidChangeCompileSummary(): Event<CompileSummary | undefined> {
return this.onDidChangeCompileSummaryEmitter.event;
}
private async verifySketch(
params?: VerifySketchParams
): Promise<CoreService.Options.Compile | undefined> {
@@ -169,7 +141,7 @@ export class VerifySketch
return options;
}
const compileSummary = await this.doWithProgress({
await this.doWithProgress({
progressText: nls.localize(
'arduino/sketch/compile',
'Compiling sketch...'
@@ -188,9 +160,6 @@ export class VerifySketch
nls.localize('arduino/sketch/doneCompiling', 'Done compiling.'),
{ timeout: 3000 }
);
this.updateCompileSummary(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.

View File

@@ -1,26 +0,0 @@
import { injectable } from '@theia/core/shared/inversify';
import {
BrowserMainMenuFactory as TheiaBrowserMainMenuFactory,
MenuBarWidget,
} from '@theia/core/lib/browser/menu/browser-menu-plugin';
import { MainMenuManager } from '../../../common/main-menu-manager';
@injectable()
export class BrowserMainMenuFactory
extends TheiaBrowserMainMenuFactory
implements MainMenuManager
{
protected menuBar: MenuBarWidget | undefined;
override createMenuBar(): MenuBarWidget {
this.menuBar = super.createMenuBar();
return this.menuBar;
}
update(): void {
if (this.menuBar) {
this.menuBar.clearMenus();
this.fillMenuBar(this.menuBar);
}
}
}

View File

@@ -1,18 +0,0 @@
import '../../../../src/browser/style/browser-menu.css';
import { ContainerModule } from '@theia/core/shared/inversify';
import {
BrowserMenuBarContribution,
BrowserMainMenuFactory as TheiaBrowserMainMenuFactory,
} from '@theia/core/lib/browser/menu/browser-menu-plugin';
import { MainMenuManager } from '../../../common/main-menu-manager';
import { ArduinoMenuContribution } from './browser-menu-plugin';
import { BrowserMainMenuFactory } from './browser-main-menu-factory';
export default new ContainerModule((bind, unbind, isBound, rebind) => {
bind(BrowserMainMenuFactory).toSelf().inSingletonScope();
bind(MainMenuManager).toService(BrowserMainMenuFactory);
rebind(TheiaBrowserMainMenuFactory).toService(BrowserMainMenuFactory);
rebind(BrowserMenuBarContribution)
.to(ArduinoMenuContribution)
.inSingletonScope();
});

View File

@@ -1,20 +0,0 @@
import { DefaultWindowService as TheiaDefaultWindowService } from '@theia/core/lib/browser/window/default-window-service';
import { injectable } from '@theia/core/shared/inversify';
import { WindowServiceExt } from './window-service-ext';
@injectable()
export class DefaultWindowService
extends TheiaDefaultWindowService
implements WindowServiceExt
{
close(): void {
throw new Error('Method not implemented.');
}
/**
* The default implementation always resolves to `true`.
* IDE2 does not use it. It's currently an electron-only app.
*/
async isFirstWindow(): Promise<boolean> {
return true;
}
}

View File

@@ -1,21 +0,0 @@
import { DefaultWindowService as TheiaDefaultWindowService } from '@theia/core/lib/browser/window/default-window-service';
import { injectable } from '@theia/core/shared/inversify';
import { WindowServiceExt } from './window-service-ext';
@injectable()
export class DefaultWindowService
extends TheiaDefaultWindowService
implements WindowServiceExt
{
/**
* The default implementation always resolves to `true`.
* IDE2 does not use it. It's currently an electron-only app.
*/
async isFirstWindow(): Promise<boolean> {
return true;
}
close() {
console.log('close');
}
}

View File

@@ -22,6 +22,7 @@ import { MonacoThemeRegistry as TheiaMonacoThemeRegistry } from '@theia/monaco/l
import type { ThemeMix } from '@theia/monaco/lib/browser/textmate/monaco-theme-types';
import { HostedPluginSupport } from '../../hosted/hosted-plugin-support';
import { ArduinoThemes, compatibleBuiltInTheme } from '../core/theming';
import { WindowServiceExt } from '../core/window-service-ext';
type MonacoThemeRegistrationSource =
/**
@@ -155,8 +156,8 @@ export class CleanupObsoleteThemes implements FrontendApplicationContribution {
private readonly themeService: ThemeService;
@inject(MessageService)
private readonly messageService: MessageService;
// @inject(WindowServiceExt)
// private readonly windowService: WindowServiceExt;
@inject(WindowServiceExt)
private readonly windowService: WindowServiceExt;
onStart(): void {
this.hostedPlugin.didStart.then(() => this.cleanupObsoleteThemes());
@@ -171,7 +172,7 @@ export class CleanupObsoleteThemes implements FrontendApplicationContribution {
if (!obsoleteThemeIds.length) {
return;
}
const firstWindow = true; // await this.windowService.isFirstWindow();
const firstWindow = await this.windowService.isFirstWindow();
if (firstWindow) {
await this.removeObsoleteThemesFromIndexedDB(obsoleteThemeIds);
this.unregisterObsoleteThemes(obsoleteThemeIds);

View File

@@ -19,13 +19,14 @@ import {
hasStartupTasks,
StartupTask,
} from '../../../electron-common/startup-task';
import { WindowServiceExt } from '../core/window-service-ext';
@injectable()
export class WorkspaceService extends TheiaWorkspaceService {
@inject(SketchesService)
private readonly sketchesService: SketchesService;
// @inject(WindowServiceExt)
// private readonly windowServiceExt: WindowServiceExt;
@inject(WindowServiceExt)
private readonly windowServiceExt: WindowServiceExt;
@inject(ContributionProvider)
@named(StartupTaskProvider)
private readonly providers: ContributionProvider<StartupTaskProvider>;
@@ -103,8 +104,7 @@ export class WorkspaceService extends TheiaWorkspaceService {
protected override reloadWindow(options?: WorkspaceInput): void {
const tasks = this.tasks(options);
this.setURLFragment(this._workspace?.resource.path.toString() || '');
console.log(tasks);
// this.windowServiceExt.reload({ tasks });
this.windowServiceExt.reload({ tasks });
}
protected override openNewWindow(

View File

@@ -1,10 +1,8 @@
// export const MainMenuManager = Symbol('MainMenuManager');
export class MainMenuManager {
export const MainMenuManager = Symbol('MainMenuManager');
export interface MainMenuManager {
/**
* Call this method if you have changed the content of the main menu (updated a toggle flag, removed/added new groups or menu items)
* and you want to re-render it from scratch. Works for electron too.
*/
update() {
console.warn('MainMenuManager.update() is not implemented');
}
update(): void;
}

View File

@@ -171,7 +171,7 @@ export interface CoreService {
compile(
options: CoreService.Options.Compile,
cancellationToken?: CancellationToken
): Promise<CompileSummary | undefined>;
): Promise<void>;
upload(
options: CoreService.Options.Upload,
cancellationToken?: CancellationToken

View File

@@ -521,6 +521,8 @@ export class ElectronMainApplication extends TheiaElectronMainApplication {
}
protected override async startBackend(): Promise<number> {
// FIXME: temporary test to check improvements on low powered machines.
process.env.IS_LIGHT_VERSION = 'true';
// Check if we should run everything as one process.
const noBackendFork = process.argv.indexOf('--no-cluster') !== -1;
// We cannot use the `process.cwd()` as the application project path (the location of the `package.json` in other words)

View File

@@ -75,12 +75,7 @@ import {
} from '../common/protocol';
import { BackendApplication } from './theia/core/backend-application';
import { BoardDiscovery } from './board-discovery';
import { AuthenticationServiceImpl } from './auth/authentication-service-impl';
import {
AuthenticationService,
AuthenticationServiceClient,
AuthenticationServicePath,
} from '../common/protocol/authentication-service';
import { ArduinoFirmwareUploaderImpl } from './arduino-firmware-uploader-impl';
import { PlotterBackendContribution } from './plotter/plotter-backend-contribution';
import { ArduinoLocalizationContribution } from './i18n/arduino-localization-contribution';
@@ -354,25 +349,25 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
].forEach((name) => bindChildLogger(bind, name));
// Cloud sketchbook bindings
bind(AuthenticationServiceImpl).toSelf().inSingletonScope();
bind(AuthenticationService).toService(AuthenticationServiceImpl);
bind(BackendApplicationContribution).toService(AuthenticationServiceImpl);
bind(ConnectionHandler)
.toDynamicValue(
(context) =>
new JsonRpcConnectionHandler<AuthenticationServiceClient>(
AuthenticationServicePath,
(client) => {
const server = context.container.get<AuthenticationServiceImpl>(
AuthenticationServiceImpl
);
server.setClient(client);
client.onDidCloseConnection(() => server.disposeClient(client));
return server;
}
)
)
.inSingletonScope();
// bind(AuthenticationServiceImpl).toSelf().inSingletonScope();
// bind(AuthenticationService).toService(AuthenticationServiceImpl);
// bind(BackendApplicationContribution).toService(AuthenticationServiceImpl);
// bind(ConnectionHandler)
// .toDynamicValue(
// (context) =>
// new JsonRpcConnectionHandler<AuthenticationServiceClient>(
// AuthenticationServicePath,
// (client) => {
// const server = context.container.get<AuthenticationServiceImpl>(
// AuthenticationServiceImpl
// );
// server.setClient(client);
// client.onDidCloseConnection(() => server.disposeClient(client));
// return server;
// }
// )
// )
// .inSingletonScope();
bind(PlotterBackendContribution).toSelf().inSingletonScope();
bind(BackendApplicationContribution).toService(PlotterBackendContribution);

View File

@@ -170,6 +170,10 @@ export class BoardDiscovery
}
async start(): Promise<void> {
if (process.env.IS_LIGHT_VERSION) {
return;
}
this.logger.info('start');
if (this.stopping) {
this.logger.info('start is stopping wait');

View File

@@ -1,6 +1,7 @@
import { type ClientReadableStream } from '@grpc/grpc-js';
import { ApplicationError } from '@theia/core/lib/common/application-error';
import type { CancellationToken } from '@theia/core/lib/common/cancellation';
import { CommandService } from '@theia/core/lib/common/command';
import {
Disposable,
DisposableCollection,
@@ -68,13 +69,15 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
private readonly responseService: ResponseService;
@inject(MonitorManager)
private readonly monitorManager: MonitorManager;
@inject(CommandService)
private readonly commandService: CommandService;
@inject(BoardDiscovery)
private readonly boardDiscovery: BoardDiscovery;
async compile(
options: CoreService.Options.Compile,
cancellationToken?: CancellationToken
): Promise<CompileSummary | undefined> {
): Promise<void> {
const coreClient = await this.coreClient;
const { client, instance } = coreClient;
const request = this.compileRequest(options, instance);
@@ -88,7 +91,7 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
);
const toDisposeOnFinally = new DisposableCollection(handler);
return new Promise<CompileSummary | undefined>((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
let hasRetried = false;
const handleUnexpectedError = (error: Error) => {
@@ -161,26 +164,50 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
call
.on('data', handler.onData)
.on('error', handleError)
.on('end', () => {
if (isCompileSummary(compileSummary)) {
resolve(compileSummary);
} else {
console.error(
`Have not received the full compile summary from the CLI while running the compilation. ${JSON.stringify(
compileSummary
)}`
);
resolve(undefined);
}
});
.on('end', resolve);
};
startCompileStream();
}).finally(() => {
toDisposeOnFinally.dispose();
if (!isCompileSummary(compileSummary)) {
if (cancellationToken && cancellationToken.isCancellationRequested) {
// NOOP
return;
}
console.error(
`Have not received the full compile summary from the CLI while running the compilation. ${JSON.stringify(
compileSummary
)}`
);
} else {
this.fireBuildDidComplete(compileSummary);
}
});
}
// This executes on the frontend, the VS Code extension receives it, and sends an `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
)
);
}
private compileRequest(
options: CoreService.Options.Compile & {
exportBinaries?: boolean;

View File

@@ -31,7 +31,6 @@ import {
UpdateArduinoState,
UpdateStateParams,
} from '../../browser/contributions/update-arduino-state';
import { CompileSummaryProvider } from '../../browser/contributions/verify-sketch';
import { NotificationCenter } from '../../browser/notification-center';
import {
CurrentSketch,
@@ -62,12 +61,10 @@ describe('update-arduino-state', function () {
let currentSketchMock: CurrentSketch | undefined;
let sketchDirUriMock: URI | undefined;
let dataDirUriMock: URI | undefined;
let compileSummaryMock: CompileSummary | undefined;
let onCurrentSketchDidChangeEmitter: Emitter<CurrentSketch>;
let onDataDirDidChangeEmitter: Emitter<URI | undefined>;
let onSketchDirDidChangeEmitter: Emitter<URI | undefined>;
let onDataStoreDidChangeEmitter: Emitter<BoardsDataStoreChangeEvent>;
let compileSummaryDidChangeEmitter: Emitter<CompileSummary | undefined>;
beforeEach(async () => {
toDisposeAfterEach = new DisposableCollection();
@@ -79,18 +76,15 @@ describe('update-arduino-state', function () {
currentSketchMock = undefined;
sketchDirUriMock = undefined;
dataDirUriMock = undefined;
compileSummaryMock = undefined;
onCurrentSketchDidChangeEmitter = new Emitter();
onDataDirDidChangeEmitter = new Emitter();
onSketchDirDidChangeEmitter = new Emitter();
onDataStoreDidChangeEmitter = new Emitter();
compileSummaryDidChangeEmitter = new Emitter();
toDisposeAfterEach.pushAll([
onCurrentSketchDidChangeEmitter,
onDataDirDidChangeEmitter,
onSketchDirDidChangeEmitter,
onDataStoreDidChangeEmitter,
compileSummaryDidChangeEmitter,
]);
const container = createContainer();
@@ -424,8 +418,10 @@ describe('update-arduino-state', function () {
buildPlatform: undefined,
buildOutputUri: 'file:///path/to/build',
};
compileSummaryMock = summary;
compileSummaryDidChangeEmitter.fire(compileSummaryMock);
await commandRegistry.executeCommand(
'arduino.languageserver.notifyBuildDidComplete',
summary
);
await wait(50);
const params = stateUpdateParams.filter(
@@ -589,12 +585,6 @@ describe('update-arduino-state', function () {
new ContainerModule((bind, unbind, isBound, rebind) => {
bindSketchesContribution(bind, unbind, isBound, rebind);
bind(UpdateArduinoState).toSelf().inSingletonScope();
bind(CompileSummaryProvider).toConstantValue(<CompileSummaryProvider>{
get compileSummary(): CompileSummary | undefined {
return compileSummaryMock;
},
onDidChangeCompileSummary: compileSummaryDidChangeEmitter.event,
});
rebind(BoardsService).toConstantValue(<BoardsService>{
getDetectedPorts() {
return {};

View File

@@ -1,11 +1,12 @@
import { CancellationTokenSource } from '@theia/core/lib/common/cancellation';
import { CommandRegistry } from '@theia/core/lib/common/command';
import { DisposableCollection } from '@theia/core/lib/common/disposable';
import { isWindows } from '@theia/core/lib/common/os';
import { FileUri } from '@theia/core/lib/node/file-uri';
import { Container } from '@theia/core/shared/inversify';
import { Container, injectable } from '@theia/core/shared/inversify';
import { expect } from 'chai';
import {
BoardsService,
CompileSummary,
CoreService,
SketchesService,
isCompileSummary,
@@ -35,9 +36,11 @@ describe('core-service-impl', () => {
this.timeout(testTimeout);
const coreService = container.get<CoreService>(CoreService);
const sketchesService = container.get<SketchesService>(SketchesService);
const commandService =
container.get<TestCommandRegistry>(TestCommandRegistry);
const sketch = await sketchesService.createNewSketch();
const compileSummary = await coreService.compile({
await coreService.compile({
fqbn: uno,
sketch,
optimizeForDebug: false,
@@ -45,9 +48,18 @@ describe('core-service-impl', () => {
verbose: true,
});
expect(isCompileSummary(compileSummary)).to.be.true;
expect((<CompileSummary>compileSummary).buildOutputUri).to.be.not
.undefined;
const executedBuildDidCompleteCommands =
commandService.executedCommands.filter(
([command]) =>
command === 'arduino.languageserver.notifyBuildDidComplete'
);
expect(executedBuildDidCompleteCommands.length).to.be.equal(1);
const [, args] = executedBuildDidCompleteCommands[0];
expect(args.length).to.be.equal(1);
const arg = args[0];
expect(isCompileSummary(arg)).to.be.true;
expect('buildOutputUri' in arg).to.be.true;
expect(arg.buildOutputUri).to.be.not.undefined;
const tempBuildPaths = await sketchesService.getBuildPath(sketch);
if (isWindows) {
@@ -56,7 +68,7 @@ describe('core-service-impl', () => {
expect(tempBuildPaths.length).to.be.equal(1);
}
const { buildOutputUri } = <CompileSummary>compileSummary;
const { buildOutputUri } = arg;
const buildOutputPath = FileUri.fsPath(buildOutputUri).toString();
expect(tempBuildPaths.includes(buildOutputPath)).to.be.true;
});
@@ -79,5 +91,35 @@ async function start(
}
async function createContainer(): Promise<Container> {
return createBaseContainer();
return createBaseContainer({
additionalBindings: (bind, rebind) => {
bind(TestCommandRegistry).toSelf().inSingletonScope();
rebind(CommandRegistry).toService(TestCommandRegistry);
},
});
}
@injectable()
class TestCommandRegistry extends CommandRegistry {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
readonly executedCommands: [string, any[]][] = [];
override async executeCommand<T>(
commandId: string,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
...args: any[]
): Promise<T | undefined> {
const { token } = new CancellationTokenSource();
this.onWillExecuteCommandEmitter.fire({
commandId,
args,
token,
waitUntil: () => {
// NOOP
},
});
this.executedCommands.push([commandId, args]);
this.onDidExecuteCommandEmitter.fire({ commandId, args });
return undefined;
}
}

View File

@@ -1,64 +0,0 @@
{
"private": true,
"name": "browser-app",
"version": "2.0.0",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@theia/core": "1.41.0",
"@theia/debug": "1.41.0",
"@theia/editor": "1.41.0",
"@theia/file-search": "1.41.0",
"@theia/filesystem": "1.41.0",
"@theia/keymaps": "1.41.0",
"@theia/messages": "1.41.0",
"@theia/monaco": "1.41.0",
"@theia/navigator": "1.41.0",
"@theia/plugin-ext": "1.41.0",
"@theia/plugin-ext-vscode": "1.41.0",
"@theia/preferences": "1.41.0",
"@theia/process": "1.41.0",
"@theia/terminal": "1.41.0",
"@theia/workspace": "1.41.0",
"arduino-ide-extension": "2.3.5"
},
"devDependencies": {
"@theia/cli": "1.41.0"
},
"scripts": {
"build:dev": "theia build --config webpack.config.js --mode development",
"prepare": "theia build --mode development",
"start": "theia start",
"watch": "theia build --watch --mode development"
},
"theia": {
"frontend": {
"config": {
"applicationName": "Arduino IDE",
"defaultTheme": "arduino-theme",
"preferences": {
"files.autoSave": "afterDelay",
"editor.minimap.enabled": false,
"editor.tabSize": 2,
"editor.scrollBeyondLastLine": false,
"editor.quickSuggestions": {
"other": false,
"comments": false,
"strings": false
},
"breadcrumbs.enabled": false
}
}
},
"backend": {
"config": {
"configDirName": ".arduinoIDE"
}
},
"generator": {
"config": {
"preloadTemplate": "<div class='theia-preload' style='background-color: rgb(237, 241, 242);'></div>"
}
}
}
}

View File

@@ -1,20 +0,0 @@
/**
* This file can be edited to customize webpack configuration.
* To reset delete this file and rerun theia build again.
*/
// @ts-check
const config = require('./gen-webpack.config.js');
config[0].resolve.fallback['http'] = false;
config[0].resolve.fallback['fs'] = false;
/**
* Expose bundled modules on window.theia.moduleName namespace, e.g.
* window['theia']['@theia/core/lib/common/uri'].
* Such syntax can be used by external code, for instance, for testing.
config.module.rules.push({
test: /\.js$/,
loader: require.resolve('@theia/application-manager/lib/expose-loader')
}); */
module.exports = config;

View File

@@ -44,7 +44,7 @@
},
"scripts": {
"prepare": "lerna run prepare",
"cleanup": "rimraf ./**/node_modules && rm -rf ./node_modules ./.browser_modules ./arduino-ide-extension/build ./arduino-ide-extension/downloads ./arduino-ide-extension/Examples ./arduino-ide-extension/lib ./electron-app/lib ./electron-app/src-gen ./electron-app/gen-webpack.config.js ./browser-app/lib ./browser-app/src-gen ./browser-app/gen-webpack.config.js",
"cleanup": "rimraf ./**/node_modules && rm -rf ./node_modules ./.browser_modules ./arduino-ide-extension/build ./arduino-ide-extension/downloads ./arduino-ide-extension/Examples ./arduino-ide-extension/lib ./electron-app/lib ./electron-app/src-gen ./electron-app/gen-webpack.config.js",
"rebuild:browser": "theia rebuild:browser",
"rebuild:electron": "theia rebuild:electron",
"start": "yarn --cwd ./electron-app start",
@@ -54,7 +54,7 @@
"test": "lerna run test",
"test:slow": "lerna run test:slow",
"update:version": "node ./scripts/update-version.js",
"i18n:generate": "theia nls-extract -e vscode -f \"+(arduino-ide-extension|browser-app|electron-app|plugins)/**/*.ts?(x)\" -o ./i18n/en.json",
"i18n:generate": "theia nls-extract -e vscode -f \"+(arduino-ide-extension|electron-app|plugins)/**/*.ts?(x)\" -o ./i18n/en.json",
"i18n:check": "yarn i18n:generate && git add -N ./i18n && git diff --exit-code ./i18n",
"i18n:push": "node ./scripts/i18n/transifex-push.js ./i18n/en.json",
"i18n:pull": "node ./scripts/i18n/transifex-pull.js ./i18n/",
@@ -74,7 +74,6 @@
},
"workspaces": [
"arduino-ide-extension",
"electron-app",
"browser-app"
"electron-app"
]
}

View File

@@ -2,11 +2,8 @@
set -e
yarn install --immutable \
yarn install --immutable --network-timeout 10000000 \
&& yarn --cwd arduino-ide-extension build \
&& yarn test \
&& yarn --cwd arduino-ide-extension test:slow \
&& yarn --cwd arduino-ide-extension lint \
&& yarn --cwd electron-app rebuild \
&& yarn --cwd electron-app build \
&& yarn --cwd electron-app package

View File

@@ -38,7 +38,6 @@ console.log(
for (const toUpdate of [
path.join(repoRootPath, 'package.json'),
path.join(repoRootPath, 'electron-app', 'package.json'),
path.join(repoRootPath, 'browser-app', 'package.json'),
path.join(repoRootPath, 'arduino-ide-extension', 'package.json'),
]) {
process.stdout.write(` Updating ${toUpdate}'...`);