Developers should be able to build and test desktop IDE on M1 Mac (#3194)

This commit is contained in:
Ilya Bogdanov 2022-01-10 12:18:34 +03:00 committed by GitHub
parent 178cfb0404
commit a4355876fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 330 additions and 244 deletions

View File

@ -105,7 +105,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 14.15.0
node-version: 16.13.1
- name: Install TypeScript
run: npm install -g ts-node@10.1.0
- name: Lint Rust sources
@ -126,7 +126,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 14.15.0
node-version: 16.13.1
- name: Install TypeScript
run: npm install -g ts-node@10.1.0
- name: Run tests (no WASM)
@ -147,13 +147,13 @@ jobs:
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 14.15.0
node-version: 16.13.1
- name: Install TypeScript
run: npm install -g ts-node@10.1.0
- name: Install wasm-pack (macOS)
env:
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1
WASMPACKDIR: wasm-pack-v0.9.1-x86_64-apple-darwin
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.10.2
WASMPACKDIR: wasm-pack-v0.10.2-x86_64-apple-darwin
run: |2-
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
@ -163,8 +163,8 @@ jobs:
if: startsWith(matrix.os,'macOS')
- name: Install wasm-pack (Windows)
env:
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1
WASMPACKDIR: wasm-pack-v0.9.1-x86_64-pc-windows-msvc
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.10.2
WASMPACKDIR: wasm-pack-v0.10.2-x86_64-pc-windows-msvc
run: |2-
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
@ -174,8 +174,8 @@ jobs:
if: startsWith(matrix.os,'windows')
- name: Install wasm-pack (Linux)
env:
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1
WASMPACKDIR: wasm-pack-v0.9.1-x86_64-unknown-linux-musl
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.10.2
WASMPACKDIR: wasm-pack-v0.10.2-x86_64-unknown-linux-musl
run: |2-
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
@ -201,13 +201,13 @@ jobs:
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 14.15.0
node-version: 16.13.1
- name: Install TypeScript
run: npm install -g ts-node@10.1.0
- name: Install wasm-pack (macOS)
env:
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1
WASMPACKDIR: wasm-pack-v0.9.1-x86_64-apple-darwin
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.10.2
WASMPACKDIR: wasm-pack-v0.10.2-x86_64-apple-darwin
run: |2-
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
@ -217,8 +217,8 @@ jobs:
if: startsWith(matrix.os,'macOS')
- name: Install wasm-pack (Windows)
env:
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1
WASMPACKDIR: wasm-pack-v0.9.1-x86_64-pc-windows-msvc
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.10.2
WASMPACKDIR: wasm-pack-v0.10.2-x86_64-pc-windows-msvc
run: |2-
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
@ -228,8 +228,8 @@ jobs:
if: startsWith(matrix.os,'windows')
- name: Install wasm-pack (Linux)
env:
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1
WASMPACKDIR: wasm-pack-v0.9.1-x86_64-unknown-linux-musl
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.10.2
WASMPACKDIR: wasm-pack-v0.10.2-x86_64-unknown-linux-musl
run: |2-
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
@ -274,13 +274,13 @@ jobs:
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 14.15.0
node-version: 16.13.1
- name: Install TypeScript
run: npm install -g ts-node@10.1.0
- name: Install wasm-pack (macOS)
env:
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1
WASMPACKDIR: wasm-pack-v0.9.1-x86_64-apple-darwin
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.10.2
WASMPACKDIR: wasm-pack-v0.10.2-x86_64-apple-darwin
run: |2-
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
@ -290,8 +290,8 @@ jobs:
if: startsWith(matrix.os,'macOS')
- name: Install wasm-pack (Windows)
env:
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1
WASMPACKDIR: wasm-pack-v0.9.1-x86_64-pc-windows-msvc
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.10.2
WASMPACKDIR: wasm-pack-v0.10.2-x86_64-pc-windows-msvc
run: |2-
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
@ -301,8 +301,8 @@ jobs:
if: startsWith(matrix.os,'windows')
- name: Install wasm-pack (Linux)
env:
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1
WASMPACKDIR: wasm-pack-v0.9.1-x86_64-unknown-linux-musl
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.10.2
WASMPACKDIR: wasm-pack-v0.10.2-x86_64-unknown-linux-musl
run: |2-
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .

View File

@ -52,7 +52,7 @@ application icon if built on Linux or Windows due to non-trivial icon generation
on these platforms. To develop the source code you will need the following
setup:
- **The Rust Toolchain (nightly-2021-05-12)**
- **The Rust Toolchain (nightly-2021-11-29)**
This project uses several features available only in the nightly Rust
toolchain. Please use the [the Rust toolchain installer](https://rustup.rs) to
@ -62,9 +62,9 @@ setup:
In addition, some custom CLI programs need to be installed manually:
```bash
rustup toolchain install stable # Stable toolchain required for the following tools.
cargo +stable install wasm-pack --version 0.9.1 # Install the wasm-pack toolkit.
cargo +stable install cargo-watch # To enable ./run watch utility
rustup toolchain install stable # Stable toolchain required for the following tools.
cargo +stable install wasm-pack --version 0.10.2 # Install the wasm-pack toolkit.
cargo +stable install cargo-watch # To enable ./run watch utility
```
Make sure that your `PATH` environment variable is set up correctly, so that
@ -237,11 +237,11 @@ following options:
After changing the code it's always a good idea to lint and test the code. We
have prepared several scripts which maximally automate the process:
- **Size Validation** Use `node ./run check-size` to check if the size of the
final binary did not grew too much in comparison to the previous release.
Watching the resulting binary size is one of the most important responsibility
of each contributor in order to keep the project small and suitable for
web-based usage. In case the size will exceed the limits:
- **Size Validation** Use `node ./run build` to check if the size of the final
binary did not grew too much in comparison to the previous release. Watching
the resulting binary size is one of the most important responsibility of each
contributor in order to keep the project small and suitable for web-based
usage. In case the size will exceed the limits:
- If the PR does not include any new libraries, you are allowed to increase
the limit by 10KB. In case the limit will be exceeded by more than 10KB,

View File

@ -29,7 +29,7 @@ let config = {
'compression-webpack-plugin': '^3.1.0',
'copy-webpack-plugin': '^5.1.1',
devtron: '^1.4.0',
electron: '11.1.1',
electron: '12.2.3',
'electron-builder': '^22.10.5',
'crypto-js': '4.0.0',
'electron-notarize': '1.0.0',

View File

@ -11,7 +11,7 @@ exports.default = async function notarizing(context) {
// We need to manually re-sign our build artifacts before notarisation.
// See the script for more information.
console.log(' • Performing additional signing of dependencies.')
await require('./signArchives').default()
await require('./signArchivesMacOs').default()
// Notarize the application.
const appName = context.packager.appInfo.productFilename

View File

@ -1,4 +1,4 @@
const { beforeSign } = require('./signArchives')
const { beforeSign } = require('./signArchivesMacOs')
// ================
// === Callback ===

View File

@ -19,7 +19,16 @@ const child_process = require('child_process')
const { dist } = require('../../../../../build/paths')
const { ENGINE_VERSION } = require('../../../../../build/release')
const contentRoot = path.join(dist.root, 'client', 'mac', 'Enso.app', 'Contents')
// `electron-builder`'s output directory name.
function contentDirName() {
if (process.arch == 'arm64') {
return 'mac-arm64'
} else {
return 'mac'
}
}
const contentRoot = path.join(dist.root, 'client', contentDirName(), 'Enso.app', 'Contents')
const resRoot = path.join(contentRoot, 'Resources')
const ID = '"Developer ID Application: New Byte Order Sp. z o. o. (NM77WTZJFQ)"'

View File

@ -1,9 +1,8 @@
const Copy = require('copy-webpack-plugin')
const path = require('path')
const paths = require('../../../../build/paths')
const thisPath = path.resolve(__dirname)
const root = path.resolve(thisPath, '..', '..', '..', '..')
const distPath = path.resolve(root, 'dist')
module.exports = {
entry: {
@ -12,18 +11,18 @@ module.exports = {
mode: 'production',
target: 'electron-main',
output: {
path: path.resolve(distPath, 'content'),
path: paths.dist.content,
filename: '[name].js',
},
plugins: [
new Copy([
{
from: path.resolve(thisPath, 'package.json'),
to: path.resolve(distPath, 'content', 'package.json'),
to: paths.dist.packageJson,
},
{
from: path.resolve(thisPath, 'src', 'preload.js'),
to: path.resolve(distPath, 'content', 'preload.js'),
to: paths.dist.preload,
},
]),
],

View File

@ -2,19 +2,16 @@ const CopyWebpackPlugin = require('copy-webpack-plugin')
const CompressionPlugin = require('compression-webpack-plugin')
const path = require('path')
const webpack = require('webpack')
const paths = require('../../../../build/paths')
const thisPath = path.resolve(__dirname)
const root = path.resolve(thisPath, '..', '..', '..', '..')
const distPath = path.resolve(root, 'dist')
const wasmPath = path.resolve(distPath, 'wasm')
const buildPath = path.resolve(distPath, 'build.json')
const child_process = require('child_process')
function git(command) {
return child_process.execSync(`git ${command}`, { encoding: 'utf8' }).trim()
}
const BUILD_INFO = JSON.parse(require('fs').readFileSync(buildPath, 'utf8'))
const BUILD_INFO = JSON.parse(require('fs').readFileSync(paths.dist.buildInfo, 'utf8'))
// scala-parser.js is compiled from Scala code, so no source map is available for it.
const IGNORE_SOURCE_MAPS = [/scala-parser\.js/]
@ -40,7 +37,7 @@ module.exports = {
wasm_imports: './src/wasm_imports.js',
},
output: {
path: path.resolve(root, 'dist', 'content', 'assets'),
path: paths.dist.assets,
filename: '[name].js',
libraryTarget: 'umd',
},
@ -55,7 +52,7 @@ module.exports = {
path.resolve(thisPath, 'src', 'style.css'),
path.resolve(thisPath, 'src', 'docsStyle.css'),
path.resolve(thisPath, 'assets'),
path.resolve(wasmPath, 'ide.wasm'),
paths.dist.wasm.main,
]),
new webpack.DefinePlugin({
GIT_HASH: JSON.stringify(git('rev-parse HEAD')),
@ -76,7 +73,7 @@ module.exports = {
},
resolve: {
alias: {
wasm_rust_glue$: path.resolve(wasmPath, 'ide.js'),
wasm_rust_glue$: paths.dist.wasm.glue,
},
extensions: ['.ts', '.js'],
},

View File

@ -5,7 +5,7 @@ let config = {
build: 'node src/index.js',
},
devDependencies: {
sharp: '^0.26.2',
sharp: '^0.29.3',
'to-ico': '^1.1.5',
},
}

View File

@ -14,7 +14,7 @@
"create-servers": "^3.1.0",
"crypto-js": "4.0.0",
"devtron": "^1.4.0",
"electron": "11.1.1",
"electron": "12.2.3",
"electron-builder": "^22.10.5",
"electron-is-dev": "^1.1.0",
"electron-notarize": "1.0.0",
@ -26,7 +26,7 @@
"mixpanel-browser": "2.40.1",
"mocha": "^8.2.1",
"mock-fs": "^4.13.0",
"sharp": "^0.26.2",
"sharp": "^0.29.3",
"source-map-loader": "^1.0.0",
"tar": "^6.0.5",
"to-ico": "^1.1.5",
@ -4825,12 +4825,12 @@
}
},
"node_modules/color": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz",
"integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==",
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/color/-/color-4.1.0.tgz",
"integrity": "sha512-o2rkkxyLGgYoeUy1OodXpbPAQNmlNBrirQ8ODO8QutzDiDMNdezSOZLNnusQ6pUpCQJUsaJIo9DZJKqa2HgH7A==",
"dependencies": {
"color-convert": "^1.9.3",
"color-string": "^1.6.0"
"color-convert": "^2.0.1",
"color-string": "^1.9.0"
}
},
"node_modules/color-convert": {
@ -4855,6 +4855,22 @@
"simple-swizzle": "^0.2.2"
}
},
"node_modules/color/node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dependencies": {
"color-name": "~1.1.4"
},
"engines": {
"node": ">=7.0.0"
}
},
"node_modules/color/node_modules/color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"node_modules/colors": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz",
@ -6632,13 +6648,13 @@
}
},
"node_modules/electron": {
"version": "11.1.1",
"resolved": "https://registry.npmjs.org/electron/-/electron-11.1.1.tgz",
"integrity": "sha512-tlbex3xosJgfileN6BAQRotevPRXB/wQIq48QeQ08tUJJrXwE72c8smsM/hbHx5eDgnbfJ2G3a60PmRjHU2NhA==",
"version": "12.2.3",
"resolved": "https://registry.npmjs.org/electron/-/electron-12.2.3.tgz",
"integrity": "sha512-B27c7eqx1bC5kea6An8oVhk1pShNC4VGqWarHMhD47MDtmg54KepHO5AbAvmKKZK/jWN7NTC7wyCYTDElJNtQA==",
"hasInstallScript": true,
"dependencies": {
"@electron/get": "^1.0.1",
"@types/node": "^12.0.12",
"@types/node": "^14.6.2",
"extract-zip": "^1.0.3"
},
"bin": {
@ -12296,21 +12312,46 @@
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
},
"node_modules/node-abi": {
"version": "2.30.1",
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.30.1.tgz",
"integrity": "sha512-/2D0wOQPgaUWzVSVgRMx+trKJRC2UG4SUc4oCJoXx9Uxjtp0Vy3/kt7zcbxHF8+Z/pK3UloLWzBISg72brfy1w==",
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.5.0.tgz",
"integrity": "sha512-LtHvNIBgOy5mO8mPEUtkCW/YCRWYEKshIvqhe1GHHyXEHEB5mgICyYnAcl4qan3uFeRROErKGzatFHPf6kDxWw==",
"dependencies": {
"semver": "^5.4.1"
"semver": "^7.3.5"
},
"engines": {
"node": ">=10"
}
},
"node_modules/node-abi/node_modules/lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dependencies": {
"yallist": "^4.0.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/node-abi/node_modules/semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
"dependencies": {
"lru-cache": "^6.0.0"
},
"bin": {
"semver": "bin/semver"
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/node-abi/node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
},
"node_modules/node-addon-api": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
@ -13637,9 +13678,9 @@
}
},
"node_modules/prebuild-install": {
"version": "6.1.4",
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-6.1.4.tgz",
"integrity": "sha512-Z4vpywnK1lBg+zdPCVCsKq0xO66eEV9rWo2zrROGGiRS4JtueBOdlB1FnY8lcy7JsUud/Q3ijUxyWN26Ika0vQ==",
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.0.0.tgz",
"integrity": "sha512-IvSenf33K7JcgddNz2D5w521EgO+4aMMjFt73Uk9FRzQ7P+QZPKrp7qPsDydsSwjGt3T5xRNnM1bj1zMTD5fTA==",
"dependencies": {
"detect-libc": "^1.0.3",
"expand-template": "^2.0.3",
@ -13647,11 +13688,11 @@
"minimist": "^1.2.3",
"mkdirp-classic": "^0.5.3",
"napi-build-utils": "^1.0.1",
"node-abi": "^2.21.0",
"node-abi": "^3.3.0",
"npmlog": "^4.0.1",
"pump": "^3.0.0",
"rc": "^1.2.7",
"simple-get": "^3.0.3",
"simple-get": "^4.0.0",
"tar-fs": "^2.0.0",
"tunnel-agent": "^0.6.0"
},
@ -13659,39 +13700,7 @@
"prebuild-install": "bin.js"
},
"engines": {
"node": ">=6"
}
},
"node_modules/prebuild-install/node_modules/decompress-response": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz",
"integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==",
"dependencies": {
"mimic-response": "^2.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/prebuild-install/node_modules/mimic-response": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz",
"integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==",
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/prebuild-install/node_modules/simple-get": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.0.tgz",
"integrity": "sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA==",
"dependencies": {
"decompress-response": "^4.2.0",
"once": "^1.3.1",
"simple-concat": "^1.0.0"
"node": ">=10"
}
},
"node_modules/prepend-http": {
@ -14988,34 +14997,27 @@
}
},
"node_modules/sharp": {
"version": "0.26.3",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.26.3.tgz",
"integrity": "sha512-NdEJ9S6AMr8Px0zgtFo1TJjMK/ROMU92MkDtYn2BBrDjIx3YfH9TUyGdzPC+I/L619GeYQc690Vbaxc5FPCCWg==",
"version": "0.29.3",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.29.3.tgz",
"integrity": "sha512-fKWUuOw77E4nhpyzCCJR1ayrttHoFHBT2U/kR/qEMRhvPEcluG4BKj324+SCO1e84+knXHwhJ1HHJGnUt4ElGA==",
"hasInstallScript": true,
"dependencies": {
"array-flatten": "^3.0.0",
"color": "^3.1.3",
"color": "^4.0.1",
"detect-libc": "^1.0.3",
"node-addon-api": "^3.0.2",
"npmlog": "^4.1.2",
"prebuild-install": "^6.0.0",
"semver": "^7.3.2",
"node-addon-api": "^4.2.0",
"prebuild-install": "^7.0.0",
"semver": "^7.3.5",
"simple-get": "^4.0.0",
"tar-fs": "^2.1.1",
"tunnel-agent": "^0.6.0"
},
"engines": {
"node": ">=10"
"node": ">=12.13.0"
},
"funding": {
"url": "https://opencollective.com/libvips"
}
},
"node_modules/sharp/node_modules/array-flatten": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-3.0.0.tgz",
"integrity": "sha512-zPMVc3ZYlGLNk4mpK1NzP2wg0ml9t7fUgDsayR5Y5rSzxQilzR9FGu/EH2jQOcKSAeAfWeylyW8juy3OkWRvNA=="
},
"node_modules/sharp/node_modules/lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
@ -15028,9 +15030,9 @@
}
},
"node_modules/sharp/node_modules/node-addon-api": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz",
"integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A=="
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.2.0.tgz",
"integrity": "sha512-eazsqzwG2lskuzBqCGPi7Ac2UgOoMz8JVOXVhTvvPDYhthvNpefx8jWD8Np7Gv+2Sz0FlPWZk0nJV0z598Wn8Q=="
},
"node_modules/sharp/node_modules/semver": {
"version": "7.3.5",
@ -22814,12 +22816,27 @@
}
},
"color": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz",
"integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==",
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/color/-/color-4.1.0.tgz",
"integrity": "sha512-o2rkkxyLGgYoeUy1OodXpbPAQNmlNBrirQ8ODO8QutzDiDMNdezSOZLNnusQ6pUpCQJUsaJIo9DZJKqa2HgH7A==",
"requires": {
"color-convert": "^1.9.3",
"color-string": "^1.6.0"
"color-convert": "^2.0.1",
"color-string": "^1.9.0"
},
"dependencies": {
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
}
}
},
"color-convert": {
@ -24304,12 +24321,12 @@
}
},
"electron": {
"version": "11.1.1",
"resolved": "https://registry.npmjs.org/electron/-/electron-11.1.1.tgz",
"integrity": "sha512-tlbex3xosJgfileN6BAQRotevPRXB/wQIq48QeQ08tUJJrXwE72c8smsM/hbHx5eDgnbfJ2G3a60PmRjHU2NhA==",
"version": "12.2.3",
"resolved": "https://registry.npmjs.org/electron/-/electron-12.2.3.tgz",
"integrity": "sha512-B27c7eqx1bC5kea6An8oVhk1pShNC4VGqWarHMhD47MDtmg54KepHO5AbAvmKKZK/jWN7NTC7wyCYTDElJNtQA==",
"requires": {
"@electron/get": "^1.0.1",
"@types/node": "^12.0.12",
"@types/node": "^14.6.2",
"extract-zip": "^1.0.3"
},
"dependencies": {
@ -28718,17 +28735,33 @@
}
},
"node-abi": {
"version": "2.30.1",
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.30.1.tgz",
"integrity": "sha512-/2D0wOQPgaUWzVSVgRMx+trKJRC2UG4SUc4oCJoXx9Uxjtp0Vy3/kt7zcbxHF8+Z/pK3UloLWzBISg72brfy1w==",
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.5.0.tgz",
"integrity": "sha512-LtHvNIBgOy5mO8mPEUtkCW/YCRWYEKshIvqhe1GHHyXEHEB5mgICyYnAcl4qan3uFeRROErKGzatFHPf6kDxWw==",
"requires": {
"semver": "^5.4.1"
"semver": "^7.3.5"
},
"dependencies": {
"lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"requires": {
"yallist": "^4.0.0"
}
},
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
"version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
"requires": {
"lru-cache": "^6.0.0"
}
},
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
}
}
},
@ -29800,9 +29833,9 @@
"integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs="
},
"prebuild-install": {
"version": "6.1.4",
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-6.1.4.tgz",
"integrity": "sha512-Z4vpywnK1lBg+zdPCVCsKq0xO66eEV9rWo2zrROGGiRS4JtueBOdlB1FnY8lcy7JsUud/Q3ijUxyWN26Ika0vQ==",
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.0.0.tgz",
"integrity": "sha512-IvSenf33K7JcgddNz2D5w521EgO+4aMMjFt73Uk9FRzQ7P+QZPKrp7qPsDydsSwjGt3T5xRNnM1bj1zMTD5fTA==",
"requires": {
"detect-libc": "^1.0.3",
"expand-template": "^2.0.3",
@ -29810,38 +29843,13 @@
"minimist": "^1.2.3",
"mkdirp-classic": "^0.5.3",
"napi-build-utils": "^1.0.1",
"node-abi": "^2.21.0",
"node-abi": "^3.3.0",
"npmlog": "^4.0.1",
"pump": "^3.0.0",
"rc": "^1.2.7",
"simple-get": "^3.0.3",
"simple-get": "^4.0.0",
"tar-fs": "^2.0.0",
"tunnel-agent": "^0.6.0"
},
"dependencies": {
"decompress-response": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz",
"integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==",
"requires": {
"mimic-response": "^2.0.0"
}
},
"mimic-response": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz",
"integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA=="
},
"simple-get": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.0.tgz",
"integrity": "sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA==",
"requires": {
"decompress-response": "^4.2.0",
"once": "^1.3.1",
"simple-concat": "^1.0.0"
}
}
}
},
"prepend-http": {
@ -30903,27 +30911,20 @@
}
},
"sharp": {
"version": "0.26.3",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.26.3.tgz",
"integrity": "sha512-NdEJ9S6AMr8Px0zgtFo1TJjMK/ROMU92MkDtYn2BBrDjIx3YfH9TUyGdzPC+I/L619GeYQc690Vbaxc5FPCCWg==",
"version": "0.29.3",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.29.3.tgz",
"integrity": "sha512-fKWUuOw77E4nhpyzCCJR1ayrttHoFHBT2U/kR/qEMRhvPEcluG4BKj324+SCO1e84+knXHwhJ1HHJGnUt4ElGA==",
"requires": {
"array-flatten": "^3.0.0",
"color": "^3.1.3",
"color": "^4.0.1",
"detect-libc": "^1.0.3",
"node-addon-api": "^3.0.2",
"npmlog": "^4.1.2",
"prebuild-install": "^6.0.0",
"semver": "^7.3.2",
"node-addon-api": "^4.2.0",
"prebuild-install": "^7.0.0",
"semver": "^7.3.5",
"simple-get": "^4.0.0",
"tar-fs": "^2.1.1",
"tunnel-agent": "^0.6.0"
},
"dependencies": {
"array-flatten": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-3.0.0.tgz",
"integrity": "sha512-zPMVc3ZYlGLNk4mpK1NzP2wg0ml9t7fUgDsayR5Y5rSzxQilzR9FGu/EH2jQOcKSAeAfWeylyW8juy3OkWRvNA=="
},
"lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
@ -30933,9 +30934,9 @@
}
},
"node-addon-api": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz",
"integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A=="
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.2.0.tgz",
"integrity": "sha512-eazsqzwG2lskuzBqCGPi7Ac2UgOoMz8JVOXVhTvvPDYhthvNpefx8jWD8Np7Gv+2Sz0FlPWZk0nJV0z598Wn8Q=="
},
"semver": {
"version": "7.3.5",

View File

@ -4,10 +4,8 @@
"description": "Build Scripts",
"repository": "git@github.com:enso-org/ide.git",
"dependencies": {
"fs-extra": "^10.0.0",
"glob": "^7.1.6",
"js-yaml": "4.0.0",
"ncp": "^2.0.0",
"semver": "7.3.4",
"unzipper": "^0.10.11",
"yargs": "^15.3.0"

View File

@ -22,19 +22,33 @@ paths.dist = {}
paths.dist.root = path.join(paths.root, 'dist')
paths.dist.client = path.join(paths.dist.root, 'client')
paths.dist.content = path.join(paths.dist.root, 'content')
paths.dist.assets = path.join(paths.dist.content, 'assets')
paths.dist.packageJson = path.join(paths.dist.content, 'package.json')
paths.dist.preload = path.join(paths.dist.content, 'preload.js')
paths.dist.bin = path.join(paths.dist.root, 'bin')
paths.dist.init = path.join(paths.dist.root, 'init')
paths.dist.buildInit = path.join(paths.dist.root, 'build-init')
paths.dist.buildInfo = path.join(paths.dist.root, 'build.json')
paths.dist.tmp = path.join(paths.dist.root, 'tmp')
const WASM_MAIN = 'ide.wasm'
const WASM_MAIN_RAW = 'ide_bg.wasm'
const WASM_GLUE = 'ide.js'
// Final WASM artifacts in `dist` directory.
paths.dist.wasm = {}
paths.dist.wasm.root = path.join(paths.dist.root, 'wasm')
paths.dist.wasm.main = path.join(paths.dist.wasm.root, 'ide.wasm')
paths.dist.wasm.mainRaw = path.join(paths.dist.wasm.root, 'ide_bg.wasm')
paths.dist.wasm.glue = path.join(paths.dist.wasm.root, 'ide.js')
paths.dist.wasm.mainOpt = path.join(paths.dist.wasm.root, 'ide_opt.wasm')
paths.dist.wasm.mainOptGz = path.join(paths.dist.wasm.root, 'ide_opt.wasm.gz')
paths.dist.wasm.main = path.join(paths.dist.wasm.root, WASM_MAIN)
paths.dist.wasm.mainRaw = path.join(paths.dist.wasm.root, WASM_MAIN_RAW)
paths.dist.wasm.glue = path.join(paths.dist.wasm.root, WASM_GLUE)
// Intermediate WASM artifacts.
paths.wasm = {}
paths.wasm.root = path.resolve(os.tmpdir(), 'enso-wasm')
paths.wasm.main = path.join(paths.wasm.root, WASM_MAIN)
paths.wasm.mainRaw = path.join(paths.wasm.root, WASM_MAIN_RAW)
paths.wasm.glue = path.join(paths.wasm.root, WASM_GLUE)
paths.wasm.mainGz = path.join(paths.wasm.root, 'ide.wasm.gz')
paths.ide_desktop = {}
paths.ide_desktop.lib = {}

View File

@ -1,11 +1,9 @@
const child_process = require('child_process')
const cmd = require('./cmd')
const fs = require('fs').promises
const fse = require('fs-extra')
const fss = require('fs')
const unzipper = require('unzipper')
const glob = require('glob')
const ncp = require('ncp').ncp
const os = require('os')
const path = require('path')
const paths = require('./paths')
@ -46,22 +44,11 @@ let targetArgs = undefined
async function gzip(input, output) {
const gzip = zlib.createGzip()
const source = fss.createReadStream(input)
await fs.mkdir(path.dirname(output), { recursive: true })
const destination = fss.createWriteStream(output)
await pipe(source, gzip, destination)
}
/// Copy files and directories.
async function copy(src, tgt) {
return new Promise((resolve, reject) => {
ncp(src, tgt, err => {
if (err) {
reject(`${err}`)
}
resolve()
})
})
}
/// Run the command with the provided args and all args passed to this script after the `--` symbol.
async function run_cargo(command, args) {
await cmd.run(command, args.concat(cargoArgs))
@ -185,6 +172,12 @@ commands.build.js = async function () {
await run('npm', ['run', 'build'])
}
// We build WASM binaries from Rust code using `wasm-pack`. Intermediate temporary directory is used
// before final copy to the Webpack's `dist` location because of two reasons:
// 1. Webpack triggers recompilation on file changes, and we don't want to bother it until the final
// binaries are ready to use.
// 2. `wasm-pack` clears its output directory before compilation, which breaks Webpack because of
// missing files.
commands.build.rust = async function (argv) {
let crate = argv.crate || DEFAULT_CRATE
let crate_sfx = crate ? ` '${crate}'` : ``
@ -195,11 +188,12 @@ commands.build.rust = async function (argv) {
'--target',
'web',
'--out-dir',
paths.dist.wasm.root,
paths.wasm.root,
'--out-name',
'ide',
crate,
]
if (argv.dev) {
args.push('--dev')
}
@ -220,23 +214,26 @@ commands.build.rust = async function (argv) {
set_performance_logging_env(argv)
await run_cargo('wasm-pack', args)
await patch_file(paths.dist.wasm.glue, js_workaround_patcher)
await fs.rename(paths.dist.wasm.mainRaw, paths.dist.wasm.main)
await patch_file(paths.wasm.glue, js_workaround_patcher)
await fs.rename(paths.wasm.mainRaw, paths.wasm.main)
if (!argv.dev) {
// TODO: Enable after updating wasm-pack
// https://github.com/rustwasm/wasm-pack/issues/696
// console.log('Optimizing the WASM binary.')
// await cmd.run('npx',['wasm-opt','-O3','-o',paths.dist.wasm.mainOpt,paths.dist.wasm.main])
console.log('Minimizing the WASM binary.')
await gzip(paths.dist.wasm.main, paths.dist.wasm.mainOptGz) // TODO main -> mainOpt
await gzip(paths.wasm.main, paths.wasm.mainGz)
console.log('Checking the resulting WASM size.')
let stats = fss.statSync(paths.dist.wasm.mainOptGz)
let limit = 4.6
let size = Math.round((100 * stats.size) / 1024 / 1024) / 100
if (size > limit) {
throw `Output file size exceeds the limit (${size}MB > ${limit}MB).`
}
const limitMb = 4.6
await checkWasmSize(paths.wasm.mainGz, limitMb)
}
// Copy WASM files from temporary directory to Webpack's `dist` directory.
await fs.cp(paths.wasm.root, paths.dist.wasm.root, { recursive: true })
}
// Check if compressed WASM binary exceeds the size limit.
async function checkWasmSize(path, limitMb) {
console.log('Checking the resulting WASM size.')
let stats = fss.statSync(path)
let size = Math.round((100 * stats.size) / 1024 / 1024) / 100
if (size > limitMb) {
throw `Output file size exceeds the limit (${size}MB > ${limitMb}MB).`
}
}
@ -362,12 +359,15 @@ commands.watch.common = async function (argv) {
build_args.push(`--crate=${argv.crate}`)
}
build_args = build_args.join(' ')
const target =
const shellCommand =
'"' +
`node ${paths.script.main} build --skip-version-validation --no-js --dev ${build_args} -- ` +
cargoArgs.join(' ') +
'"'
let args = ['watch', '-s', `${target}`]
// We ignore changes in README.md because `wasm-pack` copies it, which triggers `cargo watch`
// because of this bug: https://github.com/notify-rs/notify/issues/259
const ignore = ['--ignore', 'README.md']
let args = new Array().concat('watch', ignore, '-s', `${shellCommand}`)
return cmd.run('cargo', args)
})
const js_process = cmd.with_cwd(paths.ide_desktop.root, async () => {
@ -602,8 +602,8 @@ async function downloadJsAssets() {
const assetsArchive = await unzipper.Open.file(path.join(workdir, ideAssetsMainZip))
await assetsArchive.extract({ path: workdir })
await fse.copy(unzippedAssets, jsLibAssets)
await fse.remove(workdir)
await fs.cp(unzippedAssets, jsLibAssets, { recursive: true })
await fs.rm(workdir, { recursive: true, force: true })
}
async function runCommand(command, argv) {

View File

@ -11,8 +11,8 @@ const yaml = require('js-yaml')
// === Constants ===
// =================
const NODE_VERSION = '14.15.0'
const WASM_PACK_VERSION = '0.9.1'
const NODE_VERSION = '16.13.1'
const WASM_PACK_VERSION = '0.10.2'
const FLAG_NO_CHANGELOG_NEEDED = '[ci no changelog needed]'
const FLAG_FORCE_CI_BUILD = '[ci build]'

View File

@ -131,12 +131,14 @@ The following operating systems are supported for developing Enso:
- macOS 10.14 and above
- Linux 4.4 and above
Currently only the x86_64 (amd64) architecture is supported. You may be able to
develop Enso on other systems, but issues arising from unsupported
configurations will not be fixed by the core team.
Currently we support `x86_64` (all mentioned OS) and `arm64` (Mac only)
architectures. You may be able to develop Enso on other systems, but issues
arising from unsupported configurations will not be fixed by the core team.
In order to build and run Enso you will need the following tools:
- [NodeJS](https://nodejs.org/) with the latest LTS version. We recommend using
[`nvm`](https://github.com/nvm-sh/nvm) for managing NodeJS installation.
- [sbt](https://www.scala-sbt.org/) with the same version as specified in
[`project/build.properties`](../project/build.properties).
- [Maven](https://maven.apache.org/) with version at least 3.6.3.
@ -146,8 +148,6 @@ In order to build and run Enso you will need the following tools:
for the same Java version as specified in [`build.sbt`](../build.sbt).
- [Flatbuffers Compiler](https://google.github.io/flatbuffers) with version
1.12.0.
- [Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html),
the rust build tool.
- [Rustup](https://rustup.rs), the rust toolchain management utility.
- On MacOS and Linux, the `tar` command is required for running some tests. It
should be installed by default on most distributions.
@ -158,8 +158,14 @@ In order to build and run Enso you will need the following tools:
need to configure the Developer Command Prompt for Microsoft Visual C++ for
the x64 architecture.
Managing multiple JVM installations can be a pain, so some of the team use
[Jenv](http://www.jenv.be/): A useful tool for managing multiple JVMs.
Managing multiple JVM installations can be a pain, so you can consider using
helper tools for that. We recommend:
- [Jenv](http://www.jenv.be/)
- or [sdkman](https://sdkman.io/)
**For users of M1 Mac**: installing GraalVM on M1 Mac requires manual actions,
please refer to a [dedicated documentation](./graalvm-m1-mac.md).
The flatbuffers `flatc` compiler can be installed from the following locations:
@ -197,11 +203,6 @@ defined by [rust-toolchain](../rust-toolchain.toml) override file. The `rustup`
will automatically download the appropriate compiler version along with the
necessary components.
You will also need `node` in order to run the `wasm` tests. We only support the
latest LTS version of [NodeJS](https://nodejs.org/en/download) and NPM. We
recommend using [`nvm`](https://github.com/nvm-sh/nvm) to manage node versions.
The current LTS is `v14.16.1.
### Getting Set Up (JVM)
In order to properly build the `runtime` component, the JVM running SBT needs to
@ -478,8 +479,8 @@ in our issue tracker and we will get back to you as soon as possible.
### Testing Enso
Running the tests for the JVM enso components is as simple as running
`sbt / test`. To test the Rust components you can run `cargo test`. Finally, you
can run the WASM tests for the rust components by using `./run --test-wasm`.
`sbt / test`. To test the Rust components you can run `./run test`. Finally, you
can run the WASM tests for the rust components by using `./run test --wasm`.
#### Testing Enso Libraries

54
docs/graalvm-m1-mac.md Normal file
View File

@ -0,0 +1,54 @@
## Installing GraalVM on M1 Mac
This guide describes how to setup the specific version of GraalVM on M1 Mac
using [`sdkman`](https://sdkman.io/).
To install GraalVM on any other platform, you can use
```
$ sdk install java 21.1.0.r11-grl
```
However, on M1 Macs this won't work, and you need to perform manual actions
described below.
If you are not using `sdkman`, skip the sections marked with `(Optional)`.
#### (Optional) Install sdkman
```
$ curl -s "https://get.sdkman.io" | bash
$ source "$HOME/.sdkman/bin/sdkman-init.sh"
```
You'll want to add `source "$HOME/.sdkman/bin/sdkman-init.sh"` to the end of
your `.profile` here as well.
#### Find out what version you need
Please see variables `graalVersion` and `javaVersion` in
[`build.sbt`](../build.sbt) file. You'll need the GraalVM with the exact same
version and Java version. Currently, it would be version `21.1.0` with Java 11.
#### Install GraalVM
Go to [https://github.com/graalvm/graalvm-ce-builds]() and download the release
tarball. Unpack it and install into the system directory:
```
$ tar xzf graalvm-ee-java11-darwin-amd64-21.1.0.tar.gz
$ sudo mv graalvm-ee-java11-21.1.0 /Library/Java/JavaVirtualMachines
```
If you use MacOS Catalina or later, you need to unquarantine it:
```
$ sudo xattr -r -d com.apple.quarantine /Library/Java/JavaVirtualMachines/ graalvm-ee-java11-21.1.0
```
#### (Optional) Add installed JVM to sdkman
```
$ sdk install java 21.1.0.r11-grl /Library/Java/JavaVirtualMachines/graalvm-ee-java11-21.1.0/Contents/Home
$ sdk default java 21.1.0.r11-grl
```

13
run
View File

@ -2,6 +2,8 @@
const cmd = require('./build/cmd')
const fs = require('fs').promises
const path = require('path')
const os = require('os')
const fss = require('fs')
const paths = require('./build/paths')
@ -36,7 +38,18 @@ async function init () {
}
}
// Check the location of the repository root. It must not be located at `~/enso`, as this directory
// is used by project manager to store Enso's projects.
function throwIfInvalidRootLocation() {
let rootPath = path.resolve(__dirname)
let homeDir = os.homedir()
if (rootPath == path.resolve(homeDir, 'enso')) {
throw '~/enso location cannot be used as a repository root, please use a different location'
}
}
async function main() {
throwIfInvalidRootLocation()
await init()
cmd.run('node',[paths.script.run].concat(args))
}