Update Theia to 1.22.1 (#791)

This commit is contained in:
Mark Sujew 2022-02-11 15:25:35 +01:00 committed by GitHub
parent 69ac1f4779
commit 112153fb96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 709 additions and 1393 deletions

View File

@ -33,16 +33,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Install Node.js 12.x
- name: Install Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: '12.14.1'
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- name: Install Python 2.7
- name: Install Python 3.x
uses: actions/setup-python@v2
with:
python-version: '2.7'
python-version: '3.x'
- name: Package
shell: bash

View File

@ -25,10 +25,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Node.js 12.x
- name: Install Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: '12.14.1'
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies

View File

@ -12,10 +12,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Install Node.js 12.x
- name: Install Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: '12.14.1'
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies

View File

@ -12,10 +12,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Install Node.js 12.x
- name: Install Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: '12.14.1'
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies

16
.vscode/launch.json vendored
View File

@ -37,6 +37,13 @@
"internalConsoleOptions": "openOnSessionStart",
"outputCapture": "std"
},
{
"type": "chrome",
"request": "attach",
"name": "Attach to Electron Frontend",
"port": 9222,
"webRoot": "${workspaceFolder}/electron-app"
},
{
"type": "node",
"request": "launch",
@ -104,5 +111,14 @@
"program": "${workspaceRoot}/electron/packager/index.js",
"cwd": "${workspaceFolder}/electron/packager"
}
],
"compounds": [
{
"name": "Launch Electron Backend & Frontend",
"configurations": [
"App (Electron)",
"Attach to Electron Frontend"
]
}
]
}

View File

@ -42,6 +42,7 @@ The _frontend_ is running as an Electron renderer process and can invoke service
If youre familiar with TypeScript, the [Theia IDE](https://theia-ide.org/), and if you want to contribute to the
project, you should be able to build the Arduino IDE locally.
Please refer to the [Theia IDE prerequisites](https://github.com/theia-ide/theia/blob/master/doc/) documentation for the setup instructions.
> **Note**: Node.js 14 must be used instead of the version 12 recommended at the link above.
Once you have all the tools installed, you can build the editor following these steps
@ -57,9 +58,7 @@ Once you have all the tools installed, you can build the editor following these
3. Rebuild the electron dependencies
```sh
cd electron-app
yarn theia rebuild:electron
cd ..
yarn rebuild:electron
```
4. Start the application

View File

@ -21,22 +21,23 @@
},
"dependencies": {
"@grpc/grpc-js": "^1.3.7",
"@theia/application-package": "1.19.0",
"@theia/core": "1.19.0",
"@theia/editor": "1.19.0",
"@theia/editor-preview": "1.19.0",
"@theia/filesystem": "1.19.0",
"@theia/git": "1.19.0",
"@theia/keymaps": "1.19.0",
"@theia/markers": "1.19.0",
"@theia/monaco": "1.19.0",
"@theia/navigator": "1.19.0",
"@theia/outline-view": "1.19.0",
"@theia/output": "1.19.0",
"@theia/preferences": "1.19.0",
"@theia/search-in-workspace": "1.19.0",
"@theia/terminal": "1.19.0",
"@theia/workspace": "1.19.0",
"@theia/application-package": "1.22.1",
"@theia/core": "1.22.1",
"@theia/editor": "1.22.1",
"@theia/editor-preview": "1.22.1",
"@theia/electron": "1.22.1",
"@theia/filesystem": "1.22.1",
"@theia/git": "1.22.1",
"@theia/keymaps": "1.22.1",
"@theia/markers": "1.22.1",
"@theia/monaco": "1.22.1",
"@theia/navigator": "1.22.1",
"@theia/outline-view": "1.22.1",
"@theia/output": "1.22.1",
"@theia/preferences": "1.22.1",
"@theia/search-in-workspace": "1.22.1",
"@theia/terminal": "1.22.1",
"@theia/workspace": "1.22.1",
"@tippyjs/react": "^4.2.5",
"@types/atob": "^2.1.2",
"@types/auth0-js": "^9.14.0",

View File

@ -1,6 +1,6 @@
import { inject, injectable, postConstruct } from 'inversify';
import * as React from 'react';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import {
BoardsService,
SketchesService,

View File

@ -1,6 +1,6 @@
import { inject, injectable } from 'inversify';
import * as moment from 'moment';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { isOSX, isWindows } from '@theia/core/lib/common/os';
import { ClipboardService } from '@theia/core/lib/browser/clipboard-service';
import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider';

View File

@ -1,5 +1,5 @@
import { inject, injectable } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { ArduinoMenus } from '../menu/arduino-menus';
import {
SketchContribution,

View File

@ -1,5 +1,5 @@
import { inject, injectable } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import URI from '@theia/core/lib/common/uri';
import { ConfirmDialog } from '@theia/core/lib/browser/dialogs';
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';

View File

@ -1,5 +1,5 @@
import { injectable } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import * as dateFormat from 'dateformat';
import URI from '@theia/core/lib/common/uri';
import { ArduinoMenus } from '../menu/arduino-menus';

View File

@ -1,5 +1,5 @@
import { inject, injectable } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { MenuModelRegistry } from '@theia/core/lib/common/menu';
import {
DisposableCollection,

View File

@ -1,6 +1,6 @@
import { inject, injectable } from 'inversify';
import { toArray } from '@phosphor/algorithm';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor';
import { EditorManager } from '@theia/editor/lib/browser/editor-manager';
import { ApplicationShell } from '@theia/core/lib/browser/shell/application-shell';

View File

@ -1,5 +1,5 @@
import { injectable } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import URI from '@theia/core/lib/common/uri';
import { ArduinoMenus } from '../menu/arduino-menus';
import {

View File

@ -1,5 +1,5 @@
import { inject, injectable } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { MaybePromise } from '@theia/core/lib/common/types';
import { Widget, ContextMenuRenderer } from '@theia/core/lib/browser';
import {

View File

@ -1,5 +1,5 @@
import { injectable } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { isOSX } from '@theia/core/lib/common/os';
import {
Contribution,

View File

@ -1,5 +1,5 @@
import { injectable } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import * as dateFormat from 'dateformat';
import { ArduinoMenus } from '../menu/arduino-menus';
import {

View File

@ -10,7 +10,7 @@ import { SerialModel } from '../serial-model';
import { ArduinoMenus } from '../../menu/arduino-menus';
import { Contribution } from '../../contributions/contribution';
import { Endpoint, FrontendApplication } from '@theia/core/lib/browser';
import { ipcRenderer } from '@theia/core/shared/electron';
import { ipcRenderer } from '@theia/electron/shared/electron';
import { SerialConfig } from '../../../common/protocol';
import { SerialConnectionManager } from '../serial-connection-manager';
import { SerialPlotter } from './protocol';

View File

@ -62,9 +62,15 @@ export class DebugSessionManager extends TheiaDebugSessionManager {
}
);
}
// TODO: remove as https://github.com/eclipse-theia/theia/issues/10164 is fixed
async terminateSessions(): Promise<void> {
await super.terminateSessions();
this.destroy(this.currentSession?.id);
async terminateSession(session?: DebugSession): Promise<void> {
if (!session) {
this.updateCurrentSession(this._currentSession);
session = this._currentSession;
}
// The cortex-debug extension does not respond to close requests
// So we simply terminate the debug session immediately
// Alternatively the `super.terminateSession` call will terminate it after 5 seconds without a response
await this.debug.terminateDebugSession(session!.id);
await super.terminateSession(session);
}
}

View File

@ -1,5 +1,5 @@
import { inject, injectable } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import URI from '@theia/core/lib/common/uri';
import { WorkspaceDeleteHandler as TheiaWorkspaceDeleteHandler } from '@theia/workspace/lib/browser/workspace-delete-handler';
import { SketchesServiceClientImpl } from '../../../common/protocol/sketches-service-client-impl';

View File

@ -18,6 +18,7 @@ import { ArduinoWorkspaceRootResolver } from '../../arduino-workspace-resolver';
import { BoardsServiceProvider } from '../../boards/boards-service-provider';
import { BoardsConfig } from '../../boards/boards-config';
import { nls } from '@theia/core/lib/common';
import { URI as VSCodeUri } from '@theia/core/shared/vscode-uri';
@injectable()
export class WorkspaceService extends TheiaWorkspaceService {
@ -67,7 +68,7 @@ export class WorkspaceService extends TheiaWorkspaceService {
this.workspaceUri = (async () => {
try {
const hash = window.location.hash;
const [recentWorkspaces, recentSketches] = await Promise.all([
const [recentWorkspacesPaths, recentSketches] = await Promise.all([
this.server.getRecentWorkspaces(),
this.sketchService
.getSketches({})
@ -75,6 +76,8 @@ export class WorkspaceService extends TheiaWorkspaceService {
SketchContainer.toArray(container).map((s) => s.uri)
),
]);
// On Dindows, `getRecentWorkspaces` returns only file paths, not URIs as expected by the `isValid` method.
const recentWorkspaces = recentWorkspacesPaths.map(e => VSCodeUri.file(e).toString());
const toOpen = await new ArduinoWorkspaceRootResolver({
isValid: this.isValid.bind(this),
}).resolve({ hash, recentWorkspaces, recentSketches });

View File

@ -1,4 +1,4 @@
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { inject, injectable } from 'inversify';
import { CommandRegistry } from '@theia/core/lib/common/command';
import { MenuModelRegistry } from '@theia/core/lib/common/menu';
@ -80,7 +80,7 @@ export class SketchbookWidgetContribution
}
onStart(): void {
this.shell.currentChanged.connect(() =>
this.shell.onDidChangeCurrentWidget(() =>
this.onCurrentWidgetChangedHandler()
);

View File

@ -1,5 +1,5 @@
import { inject, injectable, postConstruct } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
import {
ConnectionStatus,

View File

@ -1,5 +1,5 @@
import { injectable } from 'inversify';
import { remote } from 'electron';
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { isOSX } from '@theia/core/lib/common/os';
import { Keybinding } from '@theia/core/lib/common/keybinding';
import {
@ -15,7 +15,6 @@ import {
ArduinoMenus,
PlaceholderMenuNode,
} from '../../../browser/menu/arduino-menus';
import electron = require('@theia/core/shared/electron');
@injectable()
export class ElectronMainMenuFactory extends TheiaElectronMainMenuFactory {
@ -35,9 +34,9 @@ export class ElectronMainMenuFactory extends TheiaElectronMainMenuFactory {
await this.preferencesService.ready;
const createdMenuBar = this.createElectronMenuBar();
if (isOSX) {
electron.remote.Menu.setApplicationMenu(createdMenuBar);
remote.Menu.setApplicationMenu(createdMenuBar);
} else {
electron.remote.getCurrentWindow().setMenu(createdMenuBar);
remote.getCurrentWindow().setMenu(createdMenuBar);
}
}
@ -81,7 +80,7 @@ export class ElectronMainMenuFactory extends TheiaElectronMainMenuFactory {
protected createOSXMenu(): Electron.MenuItemConstructorOptions {
const { submenu } = super.createOSXMenu();
const label = 'Arduino IDE';
if (!!submenu && !(submenu instanceof remote.Menu)) {
if (!!submenu && Array.isArray(submenu)) {
const [, , /* about */ /* preferences */ ...rest] = submenu;
const about = this.fillMenuTemplate(
[],

View File

@ -1,10 +1,5 @@
import { inject, injectable } from 'inversify';
import {
app,
BrowserWindow,
BrowserWindowConstructorOptions,
screen,
} from 'electron';
import { app, BrowserWindow, BrowserWindowConstructorOptions, ipcMain, screen } from '@theia/core/electron-shared/electron';
import { fork } from 'child_process';
import { AddressInfo } from 'net';
import { join } from 'path';
@ -19,8 +14,8 @@ import {
TheiaBrowserWindowOptions,
} from '@theia/core/lib/electron-main/electron-main-application';
import { SplashServiceImpl } from '../splash/splash-service-impl';
import { ipcMain } from '@theia/core/shared/electron';
import { URI } from '@theia/core/shared/vscode-uri';
import * as electronRemoteMain from '@theia/core/electron-shared/@electron/remote/main';
app.commandLine.appendSwitch('disable-http-cache');
@ -209,6 +204,7 @@ export class ElectronMainApplication extends TheiaElectronMainApplication {
this.attachSaveWindowState(electronWindow);
this.attachGlobalShortcuts(electronWindow);
this.restoreMaximizedState(electronWindow, options);
electronRemoteMain.enable(electronWindow.webContents);
return electronWindow;
}

View File

@ -4,26 +4,26 @@
"version": "2.0.0-rc3",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@theia/core": "1.19.0",
"@theia/debug": "1.19.0",
"@theia/editor": "1.19.0",
"@theia/editor-preview": "1.19.0",
"@theia/file-search": "1.19.0",
"@theia/filesystem": "1.19.0",
"@theia/keymaps": "1.19.0",
"@theia/messages": "1.19.0",
"@theia/monaco": "1.19.0",
"@theia/navigator": "1.19.0",
"@theia/plugin-ext": "1.19.0",
"@theia/plugin-ext-vscode": "1.19.0",
"@theia/preferences": "1.19.0",
"@theia/process": "1.19.0",
"@theia/terminal": "1.19.0",
"@theia/workspace": "1.19.0",
"@theia/core": "1.22.1",
"@theia/debug": "1.22.1",
"@theia/editor": "1.22.1",
"@theia/editor-preview": "1.22.1",
"@theia/file-search": "1.22.1",
"@theia/filesystem": "1.22.1",
"@theia/keymaps": "1.22.1",
"@theia/messages": "1.22.1",
"@theia/monaco": "1.22.1",
"@theia/navigator": "1.22.1",
"@theia/plugin-ext": "1.22.1",
"@theia/plugin-ext-vscode": "1.22.1",
"@theia/preferences": "1.22.1",
"@theia/process": "1.22.1",
"@theia/terminal": "1.22.1",
"@theia/workspace": "1.22.1",
"arduino-ide-extension": "2.0.0-rc3"
},
"devDependencies": {
"@theia/cli": "1.19.0"
"@theia/cli": "1.22.1"
},
"scripts": {
"prepare": "theia build --mode development",

View File

@ -2,19 +2,18 @@
Building the Pro IDE on Linux `armv7l` (aka `armhf`) and `aarch64` (aka `arm64`):
1. Install Node.js 12.x with [nvm](https://github.com/nvm-sh/nvm#install--update-script):
1. Install Node.js 14.x with [nvm](https://github.com/nvm-sh/nvm#install--update-script):
```
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
```
Restart your shell then:
```
nvm install 12.14.1
nvm use 12.14.1
nvm install 14
nvm use 14
```
Verify:
```
node -v
v12.14.1
```
2. Install [Yarn](https://classic.yarnpkg.com/en/docs/install/#debian-stable):

View File

@ -18,9 +18,9 @@ sudo apt update \
build-essential \
&& wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash \
&& source ~/.bashrc \
&& nvm install 12.14.1 \
&& nvm use 12.14.1 \
&& nvm alias default 12.14.1 \
&& nvm install 14 \
&& nvm use 14 \
&& nvm alias default 14 \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list \
&& sudo apt update && sudo apt install --no-install-recommends yarn \

View File

@ -5,27 +5,28 @@
"license": "AGPL-3.0-or-later",
"main": "src-gen/frontend/electron-main.js",
"dependencies": {
"@theia/core": "1.19.0",
"@theia/debug": "1.19.0",
"@theia/editor": "1.19.0",
"@theia/editor-preview": "1.19.0",
"@theia/electron": "1.19.0",
"@theia/file-search": "1.19.0",
"@theia/filesystem": "1.19.0",
"@theia/keymaps": "1.19.0",
"@theia/messages": "1.19.0",
"@theia/monaco": "1.19.0",
"@theia/navigator": "1.19.0",
"@theia/plugin-ext": "1.19.0",
"@theia/plugin-ext-vscode": "1.19.0",
"@theia/preferences": "1.19.0",
"@theia/process": "1.19.0",
"@theia/terminal": "1.19.0",
"@theia/workspace": "1.19.0",
"@theia/core": "1.22.1",
"@theia/debug": "1.22.1",
"@theia/editor": "1.22.1",
"@theia/editor-preview": "1.22.1",
"@theia/electron": "1.22.1",
"@theia/file-search": "1.22.1",
"@theia/filesystem": "1.22.1",
"@theia/keymaps": "1.22.1",
"@theia/messages": "1.22.1",
"@theia/monaco": "1.22.1",
"@theia/navigator": "1.22.1",
"@theia/plugin-ext": "1.22.1",
"@theia/plugin-ext-vscode": "1.22.1",
"@theia/preferences": "1.22.1",
"@theia/process": "1.22.1",
"@theia/terminal": "1.22.1",
"@theia/workspace": "1.22.1",
"arduino-ide-extension": "2.0.0-rc3"
},
"devDependencies": {
"@theia/cli": "1.19.0"
"@theia/cli": "1.22.1",
"electron": "^15.3.5"
},
"scripts": {
"prepare": "theia build --mode development",

View File

@ -3,15 +3,17 @@
"author": "Arduino SA",
"resolutions": {
"**/fs-extra": "^4.0.3",
"electron-builder": "22.7.0"
"electron-builder": "22.10.5",
"find-git-exec": "0.0.4",
"dugite-extra": "0.1.15"
},
"dependencies": {
"node-log-rotate": "^0.1.5"
},
"devDependencies": {
"@theia/cli": "1.19.0",
"@theia/cli": "1.22.1",
"cross-env": "^7.0.2",
"electron-builder": "22.7.0",
"electron-builder": "22.10.5",
"electron-notarize": "^0.3.0",
"is-ci": "^2.0.0",
"ncp": "^2.0.0",
@ -20,13 +22,14 @@
"scripts": {
"build": "yarn download:plugins && theia build --mode development && yarn patch",
"build:publish": "yarn download:plugins && theia build --mode production && yarn patch",
"rebuild": "yarn theia rebuild:electron",
"package": "cross-env DEBUG=* && electron-builder --publish=never",
"package:publish": "cross-env DEBUG=* && electron-builder --publish=always",
"download:plugins": "theia download:plugins",
"patch": "ncp ./patch/main.js ./src-gen/backend/main.js"
},
"engines": {
"node": ">=12.14.1 <13"
"node": ">=14.0.0 <15"
},
"repository": {
"type": "git",
@ -51,6 +54,7 @@
"build": {
"productName": "Arduino IDE",
"asar": false,
"npmRebuild": false,
"directories": {
"buildResources": "resources"
},
@ -65,8 +69,7 @@
"!node_modules/@theia/**/lib/*browser/*",
"node_modules/@theia/core/lib/browser/*",
"!node_modules/@typefox/monaco-editor-core/*",
"!node_modules/oniguruma/*",
"!node_modules/onigasm/*"
"!node_modules/electron/**"
],
"extraResources": [
{

View File

@ -72,9 +72,9 @@ function getVersion() {
}
if (!isRelease) {
if (isNightly) {
version = `${version}-nightly.${timestamp()}`;
version = `${version}-nightly-${timestamp()}`;
} else {
version = `${version}-snapshot.${currentCommitish()}`;
version = `${version}-snapshot-${currentCommitish()}`;
}
if (!semver.valid(version)) {
throw new Error(`Invalid patched version: '${version}'.`);

View File

@ -178,6 +178,7 @@ ${fs.readFileSync(path('..', 'build', 'package.json')).toString()}
//-------------------------------------------------------------------------------------------+
exec(`yarn --network-timeout 1000000 --cwd ${path('..', 'build')}`, 'Installing dependencies');
exec(`yarn --network-timeout 1000000 --cwd ${path('..', 'build')} build${isElectronPublish ? ':publish' : ''}`, `Building the ${productName} application`);
exec(`yarn --network-timeout 1000000 --cwd ${path('..', 'build')} rebuild`, 'Rebuild native dependencies');
//------------------------------------------------------------------------------+
// Create a throw away dotenv file which we use to feed the builder with input. |

View File

@ -31,7 +31,7 @@
"yargs": "^12.0.5"
},
"engines": {
"node": ">=12.14.1 <13"
"node": ">=14.0.0 <15"
},
"mocha": {
"reporter": "spec",

View File

@ -7,10 +7,10 @@
"license": "AGPL-3.0-or-later",
"private": true,
"engines": {
"node": ">=12.14.1 <13"
"node": ">=14.0.0 <15"
},
"devDependencies": {
"@theia/cli": "1.19.0",
"@theia/cli": "1.22.1",
"@types/sinon": "^2.3.5",
"@types/jsdom": "^11.0.4",
"@typescript-eslint/eslint-plugin": "^4.27.0",
@ -33,6 +33,10 @@
"typescript": "^3.9.2",
"jsdom": "^11.5.1"
},
"resolutions": {
"find-git-exec": "0.0.4",
"dugite-extra": "0.1.15"
},
"scripts": {
"prepare": "cross-env THEIA_ELECTRON_SKIP_REPLACE_FFMPEG=1 lerna run prepare && yarn download:plugins",
"cleanup": "npx 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 ./browser-app/lib ./browser-app/src-gen ./browser-app/gen-webpack.config.js ./electron-app/lib ./electron-app/src-gen ./electron-app/gen-webpack.config.js",

1844
yarn.lock

File diff suppressed because it is too large Load Diff