Skip to content

Commit 0942ef6

Browse files
author
Akos Kitta
committed
Switched from grpc to @grpc/grpc-js.
This change is required to be able to support ARM arch in the future. - Fixed the download links for armv7l Linux. - Checked in the generated code. [grpc/grpc-node#1497] - Made the code generation a manual step. - Made the `grpc-tools` dependency optional. - From now on, the serial port regex is case-insensitive. Signed-off-by: Akos Kitta <[email protected]>
1 parent 68f95ae commit 0942ef6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+26325
-172
lines changed

Diff for: .github/workflows/build.yml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
- os: windows-2016
2222
- os: ubuntu-latest
2323
- os: turin-macmini # self-hosted macOS
24+
# - os: rsora-rpi-arm # self-hosted armhf
2425
runs-on: ${{ matrix.config.os }}
2526
timeout-minutes: 30
2627
steps:

Diff for: .gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,5 @@ src-gen/
1313
yarn*.log
1414
# For the VS Code extensions used by Theia.
1515
plugins
16-
# generated JS/TS for the gRPC API
17-
arduino-ide-extension/src/node/cli-protocol
1816
# the config files for the CLI
1917
arduino-ide-extension/data/cli/config

Diff for: README.md

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ yarn
6161
```sh
6262
yarn rebuild:electron
6363
```
64-
Note: this step takes long. It completes in 4-5 minutes on a MacBook Pro, 2.9 GHz Quad-Core Intel Core i7.
6564

6665
### Start
6766
```sh

Diff for: arduino-ide-extension/package.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"node": ">=10.11.0 <12"
88
},
99
"scripts": {
10-
"prepare": "yarn download-cli && yarn generate-protocol && yarn download-ls && yarn run clean && yarn run build",
10+
"prepare": "yarn download-cli && yarn download-ls && yarn run clean && yarn run build",
1111
"clean": "rimraf lib",
1212
"download-cli": "node ./scripts/download-cli.js",
1313
"download-ls": "node ./scripts/download-ls.js",
@@ -19,6 +19,7 @@
1919
"test:watch": "mocha --watch --watch-files lib \"./lib/test/**/*.test.js\""
2020
},
2121
"dependencies": {
22+
"@grpc/grpc-js": "^1.1.1",
2223
"@theia/application-package": "next",
2324
"@theia/core": "next",
2425
"@theia/cpp": "next",
@@ -50,7 +51,6 @@
5051
"fuzzy": "^0.1.3",
5152
"glob": "^7.1.6",
5253
"google-protobuf": "^3.11.4",
53-
"grpc": "^1.24.2",
5454
"lodash.debounce": "^4.0.8",
5555
"js-yaml": "^3.13.1",
5656
"p-queue": "^5.0.0",
@@ -73,18 +73,20 @@
7373
"decompress-targz": "^4.1.1",
7474
"decompress-unzip": "^4.0.1",
7575
"download": "^7.1.0",
76-
"grpc-tools": "^1.8.0",
77-
"grpc_tools_node_protoc_ts": "^2.5.8",
76+
"grpc_tools_node_protoc_ts": "^4.1.0",
7877
"mocha": "^7.0.0",
7978
"moment": "^2.24.0",
8079
"ncp": "^2.0.0",
81-
"protoc": "1.0.4",
80+
"protoc": "^1.0.4",
8281
"shelljs": "^0.8.3",
8382
"sinon": "^9.0.1",
8483
"temp": "^0.9.1",
8584
"uuid": "^3.2.1",
8685
"yargs": "^11.1.0"
8786
},
87+
"optionalDependencies": {
88+
"grpc-tools": "^1.9.0"
89+
},
8890
"mocha": {
8991
"require": [
9092
"reflect-metadata/Reflect"

Diff for: arduino-ide-extension/scripts/download-cli.js

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
case 'win32': return 'Windows_64bit.zip';
4343
case 'linux': {
4444
switch (arch) {
45+
case 'arm': return 'Linux_ARMv7.tar.gz';
4546
case 'arm64': return 'Linux_ARM64.tar.gz';
4647
case 'x64': return 'Linux_64bit.tar.gz';
4748
default: return undefined;

Diff for: arduino-ide-extension/scripts/generate-protocol.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@
4040
shell.exit(1);
4141
}
4242

43-
const pluginExec = shell.which('grpc_tools_node_protoc_plugin');
44-
if (!pluginExec || pluginExec.code !== 0) {
45-
shell.exit(1);
46-
}
47-
const plugin = pluginExec.stdout.trim();
48-
4943
const rpc = path.join(repository, 'rpc');
5044
const out = path.join(__dirname, '..', 'src', 'node', 'cli-protocol');
5145
shell.mkdir('-p', out);
@@ -67,8 +61,7 @@
6761
// Generate JS code from the `.proto` files.
6862
if (shell.exec(`grpc_tools_node_protoc \
6963
--js_out=import_style=commonjs,binary:${out} \
70-
--grpc_out=${out} \
71-
--plugin=protoc-gen-grpc=${plugin} \
64+
--grpc_out=generate_package_definition:${out} \
7265
-I ${rpc} \
7366
${protos.join(' ')}`).code !== 0) {
7467
shell.exit(1);
@@ -77,7 +70,7 @@ ${protos.join(' ')}`).code !== 0) {
7770
// Generate the `.d.ts` files for JS.
7871
if (shell.exec(`protoc \
7972
--plugin=protoc-gen-ts=${path.resolve(__dirname, '..', 'node_modules', '.bin', `protoc-gen-ts${platform === 'win32' ? '.cmd' : ''}`)} \
80-
--ts_out=${out} \
73+
--ts_out=generate_package_definition:${out} \
8174
-I ${rpc} \
8275
${protos.join(' ')}`).code !== 0) {
8376
shell.exit(1);

Diff for: arduino-ide-extension/src/common/protocol/boards-service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export namespace Port {
142142
}
143143
if (isOSX) {
144144
// Example: `/dev/cu.usbmodem14401`
145-
if (/(tty|cu)\..*/.test(address.substring('/dev/'.length))) {
145+
if (/(tty|cu)\..*/i.test(address.substring('/dev/'.length))) {
146146
return [
147147
'/dev/cu.MALS',
148148
'/dev/cu.SOC',
@@ -152,7 +152,7 @@ export namespace Port {
152152
}
153153

154154
// Example: `/dev/ttyACM0`
155-
if (/(ttyS|ttyUSB|ttyACM|ttyAMA|rfcomm|ttyO)[0-9]{1,3}/.test(address.substring('/dev/'.length))) {
155+
if (/(ttyS|ttyUSB|ttyACM|ttyAMA|rfcomm|ttyO)[0-9]{1,3}/i.test(address.substring('/dev/'.length))) {
156156
// Default ports were `/dev/ttyS0` -> `/dev/ttyS31` on Ubuntu 16.04.2.
157157
if (address.startsWith('/dev/ttyS')) {
158158
const index = Number.parseInt(address.substring('/dev/ttyS'.length), 10);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// GENERATED CODE -- NO SERVICES IN PROTO

0 commit comments

Comments
 (0)