From e34dccdbb1cf407186f934820ddf2ef0beaae3d9 Mon Sep 17 00:00:00 2001 From: Akos Kitta Date: Wed, 26 Oct 2022 17:50:05 +0100 Subject: [PATCH] feat: build IDE2 on linux arm Ref: arduino/arduino-ide#107 Signed-off-by: Akos Kitta --- arduino-ide-extension/package.json | 4 ++-- arduino-ide-extension/scripts/download-ls.js | 6 ++++++ electron/build/template-package.json | 2 +- electron/packager/index.js | 11 ++++++----- electron/packager/package.json | 2 +- electron/packager/yarn.lock | 8 ++++---- yarn.lock | 2 +- 7 files changed, 21 insertions(+), 14 deletions(-) diff --git a/arduino-ide-extension/package.json b/arduino-ide-extension/package.json index ff404227..e3e29f9c 100644 --- a/arduino-ide-extension/package.json +++ b/arduino-ide-extension/package.json @@ -115,7 +115,7 @@ "mockdate": "^3.0.5", "moment": "^2.24.0", "protoc": "^1.0.4", - "shelljs": "^0.8.3", + "shelljs": "^0.8.5", "sinon": "^12.0.1", "sinon-chai": "^3.7.0", "typemoq": "^2.1.0", @@ -162,7 +162,7 @@ "version": "0.28.0" }, "fwuploader": { - "version": "2.2.0" + "version": "2.2.2" }, "clangd": { "version": "14.0.0" diff --git a/arduino-ide-extension/scripts/download-ls.js b/arduino-ide-extension/scripts/download-ls.js index 991dfb07..c2cb77ff 100755 --- a/arduino-ide-extension/scripts/download-ls.js +++ b/arduino-ide-extension/scripts/download-ls.js @@ -88,6 +88,12 @@ lsSuffix = 'Linux_64bit.tar.gz'; clangdSuffix = 'Linux_64bit'; break; + case 'linux-arm': + clangdExecutablePath = path.join(build, 'clangd'); + clangFormatExecutablePath = path.join(build, 'clang-format'); + lsSuffix = 'Linux_ARMv7.tar.gz'; + clangdSuffix = 'Linux_ARMv6'; // there is no ARNv7 available/ but armv7l GNU/Linux can run ARMv6 artifacts + break; case 'win32-x64': clangdExecutablePath = path.join(build, 'clangd.exe'); clangFormatExecutablePath = path.join(build, 'clang-format.exe'); diff --git a/electron/build/template-package.json b/electron/build/template-package.json index 4a1af403..90db6e3f 100644 --- a/electron/build/template-package.json +++ b/electron/build/template-package.json @@ -15,7 +15,7 @@ "electron-notarize": "^1.1.1", "is-ci": "^2.0.0", "ncp": "^2.0.0", - "shelljs": "^0.8.3" + "shelljs": "^0.8.5" }, "scripts": { "build": "yarn download:plugins && theia build --mode production && yarn patch", diff --git a/electron/packager/index.js b/electron/packager/index.js index 95223dd1..36f1bccf 100644 --- a/electron/packager/index.js +++ b/electron/packager/index.js @@ -6,9 +6,10 @@ const shell = require('shelljs'); const glob = require('glob'); const isCI = require('is-ci'); - // Note, this will crash on PI if the available memory is less than desired heap size. + // Note, this will crash on PI if the available memory is less than the desired heap size. Limit the max heap size to the 75% of the available memory. // https://github.com/shelljs/shelljs/issues/1024#issuecomment-1001552543 - shell.env.NODE_OPTIONS = '--max_old_space_size=4096'; // Increase heap size for the CI + const heapSize = Math.min(4096, (require('v8').getHeapStatistics().total_physical_size / 1024) * 0.75).toFixed(0); + shell.env.NODE_OPTIONS = `--max_old_space_size=${heapSize}`; // Increase heap size for the CI shell.env.PUPPETEER_SKIP_CHROMIUM_DOWNLOAD = 'true'; // Skip download and avoid `ERROR: Failed to download Chromium`. const template = require('./config').generateTemplate( new Date().toISOString() @@ -266,14 +267,14 @@ ${fs.readFileSync(path('..', 'build', 'package.json')).toString()} //-----------------------------------+ // Package the electron application. | //-----------------------------------+ + const arch = process.platform === 'linux' && process.arch === 'arm' ? ' --armv7l' : ''; exec( - `yarn --network-timeout 1000000 --cwd ${path('..', 'build')} package`, + `yarn --network-timeout 1000000 --cwd ${path('..', 'build')} package${arch}`, `Packaging your ${productName} application` ); //-----------------------------------------------------------------------------------------------------+ - // Recalculate artifacts hash and copy to another folder (because they can change after signing them). - // Azure does not support wildcard for `PublishBuildArtifacts@1.pathToPublish` | + // Recalculate artifacts hash and copy to another folder (because they can change after signing them). | //-----------------------------------------------------------------------------------------------------+ if (isCI) { try { diff --git a/electron/packager/package.json b/electron/packager/package.json index 3cf4e493..1809868f 100644 --- a/electron/packager/package.json +++ b/electron/packager/package.json @@ -26,7 +26,7 @@ "is-ci": "^2.0.0", "mocha": "^7.1.1", "semver": "^7.3.2", - "shelljs": "^0.8.3", + "shelljs": "^0.8.5", "sinon": "^9.0.1", "temp": "^0.9.1", "yaml": "^1.10.2", diff --git a/electron/packager/yarn.lock b/electron/packager/yarn.lock index 460fd969..ec93e0f6 100644 --- a/electron/packager/yarn.lock +++ b/electron/packager/yarn.lock @@ -1338,10 +1338,10 @@ shebang-regex@^1.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= -shelljs@^0.8.3: - version "0.8.3" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.3.tgz#a7f3319520ebf09ee81275b2368adb286659b097" - integrity sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A== +shelljs@^0.8.5: + version "0.8.5" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c" + integrity sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow== dependencies: glob "^7.0.0" interpret "^1.0.0" diff --git a/yarn.lock b/yarn.lock index 54c90a4a..f93e202b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13404,7 +13404,7 @@ shell-path@^2.1.0: dependencies: shell-env "^0.3.0" -shelljs@^0.8.3: +shelljs@^0.8.5: version "0.8.5" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c" integrity sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==