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/*', '.browser_modules/*',
'docs/*', 'docs/*',
'scripts/*', 'scripts/*',
'browser-app/*',
'electron-app/lib/*', 'electron-app/lib/*',
'electron-app/src-gen/*', 'electron-app/src-gen/*',
'electron-app/gen-webpack*.js', 'electron-app/gen-webpack*.js',

View File

@@ -203,7 +203,7 @@ jobs:
echo "is-nightly=$is_nightly" >> $GITHUB_OUTPUT echo "is-nightly=$is_nightly" >> $GITHUB_OUTPUT
echo "channel-name=$channel_name" >> $GITHUB_OUTPUT echo "channel-name=$channel_name" >> $GITHUB_OUTPUT
# Only attempt upload to Amazon S3 if the credentials are available. # 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: select-targets:
needs: build-type-determination needs: build-type-determination
@@ -284,6 +284,8 @@ jobs:
- build-type-determination - build-type-determination
- select-targets - select-targets
env: 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. # Location of artifacts generated by build.
BUILD_ARTIFACTS_PATH: electron-app/dist/build-artifacts BUILD_ARTIFACTS_PATH: electron-app/dist/build-artifacts
# to skip passing signing credentials to electron-builder # to skip passing signing credentials to electron-builder
@@ -361,6 +363,8 @@ jobs:
AC_USERNAME: ${{ secrets.AC_USERNAME }} AC_USERNAME: ${{ secrets.AC_USERNAME }}
AC_PASSWORD: ${{ secrets.AC_PASSWORD }} AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
AC_TEAM_ID: ${{ secrets.AC_TEAM_ID }} 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_NIGHTLY: ${{ needs.build-type-determination.outputs.is-nightly }}
IS_RELEASE: ${{ needs.build-type-determination.outputs.is-release }} IS_RELEASE: ${{ needs.build-type-determination.outputs.is-release }}
CAN_SIGN: ${{ secrets[matrix.config.certificate-secret] != '' }} CAN_SIGN: ${{ secrets[matrix.config.certificate-secret] != '' }}
@@ -584,12 +588,6 @@ jobs:
env: env:
ARTIFACTS_FOLDER: build-artifacts ARTIFACTS_FOLDER: build-artifacts
environment: production
permissions:
id-token: write
contents: read
steps: steps:
- name: Download all job transfer artifacts - name: Download all job transfer artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
@@ -598,15 +596,15 @@ jobs:
path: ${{ env.ARTIFACTS_FOLDER }} path: ${{ env.ARTIFACTS_FOLDER }}
pattern: ${{ env.JOB_TRANSFER_ARTIFACT_PREFIX }}* 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] - name: Publish Nightly [S3]
run: | uses: docker://plugins/s3
aws s3 sync ${{ env.ARTIFACTS_FOLDER }} s3://${{ secrets.DOWNLOADS_BUCKET }}/arduino-ide/nightly 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: release:
needs: needs:
@@ -627,12 +625,6 @@ jobs:
env: env:
ARTIFACTS_FOLDER: build-artifacts ARTIFACTS_FOLDER: build-artifacts
environment: production
permissions:
id-token: write
contents: read
steps: steps:
- name: Download all job transfer artifacts - name: Download all job transfer artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
@@ -656,17 +648,16 @@ jobs:
file_glob: true file_glob: true
body: ${{ needs.changelog.outputs.BODY }} 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] - name: Publish Release [S3]
if: needs.build-type-determination.outputs.publish-to-s3 == 'true' if: needs.build-type-determination.outputs.publish-to-s3 == 'true'
run: | uses: docker://plugins/s3
aws s3 sync ${{ env.ARTIFACTS_FOLDER }} s3://${{ secrets.DOWNLOADS_BUCKET }}/arduino-ide 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: clean:
# This job must run after all jobs that use the transfer artifact. # This job must run after all jobs that use the transfer artifact.

View File

@@ -76,12 +76,6 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x 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 - name: Install dependencies
run: yarn install --immutable run: yarn install --immutable
env: env:

View File

@@ -73,12 +73,6 @@ jobs:
cache: yarn cache: yarn
node-version: ${{ env.NODE_VERSION }} 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 - name: Install npm package dependencies
env: env:
# Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting: # Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting:

View File

@@ -72,12 +72,6 @@ jobs:
cache: yarn cache: yarn
node-version: ${{ env.NODE_VERSION }} 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 - name: Install npm package dependencies
env: env:
# Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting: # Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting:

View File

@@ -14,11 +14,6 @@ jobs:
create-changelog: create-changelog:
if: github.repository == 'arduino/arduino-ide' if: github.repository == 'arduino/arduino-ide'
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
environment: production
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -49,12 +44,12 @@ jobs:
# Compose changelog # Compose changelog
yarn run compose-changelog "${{ github.workspace }}/${{ env.CHANGELOG_ARTIFACTS }}/$CHANGELOG_FILE_NAME" 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] - name: Publish Changelog [S3]
run: | uses: docker://plugins/s3
aws s3 sync ${{ env.CHANGELOG_ARTIFACTS }} s3://${{ secrets.DOWNLOADS_BUCKET }}/arduino-ide/changelog 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 }} repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x 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 - name: Install dependencies
run: yarn install --immutable run: yarn install --immutable

View File

@@ -34,12 +34,6 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x 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 - name: Install dependencies
run: yarn install --immutable run: yarn install --immutable

View File

@@ -107,12 +107,6 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x 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 - name: Install npm package dependencies
env: env:
# Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting: # Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting:

View File

@@ -36,12 +36,6 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x 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 - name: Install dependencies
run: yarn install --immutable 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, "port": 9222,
"webRoot": "${workspaceFolder}/electron-app" "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", "type": "node",
"request": "launch", "request": "launch",

30
.vscode/tasks.json vendored
View File

@@ -15,17 +15,6 @@
"clear": false "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", "label": "Watch Extension",
"type": "shell", "type": "shell",
@@ -37,17 +26,6 @@
"clear": false "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", "label": "Watch App",
"type": "shell", "type": "shell",
@@ -59,14 +37,6 @@
"clear": false "clear": false
} }
}, },
{
"label": "Arduino IDE - Watch All [Browser]",
"type": "shell",
"dependsOn": [
"Arduino IDE - Watch IDE Extension",
"Arduino IDE - Watch Browser App"
]
},
{ {
"label": "Watch All", "label": "Watch All",
"type": "shell", "type": "shell",

View File

@@ -158,8 +158,16 @@
"frontend": "lib/browser/arduino-ide-frontend-module" "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-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": { "arduino": {

View File

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

View File

@@ -85,7 +85,6 @@ import { TabBarDecoratorService as TheiaTabBarDecoratorService } from '@theia/co
import { TabBarDecoratorService } from './theia/core/tab-bar-decorator'; import { TabBarDecoratorService } from './theia/core/tab-bar-decorator';
import { ProblemManager as TheiaProblemManager } from '@theia/markers/lib/browser'; import { ProblemManager as TheiaProblemManager } from '@theia/markers/lib/browser';
import { ProblemManager } from './theia/markers/problem-manager'; import { ProblemManager } from './theia/markers/problem-manager';
import { BoardsAutoInstaller } from './boards/boards-auto-installer';
import { ShellLayoutRestorer } from './theia/core/shell-layout-restorer'; import { ShellLayoutRestorer } from './theia/core/shell-layout-restorer';
import { import {
ArduinoComponentContextMenuRenderer, ArduinoComponentContextMenuRenderer,
@@ -131,10 +130,7 @@ import { OpenSketch } from './contributions/open-sketch';
import { Close } from './contributions/close'; import { Close } from './contributions/close';
import { SaveAsSketch } from './contributions/save-as-sketch'; import { SaveAsSketch } from './contributions/save-as-sketch';
import { SaveSketch } from './contributions/save-sketch'; import { SaveSketch } from './contributions/save-sketch';
import { import { VerifySketch } from './contributions/verify-sketch';
CompileSummaryProvider,
VerifySketch,
} from './contributions/verify-sketch';
import { UploadSketch } from './contributions/upload-sketch'; import { UploadSketch } from './contributions/upload-sketch';
import { CommonFrontendContribution } from './theia/core/common-frontend-contribution'; import { CommonFrontendContribution } from './theia/core/common-frontend-contribution';
import { EditContributions } from './contributions/edit-contributions'; 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 { NotificationsRenderer } from './theia/messages/notifications-renderer';
import { SketchbookWidgetContribution } from './widgets/sketchbook/sketchbook-widget-contribution'; import { SketchbookWidgetContribution } from './widgets/sketchbook/sketchbook-widget-contribution';
import { LocalCacheFsProvider } from './local-cache/local-cache-fs-provider'; 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 { CreateApi } from './create/create-api';
import { ShareSketchDialog } from './dialogs/cloud-share-sketch-dialog'; import { ShareSketchDialog } from './dialogs/cloud-share-sketch-dialog';
import { AuthenticationClientService } from './auth/authentication-client-service'; import { AuthenticationClientService } from './auth/authentication-client-service';
@@ -265,12 +258,17 @@ import {
} from './dialogs/user-fields/user-fields-dialog'; } from './dialogs/user-fields/user-fields-dialog';
import { nls } from '@theia/core/lib/common'; import { nls } from '@theia/core/lib/common';
import { IDEUpdaterCommands } from './ide-updater/ide-updater-commands'; 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 { IDEUpdaterClientImpl } from './ide-updater/ide-updater-client-impl';
import { import {
IDEUpdaterDialog, IDEUpdaterDialog,
IDEUpdaterDialogProps, IDEUpdaterDialogProps,
} from './dialogs/ide-updater/ide-updater-dialog'; } 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 { MonitorModel } from './monitor-model';
import { MonitorManagerProxyClientImpl } from './monitor-manager-proxy-client-impl'; import { MonitorManagerProxyClientImpl } from './monitor-manager-proxy-client-impl';
import { EditorManager as TheiaEditorManager } from '@theia/editor/lib/browser/editor-manager'; 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 { PreferenceTreeGenerator as TheiaPreferenceTreeGenerator } from '@theia/preferences/lib/browser/util/preference-tree-generator';
import { AboutDialog } from './theia/core/about-dialog'; import { AboutDialog } from './theia/core/about-dialog';
import { AboutDialog as TheiaAboutDialog } from '@theia/core/lib/browser/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 } from './theia/core/window-contribution';
import { WindowContribution as TheiaWindowContribution } from '@theia/core/lib/browser/window-contribution'; import { WindowContribution as TheiaWindowContribution } from '@theia/core/lib/browser/window-contribution';
import { CoreErrorHandler } from './contributions/core-error-handler'; import { CoreErrorHandler } from './contributions/core-error-handler';
@@ -386,8 +387,6 @@ import {
VersionWelcomeDialog, VersionWelcomeDialog,
VersionWelcomeDialogProps, VersionWelcomeDialogProps,
} from './dialogs/version-welcome-dialog'; } 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. // Hack to fix copy/cut/paste issue after electron version update in Theia.
// https://github.com/eclipse-theia/theia/issues/12487 // https://github.com/eclipse-theia/theia/issues/12487
@@ -494,8 +493,8 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
.whenTargetNamed('store'); .whenTargetNamed('store');
// Boards auto-installer // Boards auto-installer
bind(BoardsAutoInstaller).toSelf().inSingletonScope(); // bind(BoardsAutoInstaller).toSelf().inSingletonScope();
bind(FrontendApplicationContribution).toService(BoardsAutoInstaller); // bind(FrontendApplicationContribution).toService(BoardsAutoInstaller);
// Boards list widget // Boards list widget
bind(BoardsListWidget).toSelf(); bind(BoardsListWidget).toSelf();
@@ -568,15 +567,14 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
WorkspaceVariableContribution WorkspaceVariableContribution
); );
bind(SurveyNotificationService).toConstantValue( bind(SurveyNotificationService)
{} as SurveyNotificationService .toDynamicValue((context) => {
); return ElectronIpcConnectionProvider.createProxy(
// return ElectronIpcConnectionProvider.createProxy( context.container,
// context.container, SurveyNotificationServicePath
// SurveyNotificationServicePath );
// ); })
// }) .inSingletonScope();
// .inSingletonScope();
// Layout and shell customizations. // Layout and shell customizations.
rebind(TheiaOutlineViewContribution) rebind(TheiaOutlineViewContribution)
@@ -786,8 +784,6 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
Contribution.configure(bind, BoardsDataMenuUpdater); Contribution.configure(bind, BoardsDataMenuUpdater);
Contribution.configure(bind, AutoSelectProgrammer); Contribution.configure(bind, AutoSelectProgrammer);
bind(CompileSummaryProvider).toService(VerifySketch);
bindContributionProvider(bind, StartupTaskProvider); bindContributionProvider(bind, StartupTaskProvider);
bind(StartupTaskProvider).toService(BoardsServiceProvider); // to reuse the boards config in another window 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), createWidget: () => ctx.container.get(SketchbookCompositeWidget),
})); }));
bind(CloudSketchbookWidget).toSelf(); // bind(CloudSketchbookWidget).toSelf();
rebind(SketchbookWidget).toService(CloudSketchbookWidget); // rebind(SketchbookWidget).toService(CloudSketchbookWidget);
bind(CloudSketchbookTreeWidget).toDynamicValue(({ container }) => // bind(CloudSketchbookTreeWidget).toDynamicValue(({ container }) =>
createCloudSketchbookTreeWidget(container) // createCloudSketchbookTreeWidget(container)
); // );
bind(CreateApi).toSelf().inSingletonScope(); bind(CreateApi).toSelf().inSingletonScope();
bind(SketchCache).toSelf().inSingletonScope(); bind(SketchCache).toSelf().inSingletonScope();
bind(CreateFeatures).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 // Frontend binding for the IDE Updater service
bind(IDEUpdaterClientImpl).toSelf().inSingletonScope(); bind(IDEUpdaterClientImpl).toSelf().inSingletonScope();
bind(IDEUpdaterClient).toService(IDEUpdaterClientImpl); bind(IDEUpdaterClient).toService(IDEUpdaterClientImpl);
bind(IDEUpdater).toConstantValue({} as IDEUpdater); bind(IDEUpdater)
// .toDynamicValue((context) => { .toDynamicValue((context) => {
// const client = context.container.get(IDEUpdaterClientImpl); const client = context.container.get(IDEUpdaterClientImpl);
// return ElectronIpcConnectionProvider.createProxy( return ElectronIpcConnectionProvider.createProxy(
// context.container, context.container,
// IDEUpdaterPath, IDEUpdaterPath,
// client client
// ); );
// }) })
// .inSingletonScope(); .inSingletonScope();
bind(HostedPluginSupportImpl).toSelf().inSingletonScope(); bind(HostedPluginSupportImpl).toSelf().inSingletonScope();
bind(HostedPluginSupport).toService(HostedPluginSupportImpl); bind(HostedPluginSupport).toService(HostedPluginSupportImpl);
@@ -1108,32 +1104,6 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
); );
bindViewsWelcome_TheiaGH14309({ bind, widget: TreeViewWidget }); 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) // 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(); private readonly toDispose = new DisposableCollection();
onStart(): void { onStart(): void {
if (process.env.IS_LIGHT_VERSION) {
return;
}
this.toDispose.pushAll([ this.toDispose.pushAll([
this.boardsServiceProvider.onBoardsConfigDidChange((event) => { this.boardsServiceProvider.onBoardsConfigDidChange((event) => {
if (isBoardIdentifierChangeEvent(event)) { if (isBoardIdentifierChangeEvent(event)) {

View File

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

View File

@@ -47,6 +47,10 @@ export class CheckForIDEUpdates extends Contribution {
} }
override async onReady(): Promise<void> { override async onReady(): Promise<void> {
if (process.env.IS_LIGHT_VERSION) {
return;
}
this.updater this.updater
.init( .init(
this.preferences.get('arduino.ide.updateChannel'), 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 { ExecuteWithProgress } from '../../common/protocol/progressible';
import { BoardsListWidgetFrontendContribution } from '../boards/boards-widget-frontend-contribution'; import { BoardsListWidgetFrontendContribution } from '../boards/boards-widget-frontend-contribution';
import { LibraryListWidgetFrontendContribution } from '../library/library-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 type { ListWidget } from '../widgets/component-list/list-widget';
import { Command, CommandRegistry, Contribution } from './contribution'; import { Command, CommandRegistry, Contribution } from './contribution';
@@ -52,8 +53,8 @@ const Updatable = { type: 'Updatable' } as const;
@injectable() @injectable()
export class CheckForUpdates extends Contribution { export class CheckForUpdates extends Contribution {
// @inject(WindowServiceExt) @inject(WindowServiceExt)
// private readonly windowService: WindowServiceExt; private readonly windowService: WindowServiceExt;
@inject(ResponseServiceClient) @inject(ResponseServiceClient)
private readonly responseService: ResponseServiceClient; private readonly responseService: ResponseServiceClient;
@inject(BoardsService) @inject(BoardsService)
@@ -71,16 +72,16 @@ export class CheckForUpdates extends Contribution {
}); });
} }
// override async onReady(): Promise<void> { override async onReady(): Promise<void> {
// const checkForUpdates = this.preferences['arduino.checkForUpdates']; const checkForUpdates = this.preferences['arduino.checkForUpdates'];
// if (checkForUpdates) { if (checkForUpdates) {
// this.windowService.isFirstWindow().then((firstWindow) => { this.windowService.isFirstWindow().then((firstWindow) => {
// if (firstWindow) { if (firstWindow) {
// this.checkForUpdates(); this.checkForUpdates();
// } }
// }); });
// } }
// } }
private async checkForUpdates(silent = true) { private async checkForUpdates(silent = true) {
const [boardsPackages, libraryPackages] = await Promise.all([ 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 { nls } from '@theia/core/lib/common/nls';
import type { MaybePromise } from '@theia/core/lib/common/types'; import type { MaybePromise } from '@theia/core/lib/common/types';
import { toArray } from '@theia/core/shared/@phosphor/algorithm'; 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 { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor';
import { ArduinoMenus } from '../menu/arduino-menus'; import { ArduinoMenus } from '../menu/arduino-menus';
import { CurrentSketch } from '../sketches-service-client-impl'; import { CurrentSketch } from '../sketches-service-client-impl';
import { WindowServiceExt } from '../theia/core/window-service-ext';
import { import {
Command, Command,
CommandRegistry, CommandRegistry,
@@ -27,8 +28,8 @@ import { SaveAsSketch } from './save-as-sketch';
*/ */
@injectable() @injectable()
export class Close extends SketchContribution { export class Close extends SketchContribution {
// @inject(WindowServiceExt) @inject(WindowServiceExt)
// private readonly windowServiceExt: WindowServiceExt; private readonly windowServiceExt: WindowServiceExt;
private shell: ApplicationShell | undefined; 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; | undefined;
override onStart(): void { override onStart(): void {
if (process.env.IS_LIGHT_VERSION) {
return;
}
this.notificationCenter.onIndexUpdateWillStart(({ progressId }) => this.notificationCenter.onIndexUpdateWillStart(({ progressId }) =>
this.getOrCreateProgress(progressId) this.getOrCreateProgress(progressId)
); );

View File

@@ -8,7 +8,6 @@ import {
ArduinoDaemon, ArduinoDaemon,
BoardIdentifier, BoardIdentifier,
BoardsService, BoardsService,
CompileSummary,
ExecutableService, ExecutableService,
isBoardIdentifierChangeEvent, isBoardIdentifierChangeEvent,
sanitizeFqbn, sanitizeFqbn,
@@ -24,7 +23,6 @@ import { HostedPluginEvents } from '../hosted/hosted-plugin-events';
import { NotificationCenter } from '../notification-center'; import { NotificationCenter } from '../notification-center';
import { CurrentSketch } from '../sketches-service-client-impl'; import { CurrentSketch } from '../sketches-service-client-impl';
import { SketchContribution, URI } from './contribution'; import { SketchContribution, URI } from './contribution';
import { CompileSummaryProvider } from './verify-sketch';
interface DaemonAddress { interface DaemonAddress {
/** /**
@@ -109,14 +107,16 @@ export class InoLanguage extends SketchContribution {
private readonly notificationCenter: NotificationCenter; private readonly notificationCenter: NotificationCenter;
@inject(BoardsDataStore) @inject(BoardsDataStore)
private readonly boardDataStore: BoardsDataStore; private readonly boardDataStore: BoardsDataStore;
@inject(CompileSummaryProvider)
private readonly compileSummaryProvider: CompileSummaryProvider;
private readonly toDispose = new DisposableCollection(); private readonly toDispose = new DisposableCollection();
private readonly languageServerStartMutex = new Mutex(); private readonly languageServerStartMutex = new Mutex();
private languageServerFqbn?: string; private languageServerFqbn?: string;
override onReady(): void { override onReady(): void {
if (process.env.IS_LIGHT_VERSION) {
return;
}
const start = ( const start = (
selectedBoard: BoardIdentifier | undefined, selectedBoard: BoardIdentifier | undefined,
forceStart = false forceStart = false
@@ -177,13 +177,6 @@ export class InoLanguage extends SketchContribution {
} }
} }
}), }),
this.compileSummaryProvider.onDidChangeCompileSummary(
(compileSummary) => {
if (compileSummary) {
this.fireBuildDidComplete(compileSummary);
}
}
),
]); ]);
Promise.all([ Promise.all([
this.boardsServiceProvider.ready, this.boardsServiceProvider.ready,
@@ -202,6 +195,10 @@ export class InoLanguage extends SketchContribution {
name: string | undefined, name: string | undefined,
forceStart = false forceStart = false
): Promise<void> { ): Promise<void> {
if (process.env.IS_LIGHT_VERSION) {
return;
}
const port = await this.daemon.tryGetPort(); const port = await this.daemon.tryGetPort();
if (typeof port !== 'number') { if (typeof port !== 'number') {
return; return;
@@ -328,32 +325,4 @@ export class InoLanguage extends SketchContribution {
params 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 { DisposableCollection } from '@theia/core/lib/common/disposable';
import URI from '@theia/core/lib/common/uri'; import URI from '@theia/core/lib/common/uri';
import { inject, injectable } from '@theia/core/shared/inversify'; import { inject, injectable } from '@theia/core/shared/inversify';
import { HostedPluginSupport } from '../hosted/hosted-plugin-support';
import type { ArduinoState } from 'vscode-arduino-api'; import type { ArduinoState } from 'vscode-arduino-api';
import { import {
BoardsConfig,
BoardsService, BoardsService,
CompileSummary, CompileSummary,
isCompileSummary,
BoardsConfig,
PortIdentifier, PortIdentifier,
resolveDetectedPort, resolveDetectedPort,
} from '../../common/protocol'; } from '../../common/protocol';
@@ -16,10 +18,8 @@ import {
} from '../../common/protocol/arduino-context-mapper'; } from '../../common/protocol/arduino-context-mapper';
import { BoardsDataStore } from '../boards/boards-data-store'; import { BoardsDataStore } from '../boards/boards-data-store';
import { BoardsServiceProvider } from '../boards/boards-service-provider'; import { BoardsServiceProvider } from '../boards/boards-service-provider';
import { HostedPluginSupport } from '../hosted/hosted-plugin-support';
import { CurrentSketch } from '../sketches-service-client-impl'; import { CurrentSketch } from '../sketches-service-client-impl';
import { SketchContribution } from './contribution'; import { SketchContribution } from './contribution';
import { CompileSummaryProvider } from './verify-sketch';
/** /**
* (non-API) exported for tests * (non-API) exported for tests
@@ -43,8 +43,6 @@ export class UpdateArduinoState extends SketchContribution {
private readonly boardsDataStore: BoardsDataStore; private readonly boardsDataStore: BoardsDataStore;
@inject(HostedPluginSupport) @inject(HostedPluginSupport)
private readonly hostedPluginSupport: HostedPluginSupport; private readonly hostedPluginSupport: HostedPluginSupport;
@inject(CompileSummaryProvider)
private readonly compileSummaryProvider: CompileSummaryProvider;
private readonly toDispose = new DisposableCollection(); private readonly toDispose = new DisposableCollection();
@@ -62,13 +60,14 @@ export class UpdateArduinoState extends SketchContribution {
this.configService.onDidChangeSketchDirUri((userDirUri) => this.configService.onDidChangeSketchDirUri((userDirUri) =>
this.updateUserDirPath(userDirUri) this.updateUserDirPath(userDirUri)
), ),
this.compileSummaryProvider.onDidChangeCompileSummary( this.commandService.onDidExecuteCommand(({ commandId, args }) => {
(compilerSummary) => { if (
if (compilerSummary) { commandId === 'arduino.languageserver.notifyBuildDidComplete' &&
this.updateCompileSummary(compilerSummary); isCompileSummary(args[0])
} ) {
this.updateCompileSummary(args[0]);
} }
), }),
this.boardsDataStore.onDidChange((event) => { this.boardsDataStore.onDidChange((event) => {
const selectedFqbn = const selectedFqbn =
this.boardsServiceProvider.boardsConfig.selectedBoard?.fqbn; this.boardsServiceProvider.boardsConfig.selectedBoard?.fqbn;
@@ -89,10 +88,6 @@ export class UpdateArduinoState extends SketchContribution {
this.updateSketchPath(this.sketchServiceClient.tryGetCurrentSketch()); this.updateSketchPath(this.sketchServiceClient.tryGetCurrentSketch());
this.updateUserDirPath(this.configService.tryGetSketchDirUri()); this.updateUserDirPath(this.configService.tryGetSketchDirUri());
this.updateDataDirPath(this.configService.tryGetDataDirUri()); this.updateDataDirPath(this.configService.tryGetDataDirUri());
const { compileSummary } = this.compileSummaryProvider;
if (compileSummary) {
this.updateCompileSummary(compileSummary);
}
} }
onStop(): void { 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 { inject, injectable } from '@theia/core/shared/inversify';
import { CoreService, IndexType } from '../../common/protocol'; import { CoreService, IndexType } from '../../common/protocol';
import { NotificationCenter } from '../notification-center'; import { NotificationCenter } from '../notification-center';
import { WindowServiceExt } from '../theia/core/window-service-ext';
import { Command, CommandRegistry, Contribution } from './contribution'; import { Command, CommandRegistry, Contribution } from './contribution';
@injectable() @injectable()
export class UpdateIndexes extends Contribution { export class UpdateIndexes extends Contribution {
// @inject(WindowServiceExt) @inject(WindowServiceExt)
// private readonly windowService: WindowServiceExt; private readonly windowService: WindowServiceExt;
@inject(LocalStorageService) @inject(LocalStorageService)
private readonly localStorage: LocalStorageService; private readonly localStorage: LocalStorageService;
@inject(CoreService) @inject(CoreService)
@@ -44,6 +45,10 @@ export class UpdateIndexes extends Contribution {
} }
private async checkForUpdates(): Promise<void> { private async checkForUpdates(): Promise<void> {
if (process.env.IS_LIGHT_VERSION) {
return;
}
const checkForUpdates = this.preferences['arduino.checkForUpdates']; const checkForUpdates = this.preferences['arduino.checkForUpdates'];
if (!checkForUpdates) { if (!checkForUpdates) {
console.debug( console.debug(
@@ -52,34 +57,40 @@ export class UpdateIndexes extends Contribution {
return; return;
} }
const summary = await this.coreService.indexUpdateSummaryBeforeInit(); if (await this.windowService.isFirstWindow()) {
if (summary.message) { const summary = await this.coreService.indexUpdateSummaryBeforeInit();
this.messageService.error(summary.message); 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( private async updateIndexes(
types: IndexType[], types: IndexType[],
force = false force = false
): Promise<void> { ): Promise<void> {
if (process.env.IS_LIGHT_VERSION) {
return;
}
const updatedAt = new Date().toISOString(); const updatedAt = new Date().toISOString();
return Promise.all( return Promise.all(
types.map((type) => this.needsIndexUpdate(type, updatedAt, force)) types.map((type) => this.needsIndexUpdate(type, updatedAt, force))
@@ -101,6 +112,10 @@ export class UpdateIndexes extends Contribution {
now: string, now: string,
force = false force = false
): Promise<IndexType | false> { ): Promise<IndexType | false> {
if (process.env.IS_LIGHT_VERSION) {
return false;
}
if (force) { if (force) {
console.debug( console.debug(
`[update-indexes]: Update for index type: '${type}' was forcefully requested.` `[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 { nls } from '@theia/core/lib/common/nls';
import { inject, injectable } from '@theia/core/shared/inversify'; 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 { ArduinoMenus } from '../menu/arduino-menus';
import { CurrentSketch } from '../sketches-service-client-impl'; import { CurrentSketch } from '../sketches-service-client-impl';
import { ArduinoToolbar } from '../toolbar/arduino-toolbar'; import { ArduinoToolbar } from '../toolbar/arduino-toolbar';
@@ -15,12 +15,6 @@ import {
} from './contribution'; } from './contribution';
import { CoreErrorHandler } from './core-error-handler'; 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 = 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. * 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; type VerifyProgress = 'idle' | VerifySketchMode;
@injectable() @injectable()
export class VerifySketch export class VerifySketch extends CoreServiceContribution {
extends CoreServiceContribution
implements CompileSummaryProvider
{
@inject(CoreErrorHandler) @inject(CoreErrorHandler)
private readonly coreErrorHandler: CoreErrorHandler; private readonly coreErrorHandler: CoreErrorHandler;
private readonly onDidChangeEmitter = new Emitter<void>(); private readonly onDidChangeEmitter = new Emitter<void>();
private readonly onDidChange = this.onDidChangeEmitter.event; private readonly onDidChange = this.onDidChangeEmitter.event;
private readonly onDidChangeCompileSummaryEmitter = new Emitter<
CompileSummary | undefined
>();
private verifyProgress: VerifyProgress = 'idle'; private verifyProgress: VerifyProgress = 'idle';
private _compileSummary: CompileSummary | undefined;
override registerCommands(registry: CommandRegistry): void { override registerCommands(registry: CommandRegistry): void {
registry.registerCommand(VerifySketch.Commands.VERIFY_SKETCH, { registry.registerCommand(VerifySketch.Commands.VERIFY_SKETCH, {
@@ -130,21 +117,6 @@ export class VerifySketch
super.handleError(error); 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( private async verifySketch(
params?: VerifySketchParams params?: VerifySketchParams
): Promise<CoreService.Options.Compile | undefined> { ): Promise<CoreService.Options.Compile | undefined> {
@@ -169,7 +141,7 @@ export class VerifySketch
return options; return options;
} }
const compileSummary = await this.doWithProgress({ await this.doWithProgress({
progressText: nls.localize( progressText: nls.localize(
'arduino/sketch/compile', 'arduino/sketch/compile',
'Compiling sketch...' 'Compiling sketch...'
@@ -188,9 +160,6 @@ export class VerifySketch
nls.localize('arduino/sketch/doneCompiling', 'Done compiling.'), nls.localize('arduino/sketch/doneCompiling', 'Done compiling.'),
{ timeout: 3000 } { timeout: 3000 }
); );
this.updateCompileSummary(compileSummary);
// Returns with the used options for the compilation // Returns with the used options for the compilation
// so that follow-up tasks (such as upload) can reuse the compiled code. // 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. // 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 type { ThemeMix } from '@theia/monaco/lib/browser/textmate/monaco-theme-types';
import { HostedPluginSupport } from '../../hosted/hosted-plugin-support'; import { HostedPluginSupport } from '../../hosted/hosted-plugin-support';
import { ArduinoThemes, compatibleBuiltInTheme } from '../core/theming'; import { ArduinoThemes, compatibleBuiltInTheme } from '../core/theming';
import { WindowServiceExt } from '../core/window-service-ext';
type MonacoThemeRegistrationSource = type MonacoThemeRegistrationSource =
/** /**
@@ -155,8 +156,8 @@ export class CleanupObsoleteThemes implements FrontendApplicationContribution {
private readonly themeService: ThemeService; private readonly themeService: ThemeService;
@inject(MessageService) @inject(MessageService)
private readonly messageService: MessageService; private readonly messageService: MessageService;
// @inject(WindowServiceExt) @inject(WindowServiceExt)
// private readonly windowService: WindowServiceExt; private readonly windowService: WindowServiceExt;
onStart(): void { onStart(): void {
this.hostedPlugin.didStart.then(() => this.cleanupObsoleteThemes()); this.hostedPlugin.didStart.then(() => this.cleanupObsoleteThemes());
@@ -171,7 +172,7 @@ export class CleanupObsoleteThemes implements FrontendApplicationContribution {
if (!obsoleteThemeIds.length) { if (!obsoleteThemeIds.length) {
return; return;
} }
const firstWindow = true; // await this.windowService.isFirstWindow(); const firstWindow = await this.windowService.isFirstWindow();
if (firstWindow) { if (firstWindow) {
await this.removeObsoleteThemesFromIndexedDB(obsoleteThemeIds); await this.removeObsoleteThemesFromIndexedDB(obsoleteThemeIds);
this.unregisterObsoleteThemes(obsoleteThemeIds); this.unregisterObsoleteThemes(obsoleteThemeIds);

View File

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

View File

@@ -1,10 +1,8 @@
// export const MainMenuManager = Symbol('MainMenuManager'); export const MainMenuManager = Symbol('MainMenuManager');
export class 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) * 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. * and you want to re-render it from scratch. Works for electron too.
*/ */
update() { update(): void;
console.warn('MainMenuManager.update() is not implemented');
}
} }

View File

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

View File

@@ -521,6 +521,8 @@ export class ElectronMainApplication extends TheiaElectronMainApplication {
} }
protected override async startBackend(): Promise<number> { 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. // Check if we should run everything as one process.
const noBackendFork = process.argv.indexOf('--no-cluster') !== -1; 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) // 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'; } from '../common/protocol';
import { BackendApplication } from './theia/core/backend-application'; import { BackendApplication } from './theia/core/backend-application';
import { BoardDiscovery } from './board-discovery'; 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 { ArduinoFirmwareUploaderImpl } from './arduino-firmware-uploader-impl';
import { PlotterBackendContribution } from './plotter/plotter-backend-contribution'; import { PlotterBackendContribution } from './plotter/plotter-backend-contribution';
import { ArduinoLocalizationContribution } from './i18n/arduino-localization-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)); ].forEach((name) => bindChildLogger(bind, name));
// Cloud sketchbook bindings // Cloud sketchbook bindings
bind(AuthenticationServiceImpl).toSelf().inSingletonScope(); // bind(AuthenticationServiceImpl).toSelf().inSingletonScope();
bind(AuthenticationService).toService(AuthenticationServiceImpl); // bind(AuthenticationService).toService(AuthenticationServiceImpl);
bind(BackendApplicationContribution).toService(AuthenticationServiceImpl); // bind(BackendApplicationContribution).toService(AuthenticationServiceImpl);
bind(ConnectionHandler) // bind(ConnectionHandler)
.toDynamicValue( // .toDynamicValue(
(context) => // (context) =>
new JsonRpcConnectionHandler<AuthenticationServiceClient>( // new JsonRpcConnectionHandler<AuthenticationServiceClient>(
AuthenticationServicePath, // AuthenticationServicePath,
(client) => { // (client) => {
const server = context.container.get<AuthenticationServiceImpl>( // const server = context.container.get<AuthenticationServiceImpl>(
AuthenticationServiceImpl // AuthenticationServiceImpl
); // );
server.setClient(client); // server.setClient(client);
client.onDidCloseConnection(() => server.disposeClient(client)); // client.onDidCloseConnection(() => server.disposeClient(client));
return server; // return server;
} // }
) // )
) // )
.inSingletonScope(); // .inSingletonScope();
bind(PlotterBackendContribution).toSelf().inSingletonScope(); bind(PlotterBackendContribution).toSelf().inSingletonScope();
bind(BackendApplicationContribution).toService(PlotterBackendContribution); bind(BackendApplicationContribution).toService(PlotterBackendContribution);

View File

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

View File

@@ -1,6 +1,7 @@
import { type ClientReadableStream } from '@grpc/grpc-js'; import { type ClientReadableStream } from '@grpc/grpc-js';
import { ApplicationError } from '@theia/core/lib/common/application-error'; import { ApplicationError } from '@theia/core/lib/common/application-error';
import type { CancellationToken } from '@theia/core/lib/common/cancellation'; import type { CancellationToken } from '@theia/core/lib/common/cancellation';
import { CommandService } from '@theia/core/lib/common/command';
import { import {
Disposable, Disposable,
DisposableCollection, DisposableCollection,
@@ -68,13 +69,15 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
private readonly responseService: ResponseService; private readonly responseService: ResponseService;
@inject(MonitorManager) @inject(MonitorManager)
private readonly monitorManager: MonitorManager; private readonly monitorManager: MonitorManager;
@inject(CommandService)
private readonly commandService: CommandService;
@inject(BoardDiscovery) @inject(BoardDiscovery)
private readonly boardDiscovery: BoardDiscovery; private readonly boardDiscovery: BoardDiscovery;
async compile( async compile(
options: CoreService.Options.Compile, options: CoreService.Options.Compile,
cancellationToken?: CancellationToken cancellationToken?: CancellationToken
): Promise<CompileSummary | undefined> { ): Promise<void> {
const coreClient = await this.coreClient; const coreClient = await this.coreClient;
const { client, instance } = coreClient; const { client, instance } = coreClient;
const request = this.compileRequest(options, instance); const request = this.compileRequest(options, instance);
@@ -88,7 +91,7 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
); );
const toDisposeOnFinally = new DisposableCollection(handler); const toDisposeOnFinally = new DisposableCollection(handler);
return new Promise<CompileSummary | undefined>((resolve, reject) => { return new Promise<void>((resolve, reject) => {
let hasRetried = false; let hasRetried = false;
const handleUnexpectedError = (error: Error) => { const handleUnexpectedError = (error: Error) => {
@@ -161,26 +164,50 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
call call
.on('data', handler.onData) .on('data', handler.onData)
.on('error', handleError) .on('error', handleError)
.on('end', () => { .on('end', resolve);
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);
}
});
}; };
startCompileStream(); startCompileStream();
}).finally(() => { }).finally(() => {
toDisposeOnFinally.dispose(); 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( private compileRequest(
options: CoreService.Options.Compile & { options: CoreService.Options.Compile & {
exportBinaries?: boolean; exportBinaries?: boolean;

View File

@@ -31,7 +31,6 @@ import {
UpdateArduinoState, UpdateArduinoState,
UpdateStateParams, UpdateStateParams,
} from '../../browser/contributions/update-arduino-state'; } from '../../browser/contributions/update-arduino-state';
import { CompileSummaryProvider } from '../../browser/contributions/verify-sketch';
import { NotificationCenter } from '../../browser/notification-center'; import { NotificationCenter } from '../../browser/notification-center';
import { import {
CurrentSketch, CurrentSketch,
@@ -62,12 +61,10 @@ describe('update-arduino-state', function () {
let currentSketchMock: CurrentSketch | undefined; let currentSketchMock: CurrentSketch | undefined;
let sketchDirUriMock: URI | undefined; let sketchDirUriMock: URI | undefined;
let dataDirUriMock: URI | undefined; let dataDirUriMock: URI | undefined;
let compileSummaryMock: CompileSummary | undefined;
let onCurrentSketchDidChangeEmitter: Emitter<CurrentSketch>; let onCurrentSketchDidChangeEmitter: Emitter<CurrentSketch>;
let onDataDirDidChangeEmitter: Emitter<URI | undefined>; let onDataDirDidChangeEmitter: Emitter<URI | undefined>;
let onSketchDirDidChangeEmitter: Emitter<URI | undefined>; let onSketchDirDidChangeEmitter: Emitter<URI | undefined>;
let onDataStoreDidChangeEmitter: Emitter<BoardsDataStoreChangeEvent>; let onDataStoreDidChangeEmitter: Emitter<BoardsDataStoreChangeEvent>;
let compileSummaryDidChangeEmitter: Emitter<CompileSummary | undefined>;
beforeEach(async () => { beforeEach(async () => {
toDisposeAfterEach = new DisposableCollection(); toDisposeAfterEach = new DisposableCollection();
@@ -79,18 +76,15 @@ describe('update-arduino-state', function () {
currentSketchMock = undefined; currentSketchMock = undefined;
sketchDirUriMock = undefined; sketchDirUriMock = undefined;
dataDirUriMock = undefined; dataDirUriMock = undefined;
compileSummaryMock = undefined;
onCurrentSketchDidChangeEmitter = new Emitter(); onCurrentSketchDidChangeEmitter = new Emitter();
onDataDirDidChangeEmitter = new Emitter(); onDataDirDidChangeEmitter = new Emitter();
onSketchDirDidChangeEmitter = new Emitter(); onSketchDirDidChangeEmitter = new Emitter();
onDataStoreDidChangeEmitter = new Emitter(); onDataStoreDidChangeEmitter = new Emitter();
compileSummaryDidChangeEmitter = new Emitter();
toDisposeAfterEach.pushAll([ toDisposeAfterEach.pushAll([
onCurrentSketchDidChangeEmitter, onCurrentSketchDidChangeEmitter,
onDataDirDidChangeEmitter, onDataDirDidChangeEmitter,
onSketchDirDidChangeEmitter, onSketchDirDidChangeEmitter,
onDataStoreDidChangeEmitter, onDataStoreDidChangeEmitter,
compileSummaryDidChangeEmitter,
]); ]);
const container = createContainer(); const container = createContainer();
@@ -424,8 +418,10 @@ describe('update-arduino-state', function () {
buildPlatform: undefined, buildPlatform: undefined,
buildOutputUri: 'file:///path/to/build', buildOutputUri: 'file:///path/to/build',
}; };
compileSummaryMock = summary; await commandRegistry.executeCommand(
compileSummaryDidChangeEmitter.fire(compileSummaryMock); 'arduino.languageserver.notifyBuildDidComplete',
summary
);
await wait(50); await wait(50);
const params = stateUpdateParams.filter( const params = stateUpdateParams.filter(
@@ -589,12 +585,6 @@ describe('update-arduino-state', function () {
new ContainerModule((bind, unbind, isBound, rebind) => { new ContainerModule((bind, unbind, isBound, rebind) => {
bindSketchesContribution(bind, unbind, isBound, rebind); bindSketchesContribution(bind, unbind, isBound, rebind);
bind(UpdateArduinoState).toSelf().inSingletonScope(); bind(UpdateArduinoState).toSelf().inSingletonScope();
bind(CompileSummaryProvider).toConstantValue(<CompileSummaryProvider>{
get compileSummary(): CompileSummary | undefined {
return compileSummaryMock;
},
onDidChangeCompileSummary: compileSummaryDidChangeEmitter.event,
});
rebind(BoardsService).toConstantValue(<BoardsService>{ rebind(BoardsService).toConstantValue(<BoardsService>{
getDetectedPorts() { getDetectedPorts() {
return {}; 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 { DisposableCollection } from '@theia/core/lib/common/disposable';
import { isWindows } from '@theia/core/lib/common/os'; import { isWindows } from '@theia/core/lib/common/os';
import { FileUri } from '@theia/core/lib/node/file-uri'; 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 { expect } from 'chai';
import { import {
BoardsService, BoardsService,
CompileSummary,
CoreService, CoreService,
SketchesService, SketchesService,
isCompileSummary, isCompileSummary,
@@ -35,9 +36,11 @@ describe('core-service-impl', () => {
this.timeout(testTimeout); this.timeout(testTimeout);
const coreService = container.get<CoreService>(CoreService); const coreService = container.get<CoreService>(CoreService);
const sketchesService = container.get<SketchesService>(SketchesService); const sketchesService = container.get<SketchesService>(SketchesService);
const commandService =
container.get<TestCommandRegistry>(TestCommandRegistry);
const sketch = await sketchesService.createNewSketch(); const sketch = await sketchesService.createNewSketch();
const compileSummary = await coreService.compile({ await coreService.compile({
fqbn: uno, fqbn: uno,
sketch, sketch,
optimizeForDebug: false, optimizeForDebug: false,
@@ -45,9 +48,18 @@ describe('core-service-impl', () => {
verbose: true, verbose: true,
}); });
expect(isCompileSummary(compileSummary)).to.be.true; const executedBuildDidCompleteCommands =
expect((<CompileSummary>compileSummary).buildOutputUri).to.be.not commandService.executedCommands.filter(
.undefined; ([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); const tempBuildPaths = await sketchesService.getBuildPath(sketch);
if (isWindows) { if (isWindows) {
@@ -56,7 +68,7 @@ describe('core-service-impl', () => {
expect(tempBuildPaths.length).to.be.equal(1); expect(tempBuildPaths.length).to.be.equal(1);
} }
const { buildOutputUri } = <CompileSummary>compileSummary; const { buildOutputUri } = arg;
const buildOutputPath = FileUri.fsPath(buildOutputUri).toString(); const buildOutputPath = FileUri.fsPath(buildOutputUri).toString();
expect(tempBuildPaths.includes(buildOutputPath)).to.be.true; expect(tempBuildPaths.includes(buildOutputPath)).to.be.true;
}); });
@@ -79,5 +91,35 @@ async function start(
} }
async function createContainer(): Promise<Container> { 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": { "scripts": {
"prepare": "lerna run prepare", "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:browser": "theia rebuild:browser",
"rebuild:electron": "theia rebuild:electron", "rebuild:electron": "theia rebuild:electron",
"start": "yarn --cwd ./electron-app start", "start": "yarn --cwd ./electron-app start",
@@ -54,7 +54,7 @@
"test": "lerna run test", "test": "lerna run test",
"test:slow": "lerna run test:slow", "test:slow": "lerna run test:slow",
"update:version": "node ./scripts/update-version.js", "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: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:push": "node ./scripts/i18n/transifex-push.js ./i18n/en.json",
"i18n:pull": "node ./scripts/i18n/transifex-pull.js ./i18n/", "i18n:pull": "node ./scripts/i18n/transifex-pull.js ./i18n/",
@@ -74,7 +74,6 @@
}, },
"workspaces": [ "workspaces": [
"arduino-ide-extension", "arduino-ide-extension",
"electron-app", "electron-app"
"browser-app"
] ]
} }

View File

@@ -2,11 +2,8 @@
set -e set -e
yarn install --immutable \ yarn install --immutable --network-timeout 10000000 \
&& yarn --cwd arduino-ide-extension build \ && 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 rebuild \
&& yarn --cwd electron-app build \ && yarn --cwd electron-app build \
&& yarn --cwd electron-app package && yarn --cwd electron-app package

View File

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