Skip to content

Commit

Permalink
Merge branch 'main' into patch/eclipse-theia/theia#14309
Browse files Browse the repository at this point in the history
  • Loading branch information
dankeboy36 committed Nov 11, 2024
2 parents 5f318d8 + 63e9dfd commit aa941ea
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 24 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ jobs:
SIGNTOOL_PATH: "C:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x86/signtool.exe"
WIN_CERT_PASSWORD: ${{ secrets.INSTALLER_CERT_WINDOWS_PASSWORD }}
WIN_CERT_CONTAINER_NAME: ${{ secrets.INSTALLER_CERT_WINDOWS_CONTAINER }}
WIN_SIGNING_ENABLED: ${{ !github.event.pull_request.head.repo.fork }}

strategy:
matrix:
config: ${{ fromJson(needs.select-targets.outputs.build-matrix) }}
Expand Down
2 changes: 1 addition & 1 deletion arduino-ide-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "arduino-ide-extension",
"version": "2.3.3",
"version": "2.3.4",
"description": "An extension for Theia building the Arduino IDE",
"license": "AGPL-3.0-or-later",
"scripts": {
Expand Down
41 changes: 22 additions & 19 deletions arduino-ide-extension/src/node/service-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ProgrammerIsRequiredForUploadError } from './cli-protocol/cc/arduino/cl
type ProtoError = typeof ProgrammerIsRequiredForUploadError;
const protoErrorsMap = new Map<string, ProtoError>([
[
'type.googleapis.com/cc.arduino.cli.commands.v1.ProgrammerIsRequiredForUploadError',
'cc.arduino.cli.commands.v1.ProgrammerIsRequiredForUploadError',
ProgrammerIsRequiredForUploadError,
],
// handle other cli defined errors here
Expand All @@ -22,30 +22,33 @@ export namespace ServiceError {
return arg instanceof Error && isStatusObject(arg);
}

export function isInstanceOf(arg: unknown, type: unknown): boolean {
export function isInstanceOf<ProtoError>(
arg: unknown,
type: new (...args: unknown[]) => ProtoError
): arg is ProtoError {
if (!isStatusObject(arg)) {
return false;
}

const bin = arg.metadata.get('grpc-status-details-bin')[0];
try {
const bin = arg.metadata.get('grpc-status-details-bin')[0];
const uint8Array =
typeof bin === 'string'
? stringToUint8Array(bin)
: new Uint8Array(bin.buffer, bin.byteOffset, bin.byteLength);

const uint8Array =
typeof bin === 'string'
? stringToUint8Array(bin)
: new Uint8Array(bin.buffer, bin.byteOffset, bin.byteLength);
const errors = Status.deserializeBinary(uint8Array)
.getDetailsList()
.map((details) => {
const typeName = details.getTypeName();
const ErrorType = protoErrorsMap.get(typeName);
return ErrorType?.deserializeBinary(details.getValue_asU8());
});

const errors = Status.deserializeBinary(uint8Array)
.getDetailsList()
.map((details) => {
const typeUrl = details.getTypeUrl();
const ErrorType = protoErrorsMap.get(typeUrl);
return ErrorType?.deserializeBinary(details.getValue_asU8());
});

return !!errors.find((error) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return error && error instanceof <any>type;
});
return !!errors.find((error) => error && error instanceof type);
} catch {
return false;
}
}

function isStatusObject(arg: unknown): arg is StatusObject {
Expand Down
1 change: 1 addition & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ This repository contains the main code, but two more repositories are included d

- To build the application, follow the Theia IDE [prerequisites](https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md#prerequisites).
- This project recommends using [Visual Studio Code (VS Code)](https://code.visualstudio.com/) for the development.
- The build system might also need to build the [Arduino CLI](https://github.com/arduino/arduino-cli), the [Arduino Language Server](https://github.com/arduino/arduino-language-server), and other tools from the sources. In this case it is also necessary to have the build prerequisites for those projects installed. For more details, refer to the Arduino CLI's [prerequisites section](https://arduino.github.io/arduino-cli/latest/CONTRIBUTING/#prerequisites).

## Build from source

Expand Down
4 changes: 2 additions & 2 deletions electron-app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "electron-app",
"version": "2.3.3",
"version": "2.3.4",
"license": "AGPL-3.0-or-later",
"main": "./src-gen/backend/electron-main.js",
"dependencies": {
Expand All @@ -19,7 +19,7 @@
"@theia/preferences": "1.41.0",
"@theia/terminal": "1.41.0",
"@theia/workspace": "1.41.0",
"arduino-ide-extension": "2.3.3"
"arduino-ide-extension": "2.3.4"
},
"devDependencies": {
"@theia/cli": "1.41.0",
Expand Down
5 changes: 4 additions & 1 deletion electron-app/scripts/windowsCustomSign.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
const childProcess = require('child_process');

exports.default = async function (configuration) {
if (!process.env.GITHUB_ACTIONS) {
if (
!process.env.GITHUB_ACTIONS ||
process.env.WIN_SIGNING_ENABLED !== 'true'
) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "arduino-ide",
"version": "2.3.3",
"version": "2.3.4",
"description": "Arduino IDE",
"repository": "https://github.com/arduino/arduino-ide.git",
"author": "Arduino SA",
Expand Down

0 comments on commit aa941ea

Please sign in to comment.