mirror of
https://github.com/enso-org/enso.git
synced 2024-08-17 17:00:27 +03:00
New IDE build script (#3466)
This commit is contained in:
parent
ff7700ebb1
commit
14a01c4635
@ -1,6 +1,6 @@
|
||||
[build]
|
||||
target-dir = "target/rust/"
|
||||
rustflags = []
|
||||
rustflags = ["--cfg", "tokio_unstable"]
|
||||
|
||||
[target.wasm32-unknown-unknown]
|
||||
rustflags = [
|
||||
|
10
.github/PULL_REQUEST_TEMPLATE.md
vendored
10
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -17,7 +17,13 @@
|
||||
Please include the following checklist in your PR:
|
||||
|
||||
- [ ] The documentation has been updated if necessary.
|
||||
- [ ] All code conforms to the [Scala](https://github.com/enso-org/enso/blob/develop/docs/style-guide/scala.md), [Java](https://github.com/enso-org/enso/blob/develop/docs/style-guide/java.md), and [Rust](https://github.com/enso-org/enso/blob/develop/docs/style-guide/rust.md) style guides.
|
||||
- [ ] All code conforms to the
|
||||
[Scala](https://github.com/enso-org/enso/blob/develop/docs/style-guide/scala.md),
|
||||
[Java](https://github.com/enso-org/enso/blob/develop/docs/style-guide/java.md),
|
||||
and
|
||||
[Rust](https://github.com/enso-org/enso/blob/develop/docs/style-guide/rust.md)
|
||||
style guides.
|
||||
- All code has been tested:
|
||||
- [ ] Unit tests have been written where possible.
|
||||
- [ ] If GUI codebase was changed: Enso GUI was tested when built using BOTH `./run dist` and `./run watch`.
|
||||
- [ ] If GUI codebase was changed: Enso GUI was tested when built using BOTH
|
||||
`./run.sh ide dist` and `./run.sh ide watch`.
|
||||
|
95
.github/workflows/codeql-analysis.yml
vendored
95
.github/workflows/codeql-analysis.yml
vendored
@ -1,95 +0,0 @@
|
||||
name: "CodeQL"
|
||||
|
||||
# CodeQL is temporarily disabled because it seems that it is unable to discover
|
||||
# code compiled with SBT.
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- "**"
|
||||
# branches:
|
||||
# - main
|
||||
# - "release/*"
|
||||
pull_request:
|
||||
branches-ignore:
|
||||
- "**"
|
||||
# branches:
|
||||
# - "*"
|
||||
|
||||
env:
|
||||
# Please ensure that this is in sync with graalVersion in build.sbt
|
||||
graalVersion: 21.3.0
|
||||
# Please ensure that this is in sync with javaVersion in build.sbt
|
||||
javaVersion: 11
|
||||
# Please ensure that this is in sync with project/build.properties
|
||||
sbtVersion: 1.5.2
|
||||
# Please ensure that this is in sync with rustVersion in build.sbt
|
||||
rustToolchain: nightly-2021-11-29
|
||||
|
||||
jobs:
|
||||
vuln-scan:
|
||||
name: Vulnerability Scan
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
# We must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head.
|
||||
fetch-depth: 2
|
||||
|
||||
# If this run was triggered by a pull request event, then checkout
|
||||
# the head of the pull request instead of the merge commit.
|
||||
- run: git checkout HEAD^2
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
languages: java
|
||||
|
||||
# Set Up Environment
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1.0.6
|
||||
with:
|
||||
toolchain: ${{ env.rustToolchain }}
|
||||
override: true
|
||||
- name: Setup conda
|
||||
uses: s-weigand/setup-conda@v1.0.5
|
||||
with:
|
||||
update-conda: false
|
||||
conda-channels: anaconda, conda-forge
|
||||
- name: Install FlatBuffers Compiler
|
||||
run: conda install --freeze-installed flatbuffers=1.12.0
|
||||
- name: Setup GraalVM Environment
|
||||
uses: ayltai/setup-graalvm@v1
|
||||
with:
|
||||
graalvm-version: ${{ env.graalVersion }}
|
||||
java-version: ${{ env.javaVersion }}
|
||||
- name: Set Up SBT
|
||||
run: |
|
||||
curl --retry 4 --retry-connrefused -fsSL -o sbt.tgz https://github.com/sbt/sbt/releases/download/v${{env.sbtVersion}}/sbt-${{env.sbtVersion}}.tgz
|
||||
tar -xzf sbt.tgz
|
||||
echo $GITHUB_WORKSPACE/sbt/bin/ >> $GITHUB_PATH
|
||||
|
||||
# Caches
|
||||
- name: Cache SBT
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.sbt
|
||||
~/.ivy2/cache
|
||||
~/.cache
|
||||
key: ${{ runner.os }}-sbt-${{ hashFiles('**build.sbt') }}
|
||||
restore-keys: ${{ runner.os }}-sbt-
|
||||
|
||||
# Build
|
||||
- name: Bootstrap Enso project
|
||||
run: sbt --no-colors bootstrap
|
||||
- name: Build Enso
|
||||
run: sbt --no-colors compile
|
||||
|
||||
# Analyse the Code
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
873
.github/workflows/gui.yml
vendored
873
.github/workflows/gui.yml
vendored
@ -1,7 +1,4 @@
|
||||
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
# DO NOT CHANGE THIS FILE. IT WAS GENERATED FROM 'build/workflow.js'. READ DOCS THERE TO LEARN MORE.
|
||||
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
---
|
||||
name: GUI CI
|
||||
"on":
|
||||
push:
|
||||
@ -12,490 +9,416 @@ name: GUI CI
|
||||
pull_request: {}
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
info:
|
||||
name: Build Info
|
||||
runs-on: ${{ matrix.runner }}
|
||||
strategy:
|
||||
matrix:
|
||||
runner:
|
||||
- - macOS-latest
|
||||
fail-fast: false
|
||||
ide-ci-actions-workflow-definition-job-native-test-linux:
|
||||
name: Native GUI tests (linux)
|
||||
runs-on:
|
||||
- self-hosted
|
||||
- Linux
|
||||
- engine
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Setup conda (GH runners only)
|
||||
uses: s-weigand/setup-conda@v1.0.5
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
update-conda: false
|
||||
conda-channels: "anaconda, conda-forge"
|
||||
- name: Installing wasm-pack
|
||||
uses: jetli/wasm-pack-action@v0.3.0
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
version: latest
|
||||
- name: Setup the Artifact API environment
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: "core.exportVariable(\"ACTIONS_RUNTIME_TOKEN\", process.env[\"ACTIONS_RUNTIME_TOKEN\"])\ncore.exportVariable(\"ACTIONS_RUNTIME_URL\", process.env[\"ACTIONS_RUNTIME_URL\"])\ncore.exportVariable(\"GITHUB_RETENTION_DAYS\", process.env[\"GITHUB_RETENTION_DAYS\"])"
|
||||
- name: Checking out the repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
clean: false
|
||||
- name: Dump GitHub context
|
||||
env:
|
||||
GITHUB_CONTEXT: ${{ toJson(github) }}
|
||||
run: echo "$GITHUB_CONTEXT"
|
||||
version_assertions:
|
||||
name: Assertions
|
||||
runs-on: ${{ matrix.runner }}
|
||||
strategy:
|
||||
matrix:
|
||||
runner:
|
||||
- - macOS-latest
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
clean: false
|
||||
- name: Read changelog info
|
||||
id: changelog
|
||||
run: |2-
|
||||
|
||||
node ./run ci-gen --skip-version-validation
|
||||
content=`cat CURRENT_RELEASE_CHANGELOG.json`
|
||||
echo "::set-output name=content::$content"
|
||||
- run: "./run.sh --help"
|
||||
shell: bash
|
||||
- name: Assert Version Unstable
|
||||
run: node ./run assert-version-unstable --skip-version-validation
|
||||
if: github.ref == 'refs/heads/unstable' || github.base_ref == 'unstable'
|
||||
- name: Assert Version Stable
|
||||
run: node ./run assert-version-stable --skip-version-validation
|
||||
if: github.ref == 'refs/heads/stable' || github.base_ref == 'stable'
|
||||
- id: checkCurrentReleaseTag
|
||||
uses: mukunku/tag-exists-action@v1.0.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag: v${{fromJson(steps.changelog.outputs.content).version}}
|
||||
- name: Fail if release already exists
|
||||
run: >-
|
||||
if [[ ${{ steps.checkCurrentReleaseTag.outputs.exists }} == true ]];
|
||||
then exit 1; fi
|
||||
if: github.base_ref == 'unstable' || github.base_ref == 'stable'
|
||||
- name: Get list of changed files
|
||||
id: changed_files
|
||||
run: |2-
|
||||
|
||||
list=`git diff --name-only origin/${{github.base_ref}} HEAD | tr '\n' ' '`
|
||||
echo $list
|
||||
echo "::set-output name=list::'$list'"
|
||||
- run: "./run.sh wasm test --no-wasm"
|
||||
shell: bash
|
||||
if: >-
|
||||
github.base_ref == 'develop' || github.base_ref == 'unstable' ||
|
||||
github.base_ref == 'stable'
|
||||
- name: Assert if CHANGELOG.md was updated (on pull request)
|
||||
run: >-
|
||||
if [[ ${{ contains(steps.changed_files.outputs.list,'CHANGELOG.md') ||
|
||||
contains(github.event.head_commit.message,'[ci no changelog needed]')
|
||||
|| contains(github.event.pull_request.body,'[ci no changelog needed]')
|
||||
}} == false ]]; then exit 1; fi
|
||||
if: >-
|
||||
github.base_ref == 'develop' || github.base_ref == 'unstable' ||
|
||||
github.base_ref == 'stable'
|
||||
- name: Fail if squash commit to the 'unstable' or the 'stable' branch.
|
||||
run: >-
|
||||
if [[ "${{ github.base_ref }}" == "unstable" || "${{ github.base_ref
|
||||
}}" == "stable" ]]; then exit 1; fi
|
||||
lint:
|
||||
name: Linter
|
||||
runs-on: ${{ matrix.runner }}
|
||||
strategy:
|
||||
matrix:
|
||||
runner:
|
||||
- - Linux
|
||||
- linter
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
clean: false
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 16.13.1
|
||||
- name: Install TypeScript
|
||||
run: npm install -g ts-node@10.1.0
|
||||
- name: Lint Rust sources
|
||||
run: node ./run lint --skip-version-validation
|
||||
test:
|
||||
name: Native Tests
|
||||
runs-on: ${{ matrix.runner }}
|
||||
strategy:
|
||||
matrix:
|
||||
runner:
|
||||
- - Linux
|
||||
- test_native
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
clean: false
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 16.13.1
|
||||
- name: Install TypeScript
|
||||
run: npm install -g ts-node@10.1.0
|
||||
- name: Run tests (no WASM)
|
||||
run: node ./run test --no-wasm --skip-version-validation
|
||||
wasm-test:
|
||||
name: WASM Tests
|
||||
runs-on: ${{ matrix.runner }}
|
||||
strategy:
|
||||
matrix:
|
||||
runner:
|
||||
- - Linux
|
||||
- test_wasm
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
clean: false
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
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.10.2
|
||||
WASMPACKDIR: wasm-pack-v0.10.2-x86_64-apple-darwin
|
||||
run: |2-
|
||||
|
||||
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
|
||||
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
|
||||
rm -r $WASMPACKDIR
|
||||
shell: bash
|
||||
if: startsWith(matrix.os,'macOS')
|
||||
- name: Install wasm-pack (Windows)
|
||||
env:
|
||||
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 .
|
||||
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
|
||||
rm -r $WASMPACKDIR
|
||||
shell: bash
|
||||
if: startsWith(matrix.os,'windows')
|
||||
- name: Install wasm-pack (Linux)
|
||||
env:
|
||||
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 .
|
||||
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
|
||||
rm -r $WASMPACKDIR
|
||||
shell: bash
|
||||
if: startsWith(matrix.os,'ubuntu')
|
||||
- name: Run tests (WASM)
|
||||
run: node ./run test --no-native --skip-version-validation
|
||||
build_wasm:
|
||||
name: Build WASM
|
||||
runs-on: ${{ matrix.runner }}
|
||||
strategy:
|
||||
matrix:
|
||||
runner:
|
||||
- - Linux
|
||||
- build_wasm
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
clean: false
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
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.10.2
|
||||
WASMPACKDIR: wasm-pack-v0.10.2-x86_64-apple-darwin
|
||||
run: |2-
|
||||
|
||||
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
|
||||
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
|
||||
rm -r $WASMPACKDIR
|
||||
shell: bash
|
||||
if: startsWith(matrix.os,'macOS')
|
||||
- name: Install wasm-pack (Windows)
|
||||
env:
|
||||
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 .
|
||||
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
|
||||
rm -r $WASMPACKDIR
|
||||
shell: bash
|
||||
if: startsWith(matrix.os,'windows')
|
||||
- name: Install wasm-pack (Linux)
|
||||
env:
|
||||
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 .
|
||||
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
|
||||
rm -r $WASMPACKDIR
|
||||
shell: bash
|
||||
if: startsWith(matrix.os,'ubuntu')
|
||||
- uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: adopt
|
||||
java-version: "11"
|
||||
- name: Build WASM
|
||||
run: node ./run build --no-js --skip-version-validation
|
||||
- name: Upload IDE WASM artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ide-wasm
|
||||
path: dist/wasm
|
||||
package:
|
||||
name: Build package
|
||||
runs-on: ${{ matrix.runner }}
|
||||
strategy:
|
||||
matrix:
|
||||
runner:
|
||||
- - macOS-latest
|
||||
- - windows-latest
|
||||
- - Linux
|
||||
- package
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
clean: false
|
||||
- name: Read changelog info
|
||||
id: changelog
|
||||
run: |2-
|
||||
|
||||
node ./run ci-gen --skip-version-validation
|
||||
content=`cat CURRENT_RELEASE_CHANGELOG.json`
|
||||
echo "::set-output name=content::$content"
|
||||
shell: bash
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
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.10.2
|
||||
WASMPACKDIR: wasm-pack-v0.10.2-x86_64-apple-darwin
|
||||
run: |2-
|
||||
|
||||
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
|
||||
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
|
||||
rm -r $WASMPACKDIR
|
||||
shell: bash
|
||||
if: startsWith(matrix.os,'macOS')
|
||||
- name: Install wasm-pack (Windows)
|
||||
env:
|
||||
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 .
|
||||
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
|
||||
rm -r $WASMPACKDIR
|
||||
shell: bash
|
||||
if: startsWith(matrix.os,'windows')
|
||||
- name: Install wasm-pack (Linux)
|
||||
env:
|
||||
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 .
|
||||
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
|
||||
rm -r $WASMPACKDIR
|
||||
shell: bash
|
||||
if: startsWith(matrix.os,'ubuntu')
|
||||
- uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: adopt
|
||||
java-version: "11"
|
||||
- name: Download IDE WASM artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: ide-wasm
|
||||
path: dist/wasm
|
||||
- name: Build Package
|
||||
run: node ./run dist --no-rust --skip-version-validation
|
||||
shell: bash
|
||||
env:
|
||||
CSC_LINK: ${{secrets.APPLE_CODE_SIGNING_CERT}}
|
||||
CSC_KEY_PASSWORD: ${{secrets.APPLE_CODE_SIGNING_CERT_PASSWORD}}
|
||||
CSC_IDENTITY_AUTO_DISCOVERY: true
|
||||
APPLEID: ${{secrets.APPLE_NOTARIZATION_USERNAME}}
|
||||
APPLEIDPASS: ${{secrets.APPLE_NOTARIZATION_PASSWORD}}
|
||||
FIREBASE_API_KEY: ${{secrets.FIREBASE_API_KEY}}
|
||||
- name: Upload Content Artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: content
|
||||
path: dist/content
|
||||
if: runner.os == 'Linux'
|
||||
- name: Upload Artifacts (macOS, dmg)
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: enso-mac-${{fromJson(steps.changelog.outputs.content).version}}.dmg
|
||||
path: >-
|
||||
dist/client/enso-mac-${{fromJson(steps.changelog.outputs.content).version}}.dmg
|
||||
if: runner.os == 'macOS'
|
||||
- name: Upload Artifacts (macOS, dmg.sha256)
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: >-
|
||||
enso-mac-${{fromJson(steps.changelog.outputs.content).version}}.dmg.sha256
|
||||
path: >-
|
||||
dist/client/enso-mac-${{fromJson(steps.changelog.outputs.content).version}}.dmg.sha256
|
||||
if: runner.os == 'macOS'
|
||||
- name: Upload Artifacts (Windows, exe)
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: enso-win-${{fromJson(steps.changelog.outputs.content).version}}.exe
|
||||
path: >-
|
||||
dist/client/enso-win-${{fromJson(steps.changelog.outputs.content).version}}.exe
|
||||
if: runner.os == 'Windows'
|
||||
- name: Upload Artifacts (Windows, exe.sha256)
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: >-
|
||||
enso-win-${{fromJson(steps.changelog.outputs.content).version}}.exe.sha256
|
||||
path: >-
|
||||
dist/client/enso-win-${{fromJson(steps.changelog.outputs.content).version}}.exe.sha256
|
||||
if: runner.os == 'Windows'
|
||||
- name: Upload Artifacts (Linux, AppImage)
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: >-
|
||||
enso-linux-${{fromJson(steps.changelog.outputs.content).version}}.AppImage
|
||||
path: >-
|
||||
dist/client/enso-linux-${{fromJson(steps.changelog.outputs.content).version}}.AppImage
|
||||
if: runner.os == 'Linux'
|
||||
- name: Upload Artifacts (Linux, AppImage.sha256)
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: >-
|
||||
enso-linux-${{fromJson(steps.changelog.outputs.content).version}}.AppImage.sha256
|
||||
path: >-
|
||||
dist/client/enso-linux-${{fromJson(steps.changelog.outputs.content).version}}.AppImage.sha256
|
||||
if: runner.os == 'Linux'
|
||||
ide-ci-actions-workflow-definition-job-package-ide-windows:
|
||||
name: Package IDE (windows)
|
||||
needs:
|
||||
- build_wasm
|
||||
release_to_github:
|
||||
name: GitHub Release
|
||||
runs-on: ${{ matrix.runner }}
|
||||
strategy:
|
||||
matrix:
|
||||
runner:
|
||||
- - macOS-latest
|
||||
fail-fast: false
|
||||
- ide-ci-actions-workflow-definition-job-build-wasm-windows
|
||||
- ide-ci-actions-workflow-definition-job-build-project-manager-windows
|
||||
runs-on:
|
||||
- self-hosted
|
||||
- Windows
|
||||
- engine
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Setup conda (GH runners only)
|
||||
uses: s-weigand/setup-conda@v1.0.5
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
update-conda: false
|
||||
conda-channels: "anaconda, conda-forge"
|
||||
- name: Installing wasm-pack
|
||||
uses: jetli/wasm-pack-action@v0.3.0
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
version: latest
|
||||
- name: Setup the Artifact API environment
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: "core.exportVariable(\"ACTIONS_RUNTIME_TOKEN\", process.env[\"ACTIONS_RUNTIME_TOKEN\"])\ncore.exportVariable(\"ACTIONS_RUNTIME_URL\", process.env[\"ACTIONS_RUNTIME_URL\"])\ncore.exportVariable(\"GITHUB_RETENTION_DAYS\", process.env[\"GITHUB_RETENTION_DAYS\"])"
|
||||
- name: Checking out the repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
clean: false
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
path: artifacts
|
||||
- name: Read changelog info
|
||||
id: changelog
|
||||
run: |2-
|
||||
|
||||
node ./run ci-gen --skip-version-validation
|
||||
content=`cat CURRENT_RELEASE_CHANGELOG.json`
|
||||
echo "::set-output name=content::$content"
|
||||
shell: bash
|
||||
- id: checkCurrentReleaseTag
|
||||
uses: mukunku/tag-exists-action@v1.0.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag: v${{fromJson(steps.changelog.outputs.content).version}}
|
||||
- name: Fail if release already exists
|
||||
run: >-
|
||||
if [[ ${{ steps.checkCurrentReleaseTag.outputs.exists }} == true ]];
|
||||
then exit 1; fi
|
||||
if: github.base_ref == 'unstable' || github.base_ref == 'stable'
|
||||
- name: Upload GitHub Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
files: artifacts/**/enso-*
|
||||
name: Enso ${{fromJson(steps.changelog.outputs.content).version}}
|
||||
tag_name: v${{fromJson(steps.changelog.outputs.content).version}}
|
||||
body: ${{fromJson(steps.changelog.outputs.content).body}}
|
||||
prerelease: ${{fromJson(steps.changelog.outputs.content).prerelease}}
|
||||
draft: true
|
||||
if: github.ref == 'refs/heads/unstable' || github.ref == 'refs/heads/stable'
|
||||
needs:
|
||||
- version_assertions
|
||||
- lint
|
||||
- test
|
||||
- package
|
||||
release_to_cdn:
|
||||
name: CDN Release
|
||||
runs-on: ${{ matrix.runner }}
|
||||
strategy:
|
||||
matrix:
|
||||
runner:
|
||||
- ubuntu-18.04
|
||||
fail-fast: false
|
||||
- run: ".\\run.cmd --help"
|
||||
shell: cmd
|
||||
- run: ".\\run.cmd ide build --wasm-source current-ci-run --project-manager-source current-ci-run"
|
||||
shell: cmd
|
||||
ide-ci-actions-workflow-definition-job-cancel-workflow-linux:
|
||||
name: Cancel Previous Runs
|
||||
runs-on:
|
||||
- X64
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Cancel Previous Runs
|
||||
uses: styfle/cancel-workflow-action@0.9.1
|
||||
with:
|
||||
access_token: "${{ github.token }}"
|
||||
ide-ci-actions-workflow-definition-job-package-ide-linux:
|
||||
name: Package IDE (linux)
|
||||
needs:
|
||||
- ide-ci-actions-workflow-definition-job-build-wasm-linux
|
||||
- ide-ci-actions-workflow-definition-job-build-project-manager-linux
|
||||
runs-on:
|
||||
- self-hosted
|
||||
- Linux
|
||||
- engine
|
||||
steps:
|
||||
- name: Setup conda (GH runners only)
|
||||
uses: s-weigand/setup-conda@v1.0.5
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
update-conda: false
|
||||
conda-channels: "anaconda, conda-forge"
|
||||
- name: Installing wasm-pack
|
||||
uses: jetli/wasm-pack-action@v0.3.0
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
version: latest
|
||||
- name: Setup the Artifact API environment
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: "core.exportVariable(\"ACTIONS_RUNTIME_TOKEN\", process.env[\"ACTIONS_RUNTIME_TOKEN\"])\ncore.exportVariable(\"ACTIONS_RUNTIME_URL\", process.env[\"ACTIONS_RUNTIME_URL\"])\ncore.exportVariable(\"GITHUB_RETENTION_DAYS\", process.env[\"GITHUB_RETENTION_DAYS\"])"
|
||||
- name: Checking out the repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
clean: false
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
- run: "./run.sh --help"
|
||||
shell: bash
|
||||
- run: "./run.sh ide build --wasm-source current-ci-run --project-manager-source current-ci-run"
|
||||
shell: bash
|
||||
ide-ci-actions-workflow-definition-job-build-wasm-linux:
|
||||
name: Build GUI (WASM) (linux)
|
||||
runs-on:
|
||||
- self-hosted
|
||||
- Linux
|
||||
- engine
|
||||
steps:
|
||||
- name: Setup conda (GH runners only)
|
||||
uses: s-weigand/setup-conda@v1.0.5
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
path: artifacts
|
||||
- name: Read changelog info
|
||||
id: changelog
|
||||
run: |2-
|
||||
|
||||
node ./run ci-gen --skip-version-validation
|
||||
content=`cat CURRENT_RELEASE_CHANGELOG.json`
|
||||
echo "::set-output name=content::$content"
|
||||
update-conda: false
|
||||
conda-channels: "anaconda, conda-forge"
|
||||
- name: Installing wasm-pack
|
||||
uses: jetli/wasm-pack-action@v0.3.0
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
version: latest
|
||||
- name: Setup the Artifact API environment
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: "core.exportVariable(\"ACTIONS_RUNTIME_TOKEN\", process.env[\"ACTIONS_RUNTIME_TOKEN\"])\ncore.exportVariable(\"ACTIONS_RUNTIME_URL\", process.env[\"ACTIONS_RUNTIME_URL\"])\ncore.exportVariable(\"GITHUB_RETENTION_DAYS\", process.env[\"GITHUB_RETENTION_DAYS\"])"
|
||||
- name: Checking out the repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
clean: false
|
||||
- run: "./run.sh --help"
|
||||
shell: bash
|
||||
- shell: bash
|
||||
run: |2-
|
||||
|
||||
aws configure --profile s3-upload <<-EOF > /dev/null 2>&1
|
||||
${{ secrets.ARTEFACT_S3_ACCESS_KEY_ID }}
|
||||
${{ secrets.ARTEFACT_S3_SECRET_ACCESS_KEY }}
|
||||
us-west-1
|
||||
text
|
||||
EOF
|
||||
- name: Upload 'index.js.gz' to CDN
|
||||
- run: "./run.sh wasm build"
|
||||
shell: bash
|
||||
run: >-
|
||||
aws s3 cp ./artifacts/content/assets/index.js.gz
|
||||
s3://ensocdn/ide/${{fromJson(steps.changelog.outputs.content).version}}/index.js.gz
|
||||
--profile s3-upload --acl public-read --content-encoding gzip
|
||||
- name: Upload 'style.css' to CDN
|
||||
shell: bash
|
||||
run: >-
|
||||
aws s3 cp ./artifacts/content/assets/style.css
|
||||
s3://ensocdn/ide/${{fromJson(steps.changelog.outputs.content).version}}/style.css
|
||||
--profile s3-upload --acl public-read
|
||||
- name: Upload 'ide.wasm' to CDN
|
||||
shell: bash
|
||||
run: >-
|
||||
aws s3 cp ./artifacts/content/assets/ide.wasm
|
||||
s3://ensocdn/ide/${{fromJson(steps.changelog.outputs.content).version}}/ide.wasm
|
||||
--profile s3-upload --acl public-read --content-type
|
||||
'application/wasm'
|
||||
- name: Upload 'wasm_imports.js.gz' to CDN
|
||||
shell: bash
|
||||
run: >-
|
||||
aws s3 cp ./artifacts/content/assets/wasm_imports.js.gz
|
||||
s3://ensocdn/ide/${{fromJson(steps.changelog.outputs.content).version}}/wasm_imports.js.gz
|
||||
--profile s3-upload --acl public-read --content-encoding gzip
|
||||
if: github.ref == 'refs/heads/unstable' || github.ref == 'refs/heads/stable'
|
||||
ide-ci-actions-workflow-definition-job-integration-test-linux:
|
||||
name: IDE integration tests (linux)
|
||||
needs:
|
||||
- version_assertions
|
||||
- lint
|
||||
- test
|
||||
- package
|
||||
- ide-ci-actions-workflow-definition-job-build-project-manager-linux
|
||||
runs-on:
|
||||
- self-hosted
|
||||
- Linux
|
||||
- engine
|
||||
steps:
|
||||
- name: Setup conda (GH runners only)
|
||||
uses: s-weigand/setup-conda@v1.0.5
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
update-conda: false
|
||||
conda-channels: "anaconda, conda-forge"
|
||||
- name: Installing wasm-pack
|
||||
uses: jetli/wasm-pack-action@v0.3.0
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
version: latest
|
||||
- name: Setup the Artifact API environment
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: "core.exportVariable(\"ACTIONS_RUNTIME_TOKEN\", process.env[\"ACTIONS_RUNTIME_TOKEN\"])\ncore.exportVariable(\"ACTIONS_RUNTIME_URL\", process.env[\"ACTIONS_RUNTIME_URL\"])\ncore.exportVariable(\"GITHUB_RETENTION_DAYS\", process.env[\"GITHUB_RETENTION_DAYS\"])"
|
||||
- name: Checking out the repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
clean: false
|
||||
- run: "./run.sh --help"
|
||||
shell: bash
|
||||
- run: "./run.sh ide integration-test --project-manager-source current-ci-run"
|
||||
shell: bash
|
||||
ide-ci-actions-workflow-definition-job-lint-linux:
|
||||
name: Lint (linux)
|
||||
runs-on:
|
||||
- self-hosted
|
||||
- Linux
|
||||
- engine
|
||||
steps:
|
||||
- name: Setup conda (GH runners only)
|
||||
uses: s-weigand/setup-conda@v1.0.5
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
update-conda: false
|
||||
conda-channels: "anaconda, conda-forge"
|
||||
- name: Installing wasm-pack
|
||||
uses: jetli/wasm-pack-action@v0.3.0
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
version: latest
|
||||
- name: Setup the Artifact API environment
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: "core.exportVariable(\"ACTIONS_RUNTIME_TOKEN\", process.env[\"ACTIONS_RUNTIME_TOKEN\"])\ncore.exportVariable(\"ACTIONS_RUNTIME_URL\", process.env[\"ACTIONS_RUNTIME_URL\"])\ncore.exportVariable(\"GITHUB_RETENTION_DAYS\", process.env[\"GITHUB_RETENTION_DAYS\"])"
|
||||
- name: Checking out the repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
clean: false
|
||||
- run: "./run.sh --help"
|
||||
shell: bash
|
||||
- run: "./run.sh lint"
|
||||
shell: bash
|
||||
ide-ci-actions-workflow-definition-job-build-project-manager-macos:
|
||||
name: Build Project Manager (macos)
|
||||
runs-on:
|
||||
- macos-latest
|
||||
steps:
|
||||
- name: Setup conda (GH runners only)
|
||||
uses: s-weigand/setup-conda@v1.0.5
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
update-conda: false
|
||||
conda-channels: "anaconda, conda-forge"
|
||||
- name: Installing wasm-pack
|
||||
uses: jetli/wasm-pack-action@v0.3.0
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
version: latest
|
||||
- name: Setup the Artifact API environment
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: "core.exportVariable(\"ACTIONS_RUNTIME_TOKEN\", process.env[\"ACTIONS_RUNTIME_TOKEN\"])\ncore.exportVariable(\"ACTIONS_RUNTIME_URL\", process.env[\"ACTIONS_RUNTIME_URL\"])\ncore.exportVariable(\"GITHUB_RETENTION_DAYS\", process.env[\"GITHUB_RETENTION_DAYS\"])"
|
||||
- name: Checking out the repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
clean: false
|
||||
- run: "./run.sh --help"
|
||||
shell: bash
|
||||
- run: "./run.sh project-manager"
|
||||
shell: bash
|
||||
ide-ci-actions-workflow-definition-job-build-wasm-windows:
|
||||
name: Build GUI (WASM) (windows)
|
||||
runs-on:
|
||||
- self-hosted
|
||||
- Windows
|
||||
- engine
|
||||
steps:
|
||||
- name: Setup conda (GH runners only)
|
||||
uses: s-weigand/setup-conda@v1.0.5
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
update-conda: false
|
||||
conda-channels: "anaconda, conda-forge"
|
||||
- name: Installing wasm-pack
|
||||
uses: jetli/wasm-pack-action@v0.3.0
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
version: latest
|
||||
- name: Setup the Artifact API environment
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: "core.exportVariable(\"ACTIONS_RUNTIME_TOKEN\", process.env[\"ACTIONS_RUNTIME_TOKEN\"])\ncore.exportVariable(\"ACTIONS_RUNTIME_URL\", process.env[\"ACTIONS_RUNTIME_URL\"])\ncore.exportVariable(\"GITHUB_RETENTION_DAYS\", process.env[\"GITHUB_RETENTION_DAYS\"])"
|
||||
- name: Checking out the repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
clean: false
|
||||
- run: ".\\run.cmd --help"
|
||||
shell: cmd
|
||||
- run: ".\\run.cmd wasm build"
|
||||
shell: cmd
|
||||
ide-ci-actions-workflow-definition-job-build-wasm-macos:
|
||||
name: Build GUI (WASM) (macos)
|
||||
runs-on:
|
||||
- macos-latest
|
||||
steps:
|
||||
- name: Setup conda (GH runners only)
|
||||
uses: s-weigand/setup-conda@v1.0.5
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
update-conda: false
|
||||
conda-channels: "anaconda, conda-forge"
|
||||
- name: Installing wasm-pack
|
||||
uses: jetli/wasm-pack-action@v0.3.0
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
version: latest
|
||||
- name: Setup the Artifact API environment
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: "core.exportVariable(\"ACTIONS_RUNTIME_TOKEN\", process.env[\"ACTIONS_RUNTIME_TOKEN\"])\ncore.exportVariable(\"ACTIONS_RUNTIME_URL\", process.env[\"ACTIONS_RUNTIME_URL\"])\ncore.exportVariable(\"GITHUB_RETENTION_DAYS\", process.env[\"GITHUB_RETENTION_DAYS\"])"
|
||||
- name: Checking out the repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
clean: false
|
||||
- run: "./run.sh --help"
|
||||
shell: bash
|
||||
- run: "./run.sh wasm build"
|
||||
shell: bash
|
||||
ide-ci-actions-workflow-definition-job-build-project-manager-windows:
|
||||
name: Build Project Manager (windows)
|
||||
runs-on:
|
||||
- self-hosted
|
||||
- Windows
|
||||
- engine
|
||||
steps:
|
||||
- name: Setup conda (GH runners only)
|
||||
uses: s-weigand/setup-conda@v1.0.5
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
update-conda: false
|
||||
conda-channels: "anaconda, conda-forge"
|
||||
- name: Installing wasm-pack
|
||||
uses: jetli/wasm-pack-action@v0.3.0
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
version: latest
|
||||
- name: Setup the Artifact API environment
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: "core.exportVariable(\"ACTIONS_RUNTIME_TOKEN\", process.env[\"ACTIONS_RUNTIME_TOKEN\"])\ncore.exportVariable(\"ACTIONS_RUNTIME_URL\", process.env[\"ACTIONS_RUNTIME_URL\"])\ncore.exportVariable(\"GITHUB_RETENTION_DAYS\", process.env[\"GITHUB_RETENTION_DAYS\"])"
|
||||
- name: Checking out the repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
clean: false
|
||||
- run: ".\\run.cmd --help"
|
||||
shell: cmd
|
||||
- run: ".\\run.cmd project-manager"
|
||||
shell: cmd
|
||||
ide-ci-actions-workflow-definition-job-assert-changelog-linux:
|
||||
name: Assert if CHANGELOG.md was updated (on pull request)
|
||||
runs-on:
|
||||
- self-hosted
|
||||
- Linux
|
||||
- engine
|
||||
steps:
|
||||
- run: "if [[ ${{ contains(steps.changed_files.outputs.list,'CHANGELOG.md') || contains(github.event.head_commit.message,'[ci no changelog needed]') || contains(github.event.pull_request.body,'[ci no changelog needed]') }} == false ]]; then exit 1; fi"
|
||||
if: "github.base_ref == 'develop' || github.base_ref == 'unstable' || github.base_ref == 'stable'"
|
||||
ide-ci-actions-workflow-definition-job-package-ide-macos:
|
||||
name: Package IDE (macos)
|
||||
needs:
|
||||
- ide-ci-actions-workflow-definition-job-build-wasm-macos
|
||||
- ide-ci-actions-workflow-definition-job-build-project-manager-macos
|
||||
runs-on:
|
||||
- macos-latest
|
||||
steps:
|
||||
- name: Setup conda (GH runners only)
|
||||
uses: s-weigand/setup-conda@v1.0.5
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
update-conda: false
|
||||
conda-channels: "anaconda, conda-forge"
|
||||
- name: Installing wasm-pack
|
||||
uses: jetli/wasm-pack-action@v0.3.0
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
version: latest
|
||||
- name: Setup the Artifact API environment
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: "core.exportVariable(\"ACTIONS_RUNTIME_TOKEN\", process.env[\"ACTIONS_RUNTIME_TOKEN\"])\ncore.exportVariable(\"ACTIONS_RUNTIME_URL\", process.env[\"ACTIONS_RUNTIME_URL\"])\ncore.exportVariable(\"GITHUB_RETENTION_DAYS\", process.env[\"GITHUB_RETENTION_DAYS\"])"
|
||||
- name: Checking out the repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
clean: false
|
||||
- run: "./run.sh --help"
|
||||
shell: bash
|
||||
- run: "./run.sh ide build --wasm-source current-ci-run --project-manager-source current-ci-run"
|
||||
shell: bash
|
||||
ide-ci-actions-workflow-definition-job-wasm-test-linux:
|
||||
name: WASM GUI tests (linux)
|
||||
runs-on:
|
||||
- self-hosted
|
||||
- Linux
|
||||
- engine
|
||||
steps:
|
||||
- name: Setup conda (GH runners only)
|
||||
uses: s-weigand/setup-conda@v1.0.5
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
update-conda: false
|
||||
conda-channels: "anaconda, conda-forge"
|
||||
- name: Installing wasm-pack
|
||||
uses: jetli/wasm-pack-action@v0.3.0
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
version: latest
|
||||
- name: Setup the Artifact API environment
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: "core.exportVariable(\"ACTIONS_RUNTIME_TOKEN\", process.env[\"ACTIONS_RUNTIME_TOKEN\"])\ncore.exportVariable(\"ACTIONS_RUNTIME_URL\", process.env[\"ACTIONS_RUNTIME_URL\"])\ncore.exportVariable(\"GITHUB_RETENTION_DAYS\", process.env[\"GITHUB_RETENTION_DAYS\"])"
|
||||
- name: Checking out the repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
clean: false
|
||||
- run: "./run.sh --help"
|
||||
shell: bash
|
||||
- run: "./run.sh wasm test --no-native"
|
||||
shell: bash
|
||||
ide-ci-actions-workflow-definition-job-build-project-manager-linux:
|
||||
name: Build Project Manager (linux)
|
||||
runs-on:
|
||||
- self-hosted
|
||||
- Linux
|
||||
- engine
|
||||
steps:
|
||||
- name: Setup conda (GH runners only)
|
||||
uses: s-weigand/setup-conda@v1.0.5
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
update-conda: false
|
||||
conda-channels: "anaconda, conda-forge"
|
||||
- name: Installing wasm-pack
|
||||
uses: jetli/wasm-pack-action@v0.3.0
|
||||
if: "startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent')"
|
||||
with:
|
||||
version: latest
|
||||
- name: Setup the Artifact API environment
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: "core.exportVariable(\"ACTIONS_RUNTIME_TOKEN\", process.env[\"ACTIONS_RUNTIME_TOKEN\"])\ncore.exportVariable(\"ACTIONS_RUNTIME_URL\", process.env[\"ACTIONS_RUNTIME_URL\"])\ncore.exportVariable(\"GITHUB_RETENTION_DAYS\", process.env[\"GITHUB_RETENTION_DAYS\"])"
|
||||
- name: Checking out the repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
clean: false
|
||||
- run: "./run.sh --help"
|
||||
shell: bash
|
||||
- run: "./run.sh project-manager"
|
||||
shell: bash
|
||||
|
6
.gitignore
vendored
6
.gitignore
vendored
@ -103,6 +103,9 @@ bench-report*.xml
|
||||
.bloop/
|
||||
.bsp/
|
||||
project/metals.sbt
|
||||
/app/ide-desktop/build.json
|
||||
/app/ide-desktop/lib/client/electron-builder-config.json
|
||||
|
||||
|
||||
#################
|
||||
## Build Cache ##
|
||||
@ -129,6 +132,9 @@ distribution/lib/Standard/Examples/*/data/spreadsheet.xls
|
||||
distribution/lib/Standard/Examples/*/data/spreadsheet.xlsx
|
||||
distribution/lib/*/*/*/manifest.yaml
|
||||
|
||||
# Resources that are downloaded during the build.
|
||||
/lib/scala/pkg/src/main/resources/*
|
||||
|
||||
test/Google_Api_Test/data/secret.json
|
||||
test/Database_Tests/data/redshift_credentials.json
|
||||
|
||||
|
@ -1,20 +1,23 @@
|
||||
# Build Artefacts
|
||||
target/
|
||||
dist
|
||||
target
|
||||
|
||||
.github/PULL_REQUEST_TEMPLATE.md
|
||||
.github/ISSUE_TEMPLATE
|
||||
distribution/launcher/THIRD-PARTY
|
||||
distribution/engine/THIRD-PARTY
|
||||
distribution/project-manager/THIRD-PARTY
|
||||
tools/legal-review
|
||||
distribution/lib/Standard/Base/*/THIRD-PARTY
|
||||
distribution/lib/Standard/Table/*/THIRD-PARTY
|
||||
distribution/lib/Standard/Image/*/THIRD-PARTY
|
||||
distribution/lib/Standard/Database/*/THIRD-PARTY
|
||||
distribution/lib/Standard/*/*/manifest.yaml
|
||||
distribution/lib/Standard/*/*/polyglot
|
||||
distribution/lib/Standard/*/*/THIRD-PARTY
|
||||
|
||||
built-distribution/
|
||||
THIRD-PARTY
|
||||
|
||||
# GUI
|
||||
gui/dist/
|
||||
**/scala-parser.js
|
||||
**/package-lock.json
|
||||
**/msdfgen_wasm.js
|
||||
|
||||
Cargo.lock
|
||||
|
@ -1,5 +1,7 @@
|
||||
overrides:
|
||||
- files: "*.[j|t]s"
|
||||
- files:
|
||||
- "*.[j|t]s"
|
||||
- "*.mjs"
|
||||
options:
|
||||
printWidth: 100
|
||||
tabWidth: 4
|
||||
|
2609
Cargo.lock
generated
2609
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
31
Cargo.toml
31
Cargo.toml
@ -1,20 +1,19 @@
|
||||
[workspace]
|
||||
|
||||
# Listing only the "root" crates of each app/library. All path dependencies are included in the workspace automatically.
|
||||
# If you want to add sub crate (like `app/gui/config` or `lib/rust/ensogl/example`), just add it as a path dependency
|
||||
# where plausible.
|
||||
members = [
|
||||
"app/gui",
|
||||
"app/gui/enso-profiler-enso-data",
|
||||
"build/enso-formatter",
|
||||
"build/rust-scripts",
|
||||
"lib/rust/*",
|
||||
"lib/rust/parser/src/syntax/tree/visitor",
|
||||
"lib/rust/parser/src/syntax/tree/builder",
|
||||
"lib/rust/profiler/data",
|
||||
"integration-test"
|
||||
"app/gui",
|
||||
"app/gui/enso-profiler-enso-data",
|
||||
"build",
|
||||
"build/enso-formatter",
|
||||
"build/rust-scripts",
|
||||
"lib/rust/*",
|
||||
"lib/rust/parser/src/syntax/tree/visitor",
|
||||
"lib/rust/parser/src/syntax/tree/builder",
|
||||
"lib/rust/profiler/data",
|
||||
"integration-test"
|
||||
]
|
||||
|
||||
# The default memebers are those we want to check and test by default.
|
||||
default-members = ["app/gui", "lib/rust/*"]
|
||||
|
||||
@ -51,3 +50,13 @@ debug-assertions = true
|
||||
[profile.integration-test]
|
||||
inherits = "test"
|
||||
opt-level = 2
|
||||
|
||||
[profile.buildscript]
|
||||
inherits = "release"
|
||||
opt-level = 2
|
||||
lto = false
|
||||
debug = false
|
||||
debug-assertions = true
|
||||
#[patch."https://github.com/enso-org/ci-build"]
|
||||
#enso-build = { path = '../ci-build/build' }
|
||||
#ide-ci = { path = '../ci-build/ci_utils' }
|
||||
|
51
actions/setup-build/action.yml
Normal file
51
actions/setup-build/action.yml
Normal file
@ -0,0 +1,51 @@
|
||||
name: "Setup Enso Build"
|
||||
description: "Installs enso-build tool."
|
||||
inputs:
|
||||
clean:
|
||||
description: Whether the repository should be cleaned.
|
||||
required: true
|
||||
default: "false"
|
||||
|
||||
# enso_ref:
|
||||
# description: Reference to be cheked out in the Enso repository.
|
||||
# required: false
|
||||
# default: ''
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Setup conda (GH runners only)
|
||||
uses: s-weigand/setup-conda@v1.0.5
|
||||
if: startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent') # GitHub-hosted runner.
|
||||
with:
|
||||
update-conda: false
|
||||
conda-channels: anaconda, conda-forge
|
||||
- name: Install wasm-pack (macOS GH runners only)
|
||||
env:
|
||||
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.10.2
|
||||
WASMPACKDIR: wasm-pack-v0.10.2-x86_64-apple-darwin
|
||||
run: |-
|
||||
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
|
||||
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
|
||||
rm -r $WASMPACKDIR
|
||||
shell: bash
|
||||
if: startsWith(runner.name, 'GitHub Actions') || startsWith(runner.name, 'Hosted Agent') # GitHub-hosted runner.
|
||||
# - uses: actions/checkout@v3
|
||||
# name: Checkout the repository
|
||||
# with:
|
||||
# clean: ${{ inputs.clean }}
|
||||
|
||||
# Runs a set of commands using the runners shell
|
||||
- uses: actions/github-script@v6
|
||||
name: Setup the Artifact API environment
|
||||
with:
|
||||
script: |-
|
||||
core.exportVariable("ACTIONS_RUNTIME_TOKEN", process.env["ACTIONS_RUNTIME_TOKEN"])
|
||||
core.exportVariable("ACTIONS_RUNTIME_URL", process.env["ACTIONS_RUNTIME_URL"])
|
||||
core.exportVariable("GITHUB_RETENTION_DAYS", process.env["GITHUB_RETENTION_DAYS"])
|
||||
- run: ./run.sh --help
|
||||
shell: bash
|
||||
if: runner.os != 'Windows'
|
||||
- run: .\run.cmd --help
|
||||
shell: cmd
|
||||
if: runner.os == 'Windows'
|
@ -16,10 +16,10 @@ enso-data-structures = { path = "../../lib/rust/data-structures" }
|
||||
enso-debug-api = { path = "../../lib/rust/debug-api" }
|
||||
enso-debug-scene = { path = "view/debug_scene" }
|
||||
enso-frp = { path = "../../lib/rust/frp" }
|
||||
enso-logger = { path = "../../lib/rust/logger"}
|
||||
enso-prelude = { path = "../../lib/rust/prelude"}
|
||||
enso-logger = { path = "../../lib/rust/logger" }
|
||||
enso-prelude = { path = "../../lib/rust/prelude" }
|
||||
enso-profiler = { path = "../../lib/rust/profiler" }
|
||||
enso-shapely = { path = "../../lib/rust/shapely"}
|
||||
enso-shapely = { path = "../../lib/rust/shapely" }
|
||||
enso-text = { path = "../../lib/rust/text" }
|
||||
enso-web = { path = "../../lib/rust/web" }
|
||||
ensogl = { path = "../../lib/rust/ensogl" }
|
||||
|
@ -1,4 +1,4 @@
|
||||
# This is the repository for Enso's graphical interface component. If you're looking for the main product repository, you may find it at at 👉 <a href="https://github.com/enso-org/enso">github.com/enso-org/enso</a> 👈
|
||||
# This is the subtree for Enso's graphical interface component. If you're looking for the repository root, you may find it at at 👉 <a href="https://github.com/enso-org/enso">github.com/enso-org/enso</a> 👈
|
||||
|
||||
<br/>
|
||||
|
||||
@ -44,18 +44,18 @@ as well as the [source code](https://github.com/enso-org). See the
|
||||
[demo scenes](http://TODO), and read the [documentation](docs/product) to learn
|
||||
more.
|
||||
|
||||
Currently to start IDE you have to run **Enso Project Manager** first. For more
|
||||
information and packages see
|
||||
[Enso repository](https://github.com/enso-org/enso).
|
||||
|
||||
<br/>
|
||||
|
||||
### Building
|
||||
|
||||
The project builds on MacOS, Linux, and Windows. Simply run `node ./run build`
|
||||
to build it and use `node ./run --help` to learn about other available commands
|
||||
and options. Read the detailed [development guide](docs/CONTRIBUTING.md) to
|
||||
learn more.
|
||||
The project builds on macOS, Linux, and Windows. Build functionality is provided
|
||||
by our build script, that are accessible through `run.sh` (Linux and macOS) or
|
||||
`run.cmd` (Windows) wrappers.
|
||||
|
||||
To build the project, simply run `./run.sh ide build` (on Linux or macOS) or
|
||||
`.\run.cmd ide build` (Windows) to build IDE. To learn more about other
|
||||
available commands use `--help` argument. Read the detailed
|
||||
[development guide](docs/CONTRIBUTING.md) to learn more.
|
||||
|
||||
<br/>
|
||||
|
||||
|
@ -6,7 +6,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
ensogl = { path = "../../../lib/rust/ensogl" }
|
||||
enso-prelude = { path = "../../../lib/rust/prelude"}
|
||||
enso-prelude = { path = "../../../lib/rust/prelude" }
|
||||
enso-logger = { path = "../../../lib/rust/logger" }
|
||||
semver = "1.0.0"
|
||||
|
||||
|
@ -32,6 +32,7 @@ pub fn engine_version_requirement() -> semver::VersionReq {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ============
|
||||
// === Args ===
|
||||
// ============
|
||||
@ -60,8 +61,10 @@ ensogl::read_args! {
|
||||
authentication_enabled : bool,
|
||||
email : String,
|
||||
application_config_url : String,
|
||||
/// When profiling the application (e.g. with the `./run profile` command), this argument
|
||||
/// When profiling the application (e.g. with the `./run.sh profile` command), this argument
|
||||
/// chooses what is profiled.
|
||||
test_workflow : String,
|
||||
test_workflow : String,
|
||||
skip_min_version_check : bool,
|
||||
preferred_engine_version : semver::Version,
|
||||
}
|
||||
}
|
||||
|
@ -5,5 +5,4 @@ authors = ["Enso Team <contact@enso.org>"]
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
|
@ -12,8 +12,8 @@ ast = { version = "0.1.0", path = "../../language/ast/impl" }
|
||||
engine-protocol = { version = "0.1.0", path = "../engine-protocol" }
|
||||
parser = { version = "0.1.0", path = "../../language/parser" }
|
||||
enso-data-structures = { path = "../../../../lib/rust/data-structures" }
|
||||
enso-logger = { path = "../../../../lib/rust/logger"}
|
||||
enso-prelude = { path = "../../../../lib/rust/prelude"}
|
||||
enso-logger = { path = "../../../../lib/rust/logger" }
|
||||
enso-prelude = { path = "../../../../lib/rust/prelude" }
|
||||
enso-text = { path = "../../../../lib/rust/text" }
|
||||
failure = { version = "0.1.6" }
|
||||
itertools = { version = "0.10.0" }
|
||||
|
@ -5,5 +5,4 @@ authors = ["Enso Team <contact@enso.org>"]
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
|
@ -10,10 +10,10 @@ crate-type = ["cdylib", "rlib"]
|
||||
[dependencies]
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
enso-data-structures = { path = "../../../../lib/rust/data-structures" }
|
||||
enso-logger = { path = "../../../../lib/rust/logger"}
|
||||
enso-prelude = { path = "../../../../lib/rust/prelude"}
|
||||
enso-shapely = { path = "../../../../lib/rust/shapely"}
|
||||
enso-text = { path = "../../../../lib/rust/text"}
|
||||
enso-logger = { path = "../../../../lib/rust/logger" }
|
||||
enso-prelude = { path = "../../../../lib/rust/prelude" }
|
||||
enso-shapely = { path = "../../../../lib/rust/shapely" }
|
||||
enso-text = { path = "../../../../lib/rust/text" }
|
||||
failure = { version = "0.1.8" }
|
||||
flatbuffers = { version = "0.5" }
|
||||
futures = { version = "0.3.1" }
|
||||
|
@ -52,10 +52,10 @@ 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-11-29)**
|
||||
- **The Rust Toolchain**
|
||||
|
||||
This project uses several features available only in the nightly Rust
|
||||
toolchain. Please use the [the Rust toolchain installer](https://rustup.rs) to
|
||||
toolchain. Please use [the Rust toolchain installer](https://rustup.rs) to
|
||||
manage Rust toolchains. It will automatically download the toolchain needed to
|
||||
build the project.
|
||||
|
||||
@ -64,7 +64,7 @@ setup:
|
||||
```bash
|
||||
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
|
||||
cargo +stable install cargo-watch # To enable `./run.sh wasm watch` utility
|
||||
```
|
||||
|
||||
Make sure that your `PATH` environment variable is set up correctly, so that
|
||||
@ -120,7 +120,7 @@ setup:
|
||||
## Working with sources
|
||||
|
||||
Please be sure to carefully read the
|
||||
[Rust style guide 1](./contributing/style-guide.md) and the
|
||||
[Rust style guide 1](contributing/style-guide.md) and the
|
||||
[Rust style guide 2](https://enso.org/docs/developer/ide/contributing/style-guide.html)
|
||||
before contributing to the codebase.
|
||||
|
||||
@ -138,8 +138,8 @@ refactoring, and it is not finished yet: the Engine files are still not in the
|
||||
|
||||
The root directory contains `Cargo.toml` and `build.sbt` files, allowing to open
|
||||
all rust or scala code as a single project in your favorite IDE. There is also a
|
||||
`run` script used for building and running the Enso IDE (see next section for
|
||||
details).
|
||||
`run.sh` and `run.cmd` scripts used for building and running the Enso IDE (see
|
||||
next section for details).
|
||||
|
||||
The subdirectories of interests are:
|
||||
|
||||
@ -163,8 +163,7 @@ The subdirectories of interests are:
|
||||
WASM.
|
||||
- `rust/frp`: The library allows following the Functional Reactive Programming
|
||||
paradigm in rust.
|
||||
- `build`: All building scripts and utilities, mostly the logic of the `./run`
|
||||
script.
|
||||
- `build`: Build script that is wrapped by the `run` script.
|
||||
- `integration-test`: A single crate with all integration tests of our
|
||||
applications.
|
||||
|
||||
@ -173,83 +172,60 @@ Engine files, which will be moved to `app/engine` soon.
|
||||
|
||||
### Development
|
||||
|
||||
As this is a multi-part project with many complex dependencies, it is equipped
|
||||
As this is a multipart project with many complex dependencies, it is equipped
|
||||
with a build script which both validates your working environment and takes care
|
||||
of providing the most suitable compilation flags for a particular development
|
||||
stage. To run the build script simply run `node ./run` in the root of the
|
||||
codebase. On macOS and Linux you can use a simpler form of `./run`, however,
|
||||
this doc will use the former form in order to stay cross-platform compatible.
|
||||
Run `node ./run help` to learn about available commands and options. All
|
||||
arguments provided after the `--` symbol will be passed to sub-commands. For
|
||||
example `node ./run build -- --dev` will pass the `--dev` flag to `cargo` (Rust
|
||||
build tool). The most common options are presented below:
|
||||
stage.
|
||||
|
||||
- **Interactive mode** Run `node ./run watch` to start a local web-server and a
|
||||
source-file watch utility which will build the project on every change. Open
|
||||
The build-script is invokable by invoking the following script from the working
|
||||
copy root:
|
||||
|
||||
- `./run.sh` in bash-compatible environments, like Linux or macOS;
|
||||
- `.\run.cmd` on Windows.
|
||||
|
||||
For brevity, this guide will use `./run.sh` form from here onwards.
|
||||
|
||||
In general, `./run.sh` should also work on Windows ports of `bash` (like the
|
||||
ones provided by `git` or MSYS2). These configurations are not tested though.
|
||||
|
||||
Run `./run.sh --help` to learn about available commands and options. Some
|
||||
subcommands allow passing additional arguments following `--` argument to the
|
||||
underlying call. For example `./run.sh ide build -- FLAG` will pass the `FLAG`
|
||||
flag to `wasm-pack` (Rust WASM build tool). The most common options are
|
||||
presented below:
|
||||
|
||||
- **Interactive mode** Run `./run.sh ide watch` to start a local web-server and
|
||||
a source-file watch utility which will build the project on every change. Open
|
||||
`http://localhost:8080` (the port may vary and will be reported in the
|
||||
terminal if `8080` was already in use) to run the application, or
|
||||
`http://localhost:8080/?entry` to open example demo scenes list. Please
|
||||
remember to disable the cache in your browser during the development! By
|
||||
default, the script disables heavyweight optimizations to provide interactive
|
||||
development experience. The scripts are thin wrappers for
|
||||
[wasm-pack](https://github.com/rustwasm/wasm-pack) and accept the same
|
||||
[command line arguments](https://rustwasm.github.io/wasm-pack/book/commands/build.html).
|
||||
|
||||
development experience.
|
||||
- **Production mode** In order to compile in a production mode (enable all
|
||||
optimizations, strip WASM debug symbols, minimize the output binaries, etc.),
|
||||
run `node ./run build`. To create platform-specific packages and installers
|
||||
use `node ./run dist` instead. The final executables will be located at
|
||||
`dist/client/$PLATFORM`.
|
||||
run `./run.sh gui build`. To create platform-specific packages and installers
|
||||
use `./run.sh ide build` instead. The final executables will be located at
|
||||
`dist/ide`.
|
||||
- **Selective mode** In order to compile only part of the project, and thus
|
||||
drastically shorten the incremental compile time, you are advised to use the
|
||||
selective compilation mode by passing the `--crate` option to the `build` or
|
||||
`watch` command, e.g. `node ./watch --crate ensogl/example` to compile only
|
||||
the renderer-related example scenes. Please note, that in order to run a scene
|
||||
in a web-browser, the scene has to be compiled and has to expose a public
|
||||
function with a name starting with `entry_point_`. Thus, if you compile only
|
||||
selected crate, you will have access only to the example scenes that were
|
||||
defined or re-exported by that crate. In particular, the `ide` crate exposes
|
||||
the `entry_point_ide` function, so you have to compile it to test your code in
|
||||
the Enso IDE.
|
||||
|
||||
### Updating JS dependencies
|
||||
|
||||
JS parts of the project are using [`lerna`](https://lerna.js.org/) to manage JS
|
||||
dependencies. When you add a new JS dependency or update an old one to the new
|
||||
version, `lerna` must be re-run to trigger `npm install` for all projects. The
|
||||
easiest way to do so is to run `./run clean --no-rust` command. You can also
|
||||
manually call `npm run install` in `app/ide-desktop/` directory with a similar
|
||||
result. Our CI does that for every build at the moment.
|
||||
|
||||
### Testing IDE with a specific version of a backend
|
||||
|
||||
Sometimes changes to the IDE must be tested against the unreleased Enso Engine
|
||||
version. To perform this one should:
|
||||
|
||||
- commit code to [enso](https://github.com/enso-org/enso) repository and allow
|
||||
CI to successfully complete;
|
||||
- enter the
|
||||
[`Engine CI` runs](https://github.com/enso-org/enso/actions/workflows/scala.yml)
|
||||
and select the run for the commit to be tested;
|
||||
- download the Enso Engine artifact appropriate for your OS (e.g.
|
||||
`enso-engine-0.2.9-SNAPSHOT-windows-amd64.zip`);
|
||||
- extract the archive into
|
||||
[`ENSO_DATA_DIRECTORY/dist`](https://dev.enso.org/docs/enso/distribution/distribution.html#installed-enso-distribution-layout).
|
||||
Rename the extracted folder by erasing initial `enso-`, e.g. change
|
||||
`enso-0.2.9-SNAPSHOT` to `0.2.9-SNAPSHOT`;
|
||||
- open the `package.yaml` of the tested project (by default it is under
|
||||
`~/enso/projects/Unnamed/`) and change the `enso-version` value to the version
|
||||
of the downloaded package (e.g. `enso-version: 0.2.9-SNAPSHOT`);
|
||||
- run the IDE opening the updated project. Project Manager should automatically
|
||||
spawn the Language Server from the extracted package.
|
||||
selective compilation mode by passing the `--crate-path` option to the `build`
|
||||
or `watch` command, e.g. `./run.sh ide watch --crate-path ensogl/example` to
|
||||
compile only the renderer-related example scenes. Please note, that in order
|
||||
to run a scene in a web-browser, the scene has to be compiled and has to
|
||||
expose a public function with a name starting with `entry_point_`. Thus, if
|
||||
you compile only selected crate, you will have access only to the example
|
||||
scenes that were defined or re-exported by that crate. In particular, the
|
||||
`ide` crate exposes the `entry_point_ide` function, so you have to compile it
|
||||
to test your code in the Enso IDE.
|
||||
|
||||
### Using IDE as a library.
|
||||
|
||||
In case you want to use the IDE as a library, for example to embed it into
|
||||
another website, you need to first build it using `node ./run {built,dist}` and
|
||||
find the necessary artifacts located at `dist/content`. Especially, the
|
||||
`dist/content/index.js` defines a function `window.enso.main(cfg)` which you can
|
||||
use to run the IDE. Currently, the configuration argument can contain the
|
||||
another website, you need to first build it using `./run.sh gui build` and find
|
||||
the necessary artifacts located at `dist/gui`. Especially, the
|
||||
`dist/gui/assets/index.js` defines a function `window.enso.main(cfg)` which you
|
||||
can use to run the IDE. Currently, the configuration argument can contain the
|
||||
following options:
|
||||
|
||||
- `entry` - the entry point, one of predefined scenes. Set it to empty string to
|
||||
@ -261,15 +237,15 @@ 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 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:
|
||||
- **Size Validation** Use `./run.sh wasm 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,
|
||||
check which part of the code contributet to it, and talk about it with the
|
||||
check which part of the code contribute to it, and talk about it with the
|
||||
code owner.
|
||||
- If the PR does include new libraries, you are allowed to increase the limit
|
||||
by 10KB, but you should also consider if it is possible to get the same
|
||||
@ -283,28 +259,19 @@ have prepared several scripts which maximally automate the process:
|
||||
talking with code owner about this case.
|
||||
|
||||
- **Testing** For the test suite to run you need a current version of Chrome
|
||||
installed. Use `node ./run test` run both unit and web-based visual test.
|
||||
|
||||
- _Note for Windows users_: there is a
|
||||
[known issue with wasm-pack](https://github.com/rustwasm/wasm-pack/issues/611)
|
||||
using the wrong version of the chrome driver. There is
|
||||
[a workaround](https://github.com/rustwasm/wasm-pack/issues/611#issuecomment-522093207)
|
||||
described in the issue: download compatible ChromeDriver from the
|
||||
[official source](https://chromedriver.chromium.org/downloads) and ensure it
|
||||
is in your `PATH`.
|
||||
|
||||
installed. Use `./run.sh wasm test` run both unit and web-based visual test.
|
||||
- **Integration Tests** The integration tests are gathered in `integration-test`
|
||||
crate. You can run them with `node ./run integration-test` command. The script
|
||||
will spawn required Engine process.
|
||||
crate. You can run them with `./run.sh ide integration-test` command. The
|
||||
script will spawn required Engine process.
|
||||
- To run une test suite add `-- --test <suite-name>` at end of command
|
||||
options. The `<suite-name>` is a name of the file in
|
||||
`integration-test/tests` directory without extension, for example
|
||||
`graph_editor`.
|
||||
- The integration test can create and leave new Enso projects. **Keep it in
|
||||
mind when running the script with your own backend (the `--no-backend`
|
||||
mind when running the script with your own backend (the `--external-backend`
|
||||
option)**. The Engine spawned by the script will use a dedicated workspace
|
||||
created in temporary directory, so the user workspace will not be affected.
|
||||
- **Linting** Please be sure to fix all errors reported by `node ./run lint`
|
||||
- **Linting** Please be sure to fix all errors reported by `./run.sh lint`
|
||||
before creating a pull request to this repository.
|
||||
|
||||
### Development Branches
|
||||
|
@ -8,7 +8,7 @@ authors = ["Enso Team <contact@enso.org>"]
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
||||
csv = "1.1"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
enso-profiler = { path = "../../../lib/rust/profiler"}
|
||||
enso-profiler-data = { path = "../../../lib/rust/profiler/data"}
|
||||
ensogl-core = { path = "../../../lib/rust/ensogl/core"}
|
||||
json-rpc = { path = "../../../lib/rust/json-rpc"}
|
||||
enso-profiler = { path = "../../../lib/rust/profiler" }
|
||||
enso-profiler-data = { path = "../../../lib/rust/profiler/data" }
|
||||
ensogl-core = { path = "../../../lib/rust/ensogl/core" }
|
||||
json-rpc = { path = "../../../lib/rust/json-rpc" }
|
||||
|
@ -14,8 +14,8 @@ default = []
|
||||
proc-macro2 = "1.0"
|
||||
quote = "1.0"
|
||||
Inflector = "0.11.4"
|
||||
enso-prelude = { path = "../../../../../lib/rust/prelude"}
|
||||
enso-macro-utils = { path = "../../../../../lib/rust/macro-utils"}
|
||||
enso-prelude = { path = "../../../../../lib/rust/prelude" }
|
||||
enso-macro-utils = { path = "../../../../../lib/rust/macro-utils" }
|
||||
|
||||
[dependencies.syn]
|
||||
version = "1.0"
|
||||
|
@ -11,7 +11,10 @@ crate-type = ["cdylib", "rlib"]
|
||||
[dependencies]
|
||||
ast = { path = "../ast/impl" }
|
||||
enso-data-structures = { path = "../../../../lib/rust/data-structures" }
|
||||
enso-prelude = { path = "../../../../lib/rust/prelude", features = ["serde", "serde_json"] }
|
||||
enso-prelude = { path = "../../../../lib/rust/prelude", features = [
|
||||
"serde",
|
||||
"serde_json"
|
||||
] }
|
||||
enso-profiler = { path = "../../../../lib/rust/profiler" }
|
||||
enso-text = { path = "../../../../lib/rust/text" }
|
||||
console_error_panic_hook = { version = "0.1.6" }
|
||||
|
@ -157,5 +157,7 @@ async fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
|
||||
provider.run().await;
|
||||
}
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
println!("cargo:rerun-if-changed={}", PARSER_PATH);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -12,12 +12,9 @@ ast = { path = "../../ast/impl" }
|
||||
enso-text = { path = "../../../../../lib/rust/text" }
|
||||
span-tree = { path = "../../span-tree" }
|
||||
enso-web = { path = "../../../../../lib/rust/web" }
|
||||
enso-prelude = { path = "../../../../../lib/rust/prelude"}
|
||||
enso-logger = { path = "../../../../../lib/rust/logger"}
|
||||
wasm-bindgen = { version = "0.2.78", features = [
|
||||
"nightly",
|
||||
"serde-serialize"
|
||||
] }
|
||||
enso-prelude = { path = "../../../../../lib/rust/prelude" }
|
||||
enso-logger = { path = "../../../../../lib/rust/logger" }
|
||||
wasm-bindgen = { version = "0.2.78", features = ["nightly", "serde-serialize"] }
|
||||
uuid = { version = "0.8", features = ["serde", "v4", "wasm-bindgen"] }
|
||||
|
||||
[dependencies.web-sys]
|
||||
|
@ -130,7 +130,8 @@ impl ManagingProjectAPI for Handle {
|
||||
let name = template.clone().unwrap_or_else(|| UNNAMED_PROJECT_NAME.to_owned());
|
||||
let name = choose_new_project_name(&existing_names, &name);
|
||||
let name = ProjectName::new_unchecked(name);
|
||||
let version = Some(enso_config::engine_version_supported.to_string());
|
||||
let version =
|
||||
enso_config::ARGS.preferred_engine_version.as_ref().map(ToString::to_string);
|
||||
let action = MissingComponentAction::Install;
|
||||
|
||||
let create_result =
|
||||
|
@ -225,7 +225,7 @@ impl WithProjectManager {
|
||||
pub async fn create_project(&self) -> FallibleResult<Uuid> {
|
||||
use project_manager::MissingComponentAction::Install;
|
||||
info!(self.logger, "Creating a new project named '{self.project_name}'.");
|
||||
let version = Some(enso_config::engine_version_supported.to_owned());
|
||||
let version = enso_config::ARGS.preferred_engine_version.as_ref().map(ToString::to_string);
|
||||
let name = &self.project_name;
|
||||
let response = self.project_manager.create_project(name, &None, &version, &Install);
|
||||
Ok(response.await?.project_id)
|
||||
|
@ -11,9 +11,9 @@ crate-type = ["cdylib", "rlib"]
|
||||
ast = { path = "../language/ast/impl" }
|
||||
enso-config = { path = "../config" }
|
||||
enso-frp = { path = "../../../lib/rust/frp" }
|
||||
enso-logger = { path = "../../../lib/rust/logger"}
|
||||
enso-prelude = { path = "../../../lib/rust/prelude"}
|
||||
enso-shapely = { path = "../../../lib/rust/shapely"}
|
||||
enso-logger = { path = "../../../lib/rust/logger" }
|
||||
enso-prelude = { path = "../../../lib/rust/prelude" }
|
||||
enso-shapely = { path = "../../../lib/rust/shapely" }
|
||||
engine-protocol = { path = "../controller/engine-protocol" }
|
||||
ensogl = { path = "../../../lib/rust/ensogl" }
|
||||
ensogl-component = { path = "../../../lib/rust/ensogl/component" }
|
||||
@ -30,10 +30,7 @@ ordered-float = { version = "2.7.0" }
|
||||
serde_json = { version = "1.0" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
uuid = { version = "0.8", features = ["serde", "v4", "wasm-bindgen"] }
|
||||
wasm-bindgen = { version = "0.2.78", features = [
|
||||
"nightly",
|
||||
"serde-serialize"
|
||||
] }
|
||||
wasm-bindgen = { version = "0.2.78", features = ["nightly", "serde-serialize"] }
|
||||
welcome-screen = { path = "welcome-screen" }
|
||||
|
||||
[dependencies.web-sys]
|
||||
|
@ -16,4 +16,3 @@ ensogl-hardcoded-theme = { version = "0.1.0", path = "../../../../../lib/rust/en
|
||||
ensogl-list-view = { version = "0.1.0", path = "../../../../../lib/rust/ensogl/component/list-view" }
|
||||
ensogl-text = { version = "0.1.0", path = "../../../../../lib/rust/ensogl/component/text" }
|
||||
ensogl-label = { path = "../../../../../lib/rust/ensogl/component/label/" }
|
||||
|
||||
|
@ -14,10 +14,10 @@ base64 = "0.13"
|
||||
bimap = { version = "0.4.0" }
|
||||
enso-config = { version = "0.1.0", path = "../../config" }
|
||||
enso-frp = { version = "0.1.0", path = "../../../../lib/rust/frp" }
|
||||
enso-logger = { path = "../../../../lib/rust/logger"}
|
||||
enso-logger = { path = "../../../../lib/rust/logger" }
|
||||
enso-prelude = { path = "../../../../lib/rust/prelude", features = ["serde"] }
|
||||
engine-protocol = { version = "0.1.0", path = "../../controller/engine-protocol" }
|
||||
enso-shapely = { path = "../../../../lib/rust/shapely"}
|
||||
enso-shapely = { path = "../../../../lib/rust/shapely" }
|
||||
enso-text = { version = "0.1.0", path = "../../../../lib/rust/text" }
|
||||
ensogl = { version = "0.1.0", path = "../../../../lib/rust/ensogl" }
|
||||
ensogl-component = { path = "../../../../lib/rust/ensogl/component" }
|
||||
@ -25,7 +25,7 @@ ensogl-text-msdf-sys = { version = "0.1.0", path = "../../../../lib/rust/ensogl/
|
||||
ensogl-hardcoded-theme = { version = "0.1.0", path = "../../../../lib/rust/ensogl/app/theme/hardcoded" }
|
||||
ensogl-drop-manager = { version = "0.1.0", path = "../../../../lib/rust/ensogl/component/drop-manager" }
|
||||
failure = { version = "0.1.8" }
|
||||
ordered-float = {version = "1.0"}
|
||||
ordered-float = { version = "1.0" }
|
||||
span-tree = { version = "0.1.0", path = "../../language/span-tree" }
|
||||
js-sys = { version = "0.3.28" }
|
||||
nalgebra = { version = "0.26.1", features = ["serde-serialize"] }
|
||||
|
@ -10,8 +10,5 @@ crate-type = ["cdylib", "rlib"]
|
||||
[dependencies]
|
||||
ensogl = { path = "../../../../lib/rust/ensogl" }
|
||||
enso-frp = { path = "../../../../lib/rust/frp" }
|
||||
wasm-bindgen = { version = "0.2.78", features = [
|
||||
"nightly",
|
||||
"serde-serialize"
|
||||
] }
|
||||
wasm-bindgen = { version = "0.2.78", features = ["nightly", "serde-serialize"] }
|
||||
web-sys = { version = "0.3.4", features = [] }
|
||||
|
@ -2,5 +2,5 @@
|
||||
* Configuration options that are only used by the JavaScript part of the project.
|
||||
*/
|
||||
|
||||
exports.defaultLogServerPort = 20060
|
||||
exports.defaultLogServerHost = `localhost:${exports.defaultLogServerPort}`
|
||||
export const defaultLogServerPort = 20060
|
||||
export const defaultLogServerHost = `localhost:${defaultLogServerPort}`
|
||||
|
@ -1,9 +0,0 @@
|
||||
{
|
||||
"command": {
|
||||
"bootstrap": {
|
||||
"hoist": true
|
||||
}
|
||||
},
|
||||
"packages": ["lib/*"],
|
||||
"version": "0.0.0"
|
||||
}
|
@ -1,56 +1,29 @@
|
||||
const fss = require('fs')
|
||||
// This file cannot be made ES6 module due to: https://github.com/develar/read-config-file/issues/10
|
||||
|
||||
function get_build_config() {
|
||||
const buildInfoPath = paths.dist.buildInfo
|
||||
import path from 'node:path'
|
||||
import fs from 'node:fs'
|
||||
|
||||
let exists = fss.existsSync(buildInfoPath)
|
||||
if (exists) {
|
||||
let configFile = fss.readFileSync(buildInfoPath)
|
||||
return JSON.parse(configFile.toString())
|
||||
}
|
||||
}
|
||||
const build = get_build_config()
|
||||
import { require_env } from '../../utils.mjs'
|
||||
import { project_manager_bundle } from './paths.mjs'
|
||||
import build from '../../build.json' assert { type: 'json' }
|
||||
|
||||
let config = {
|
||||
name: 'Enso',
|
||||
description: 'Enso Data Processing Environment.',
|
||||
main: 'index.js',
|
||||
const dist = require_env('ENSO_BUILD_IDE')
|
||||
const gui = require_env('ENSO_BUILD_GUI')
|
||||
const icons = require_env('ENSO_BUILD_ICONS')
|
||||
const project_manager = require_env('ENSO_BUILD_PROJECT_MANAGER')
|
||||
|
||||
dependencies: {
|
||||
'create-servers': '^3.1.0',
|
||||
'electron-is-dev': '^1.1.0',
|
||||
'enso-studio-common': '1.0.0',
|
||||
'enso-studio-content': '1.0.0',
|
||||
'enso-studio-icons': '1.0.0',
|
||||
yargs: '^15.3.0',
|
||||
},
|
||||
|
||||
devDependencies: {
|
||||
'compression-webpack-plugin': '^3.1.0',
|
||||
'copy-webpack-plugin': '^5.1.1',
|
||||
devtron: '^1.4.0',
|
||||
electron: '17.1.0',
|
||||
'electron-builder': '^23.0.6',
|
||||
'crypto-js': '4.0.0',
|
||||
'electron-notarize': '1.1.1',
|
||||
},
|
||||
|
||||
scripts: {
|
||||
start: `electron ${paths.dist.content} -- `,
|
||||
build: 'webpack ',
|
||||
dist: 'electron-builder --publish never' + ' --' + build.target,
|
||||
},
|
||||
}
|
||||
|
||||
config.build = {
|
||||
const config = {
|
||||
appId: 'org.enso',
|
||||
productName: 'Enso',
|
||||
copyright: 'Copyright © 2021 ${author}.',
|
||||
extraMetadata: {
|
||||
version: build.version,
|
||||
},
|
||||
copyright: 'Copyright © 2022 ${author}.',
|
||||
artifactName: 'enso-${os}-${version}.${ext}',
|
||||
mac: {
|
||||
// We do not use compression as the build time is huge and file size saving is almost zero.
|
||||
target: ['dmg'],
|
||||
icon: `${paths.dist.root}/icons/icon.icns`,
|
||||
icon: `${icons}/icon.icns`,
|
||||
category: 'public.app-category.developer-tools',
|
||||
darkModeSupport: true,
|
||||
type: 'distribution',
|
||||
@ -68,16 +41,26 @@ config.build = {
|
||||
win: {
|
||||
// We do not use compression as the build time is huge and file size saving is almost zero.
|
||||
target: ['nsis'],
|
||||
icon: `${paths.dist.root}/icons/icon.ico`,
|
||||
icon: `${icons}/icon.ico`,
|
||||
},
|
||||
linux: {
|
||||
// We do not use compression as the build time is huge and file size saving is almost zero.
|
||||
target: ['AppImage'],
|
||||
icon: `${paths.dist.root}/icons/png`,
|
||||
icon: `${icons}/png`,
|
||||
category: 'Development',
|
||||
},
|
||||
files: [{ from: paths.dist.content, to: '.' }],
|
||||
extraResources: [{ from: paths.dist.bin, to: '.', filter: ['!**.tar.gz', '!**.zip'] }],
|
||||
files: [
|
||||
'!**/node_modules/**/*',
|
||||
{ from: `${gui}/`, to: '.' },
|
||||
{ from: `${dist}/client`, to: '.' },
|
||||
],
|
||||
extraResources: [
|
||||
{
|
||||
from: `${project_manager}/`,
|
||||
to: project_manager_bundle,
|
||||
filter: ['!**.tar.gz', '!**.zip'],
|
||||
},
|
||||
],
|
||||
fileAssociations: [
|
||||
{
|
||||
ext: 'enso',
|
||||
@ -86,7 +69,7 @@ config.build = {
|
||||
},
|
||||
],
|
||||
directories: {
|
||||
output: paths.dist.client,
|
||||
output: `${dist}`,
|
||||
},
|
||||
nsis: {
|
||||
// Disables "block map" generation during electron building. Block maps
|
||||
@ -114,12 +97,11 @@ config.build = {
|
||||
// https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/
|
||||
sign: false,
|
||||
},
|
||||
publish: [],
|
||||
afterAllArtifactBuild: 'tasks/computeHashes.js',
|
||||
afterPack: 'tasks/prepareToSign.js',
|
||||
// Notarizing has been disabled due to reasons described in the relevant issue:
|
||||
// https://github.com/enso-org/ide/issues/1839
|
||||
// afterSign: "tasks/notarize.js",
|
||||
afterAllArtifactBuild: path.join('tasks', 'computeHashes.js'),
|
||||
|
||||
// TODO [mwu]: Temporarily disabled, signing should be revised.
|
||||
// In particular, engine should handle signing of its artifacts.
|
||||
// afterPack: 'tasks/prepareToSign.js',
|
||||
}
|
||||
|
||||
module.exports = { config }
|
||||
fs.writeFileSync('electron-builder-config.json', JSON.stringify(config, null, 2))
|
8792
app/ide-desktop/lib/client/package-lock.json
generated
8792
app/ide-desktop/lib/client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
37
app/ide-desktop/lib/client/package.json
Normal file
37
app/ide-desktop/lib/client/package.json
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"version": "0.0.0-dev",
|
||||
"author": {
|
||||
"name": "Enso Team",
|
||||
"email": "contact@enso.org"
|
||||
},
|
||||
"homepage": "https://github.com/enso-org/ide",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:enso-org/ide.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/enso-org/ide/issues"
|
||||
},
|
||||
"name": "enso",
|
||||
"description": "Enso Data Processing Environment.",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"create-servers": "^3.1.0",
|
||||
"electron-is-dev": "^1.1.0",
|
||||
"yargs": "^15.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"compression-webpack-plugin": "^9.2.0",
|
||||
"copy-webpack-plugin": "^10.2.4",
|
||||
"electron": "17.1.0",
|
||||
"electron-builder": "^23.0.6",
|
||||
"crypto-js": "4.1.1",
|
||||
"electron-notarize": "1.1.1",
|
||||
"webpack": "^5.72.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "electron ../../../../dist/content -- ",
|
||||
"build": "webpack ",
|
||||
"dist": "node electron-builder-config.mjs && electron-builder --publish never --config electron-builder-config.json"
|
||||
}
|
||||
}
|
11
app/ide-desktop/lib/client/paths.mjs
Normal file
11
app/ide-desktop/lib/client/paths.mjs
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* This module defines paths within the client distribution's resources.
|
||||
*
|
||||
* This is knowledge that is common to code building the client package and the packaged code itself.
|
||||
*
|
||||
*/
|
||||
|
||||
import path from 'path'
|
||||
|
||||
/** Path to the Project Manager bundle. */
|
||||
export const project_manager_bundle = 'enso'
|
@ -1,18 +1,16 @@
|
||||
'use strict'
|
||||
|
||||
import cfg from '../../../config'
|
||||
import * as assert from 'assert'
|
||||
import * as buildCfg from '../../../../../dist/build.json'
|
||||
import * as Electron from 'electron'
|
||||
import * as isDev from 'electron-is-dev'
|
||||
import * as path from 'path'
|
||||
import * as pkg from '../package.json'
|
||||
import * as rootCfg from '../../../package.json'
|
||||
import { defaultLogServerHost } from '../../../config'
|
||||
import assert from 'assert'
|
||||
import buildCfg from '../../../build.json'
|
||||
import Electron from 'electron'
|
||||
import isDev from 'electron-is-dev'
|
||||
import path from 'path'
|
||||
import * as Server from 'enso-studio-common/src/server'
|
||||
import * as util from 'util'
|
||||
import * as yargs from 'yargs'
|
||||
import util from 'util'
|
||||
import yargs from 'yargs'
|
||||
|
||||
import paths from '../../../../../build/paths'
|
||||
import { project_manager_bundle } from '../paths.mjs'
|
||||
|
||||
const child_process = require('child_process')
|
||||
const fss = require('fs')
|
||||
@ -23,6 +21,11 @@ const fss = require('fs')
|
||||
|
||||
const root = Electron.app.getAppPath()
|
||||
const resources = path.join(root, '..')
|
||||
const project_manager_executable = path.join(
|
||||
resources,
|
||||
project_manager_bundle,
|
||||
PROJECT_MANAGER_IN_BUNDLE_PATH
|
||||
)
|
||||
|
||||
// FIXME default options parsed wrong
|
||||
// https://github.com/yargs/yargs/issues/1590
|
||||
@ -60,9 +63,9 @@ const trustedHosts = [
|
||||
// =====================
|
||||
|
||||
let usage = `
|
||||
${pkg.build.productName} ${rootCfg.version} command line interface.
|
||||
${buildCfg.name} ${buildCfg.version} command line interface.
|
||||
|
||||
Usage: ${pkg.build.productName} [options] [--] [backend args]...
|
||||
Usage: ${buildCfg.name} [options] [--] [backend args]...
|
||||
`
|
||||
|
||||
let epilogue = `
|
||||
@ -213,7 +216,7 @@ optParser.options('crash-report-host', {
|
||||
'The address of the server that will receive crash reports. ' +
|
||||
'Consists of a hostname, optionally followed by a ":" and a port number',
|
||||
requiresArg: true,
|
||||
default: cfg.defaultLogServerHost,
|
||||
default: defaultLogServerHost,
|
||||
})
|
||||
|
||||
optParser.options('data-gathering', {
|
||||
@ -222,6 +225,12 @@ optParser.options('data-gathering', {
|
||||
default: true,
|
||||
})
|
||||
|
||||
optParser.options('preferred-engine-version', {
|
||||
describe: 'The Engine version that IDE will try to use for newly created projects',
|
||||
type: 'string',
|
||||
default: BUNDLED_ENGINE_VERSION,
|
||||
})
|
||||
|
||||
// === Parsing ===
|
||||
|
||||
function parseCmdArgs() {
|
||||
@ -260,8 +269,8 @@ if (args.windowSize) {
|
||||
// ==================
|
||||
|
||||
let versionInfo = {
|
||||
version: rootCfg.version,
|
||||
build: buildCfg.buildVersion,
|
||||
version: buildCfg.version,
|
||||
build: buildCfg.commit,
|
||||
electron: process.versions.electron,
|
||||
chrome: process.versions.chrome,
|
||||
}
|
||||
@ -372,15 +381,11 @@ Electron.app.on('web-contents-created', (event, contents) => {
|
||||
// =======================
|
||||
|
||||
function projectManagerPath() {
|
||||
let binPath = args['backend-path']
|
||||
if (!binPath) {
|
||||
binPath = paths.get_project_manager_path(resources)
|
||||
}
|
||||
let binPath = args['backend-path'] ?? project_manager_executable
|
||||
let binExists = fss.existsSync(binPath)
|
||||
assert(binExists, `Could not find the project manager binary at ${binPath}.`)
|
||||
return binPath
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the Project Manager with given arguments.
|
||||
*
|
||||
@ -530,6 +535,7 @@ function createWindow() {
|
||||
high_contrast: Electron.nativeTheme.shouldUseHighContrastColors,
|
||||
crash_report_host: args.crashReportHost,
|
||||
data_gathering: args.dataGathering,
|
||||
preferred_engine_version: args.preferredEngineVersion,
|
||||
node_labels: args.nodeLabels,
|
||||
verbose: args.verbose,
|
||||
}
|
||||
@ -650,9 +656,9 @@ Electron.app.on('web-contents-created', (webContentsCreatedEvent, webContents) =
|
||||
let ctrl_q = !meta && control && !alt && !shift && code === 'KeyQ'
|
||||
let alt_f4 = !meta && !control && alt && !shift && code === 'F4'
|
||||
let ctrl_w = !meta && control && !alt && !shift && code === 'KeyW'
|
||||
let quit_on_mac = process.platform == 'darwin' && (cmd_q || alt_f4)
|
||||
let quit_on_win = process.platform == 'win32' && (alt_f4 || ctrl_w)
|
||||
let quit_on_lin = process.platform == 'linux' && (alt_f4 || ctrl_q || ctrl_w)
|
||||
let quit_on_mac = process.platform === 'darwin' && (cmd_q || alt_f4)
|
||||
let quit_on_win = process.platform === 'win32' && (alt_f4 || ctrl_w)
|
||||
let quit_on_lin = process.platform === 'linux' && (alt_f4 || ctrl_q || ctrl_w)
|
||||
let quit = quit_on_mac || quit_on_win || quit_on_lin
|
||||
if (quit) {
|
||||
Electron.app.quit()
|
||||
|
@ -1,7 +1,6 @@
|
||||
const crypto = require('crypto')
|
||||
const fs = require('fs')
|
||||
const glob = require('glob')
|
||||
const paths = require('../../../../../build/paths')
|
||||
const path = require('path')
|
||||
|
||||
// =================
|
||||
// === Constants ===
|
||||
@ -28,9 +27,16 @@ function getChecksum(path, type) {
|
||||
})
|
||||
}
|
||||
|
||||
// Based on https://stackoverflow.com/a/57371333
|
||||
function changeExtension(file, extension) {
|
||||
const basename = path.basename(file, path.extname(file))
|
||||
return path.join(path.dirname(file), `${basename}.${extension}`)
|
||||
}
|
||||
|
||||
async function writeFileChecksum(path, type) {
|
||||
let checksum = await getChecksum(path, type)
|
||||
let targetPath = `${path}.${type}`
|
||||
let targetPath = changeExtension(path, type)
|
||||
console.log(`Writing ${targetPath}.`)
|
||||
fs.writeFile(targetPath, checksum, 'utf8', err => {
|
||||
if (err) {
|
||||
throw err
|
||||
@ -42,9 +48,9 @@ async function writeFileChecksum(path, type) {
|
||||
// === Callback ===
|
||||
// ================
|
||||
|
||||
exports.default = async function () {
|
||||
let files = glob.sync(paths.dist.client + '/*.{dmg,exe,AppImage}')
|
||||
for (let file of files) {
|
||||
exports.default = async function (context) {
|
||||
// `context` is BuildResult, see https://www.electron.build/configuration/configuration.html#buildresult
|
||||
for (let file of context.artifactPaths) {
|
||||
console.log(`Generating ${CHECKSUM_TYPE} checksum for ${file}.`)
|
||||
await writeFileChecksum(file, CHECKSUM_TYPE)
|
||||
}
|
||||
|
@ -16,19 +16,25 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const child_process = require('child_process')
|
||||
const { dist } = require('../../../../../build/paths')
|
||||
const { ENGINE_VERSION } = require('../../../../../build/release')
|
||||
const { engineVersion } = require('../../../build.json')
|
||||
|
||||
const dist_var_name = 'ENSO_BUILD_IDE'
|
||||
const dist =
|
||||
process.env[dist_var_name] ??
|
||||
(() => {
|
||||
throw Error(`Missing ${dist_var_name} environment variable.`)
|
||||
})()
|
||||
|
||||
// `electron-builder`'s output directory name.
|
||||
function contentDirName() {
|
||||
if (process.arch == 'arm64') {
|
||||
if (process.arch === 'arm64') {
|
||||
return 'mac-arm64'
|
||||
} else {
|
||||
return 'mac'
|
||||
}
|
||||
}
|
||||
|
||||
const contentRoot = path.join(dist.root, 'client', contentDirName(), 'Enso.app', 'Contents')
|
||||
const contentRoot = path.join(dist, 'client', contentDirName(), 'Enso.app', 'Contents')
|
||||
const resRoot = path.join(contentRoot, 'Resources')
|
||||
|
||||
const ID = '"Developer ID Application: New Byte Order Sp. z o. o. (NM77WTZJFQ)"'
|
||||
@ -117,7 +123,7 @@ function signArchive(archivePath, archiveName, binPaths) {
|
||||
// message provided by Apple and can then be added here.
|
||||
const toSign = [
|
||||
{
|
||||
jarDir: `enso/dist/${ENGINE_VERSION}/lib/Standard/Database/${ENGINE_VERSION}/polyglot/java`,
|
||||
jarDir: `enso/dist/${engineVersion}/lib/Standard/Database/${engineVersion}/polyglot/java`,
|
||||
jarName: 'sqlite-jdbc-3.34.0.jar',
|
||||
jarContent: [
|
||||
'org/sqlite/native/Mac/aarch64/libsqlitejdbc.jnilib',
|
||||
@ -125,7 +131,7 @@ const toSign = [
|
||||
],
|
||||
},
|
||||
{
|
||||
jarDir: `enso/dist/${ENGINE_VERSION}/component`,
|
||||
jarDir: `enso/dist/${engineVersion}/component`,
|
||||
jarName: 'runner.jar',
|
||||
jarContent: [
|
||||
'org/sqlite/native/Mac/x86_64/libsqlitejdbc.jnilib',
|
||||
|
@ -1,33 +0,0 @@
|
||||
const Copy = require('copy-webpack-plugin')
|
||||
const path = require('path')
|
||||
const paths = require('../../../../build/paths')
|
||||
|
||||
const thisPath = path.resolve(__dirname)
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
index: path.resolve(thisPath, 'src', 'index.js'),
|
||||
},
|
||||
mode: 'production',
|
||||
target: 'electron-main',
|
||||
output: {
|
||||
path: paths.dist.content,
|
||||
filename: '[name].js',
|
||||
},
|
||||
plugins: [
|
||||
new Copy([
|
||||
{
|
||||
from: path.resolve(thisPath, 'package.json'),
|
||||
to: paths.dist.packageJson,
|
||||
},
|
||||
{
|
||||
from: path.resolve(thisPath, 'src', 'preload.js'),
|
||||
to: paths.dist.preload,
|
||||
},
|
||||
]),
|
||||
],
|
||||
performance: {
|
||||
hints: false,
|
||||
},
|
||||
stats: 'minimal',
|
||||
}
|
47
app/ide-desktop/lib/client/webpack.config.mjs
Normal file
47
app/ide-desktop/lib/client/webpack.config.mjs
Normal file
@ -0,0 +1,47 @@
|
||||
import path, { dirname } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { createRequire } from 'node:module'
|
||||
|
||||
import webpack from 'webpack'
|
||||
import CopyPlugin from 'copy-webpack-plugin'
|
||||
import { require_env } from '../../utils.mjs'
|
||||
|
||||
const thisPath = path.resolve(dirname(fileURLToPath(import.meta.url)))
|
||||
const dist = path.resolve(require_env('ENSO_BUILD_IDE'), 'client')
|
||||
const project_manager_in_bundle_path = require_env('ENSO_BUILD_PROJECT_MANAGER_IN_BUNDLE_PATH')
|
||||
const bundled_engine_version = process.env['ENSO_BUILD_IDE_BUNDLED_ENGINE_VERSION']
|
||||
|
||||
export default {
|
||||
entry: {
|
||||
index: path.resolve(thisPath, 'src', 'index.js'),
|
||||
},
|
||||
mode: 'production',
|
||||
target: 'electron-main',
|
||||
output: {
|
||||
path: dist,
|
||||
filename: '[name].js',
|
||||
},
|
||||
plugins: [
|
||||
new CopyPlugin({
|
||||
patterns: [
|
||||
{
|
||||
from: path.resolve(thisPath, 'package.json'),
|
||||
to: path.join(dist, 'package.json'),
|
||||
},
|
||||
{
|
||||
from: path.resolve(thisPath, 'src', 'preload.js'),
|
||||
to: path.join(dist, 'preload.js'),
|
||||
},
|
||||
],
|
||||
options: {},
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
BUNDLED_ENGINE_VERSION: JSON.stringify(bundled_engine_version),
|
||||
PROJECT_MANAGER_IN_BUNDLE_PATH: JSON.stringify(project_manager_in_bundle_path),
|
||||
}),
|
||||
],
|
||||
performance: {
|
||||
hints: false,
|
||||
},
|
||||
stats: 'minimal',
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
let config = {
|
||||
version: '1.0.0',
|
||||
name: 'enso-studio-common',
|
||||
}
|
||||
|
||||
module.exports = { config }
|
20
app/ide-desktop/lib/common/package.json
Normal file
20
app/ide-desktop/lib/common/package.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "Enso Team",
|
||||
"email": "contact@enso.org"
|
||||
},
|
||||
"homepage": "https://github.com/enso-org/ide",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:enso-org/ide.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/enso-org/ide/issues"
|
||||
},
|
||||
"name": "enso-studio-common",
|
||||
"dependencies": {
|
||||
"mime-types": "^2.1.35",
|
||||
"portfinder": "^1.0.28"
|
||||
}
|
||||
}
|
@ -5,3 +5,4 @@ messagingSenderId: "451746386966"
|
||||
appId: "1:451746386966:web:558a832abe486208d61137"
|
||||
measurementId: "G-W11ZNCQ476"
|
||||
clientId: "451746386966-u5piv17hgvnimpq5ic5p60liekcqmqmu.apps.googleusercontent.com"
|
||||
apiKey: "AIzaSyA99Ap9yN-RmNeb6dYIiUYPTCamLAZxTQ8"
|
||||
|
20
app/ide-desktop/lib/content/package-lock.json
generated
20
app/ide-desktop/lib/content/package-lock.json
generated
@ -8,24 +8,10 @@
|
||||
"name": "enso-studio-content",
|
||||
"version": "1.0.0",
|
||||
"devDependencies": {
|
||||
"typescript": "^4.0.2",
|
||||
"webpack": "^4.44.1",
|
||||
"webpack-cli": "^3.3.12"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.2.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz",
|
||||
"integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/webpack": {
|
||||
"version": "4.46.0",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-4.46.0.tgz",
|
||||
@ -5882,12 +5868,6 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"typescript": {
|
||||
"version": "4.2.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz",
|
||||
"integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==",
|
||||
"dev": true
|
||||
},
|
||||
"webpack": {
|
||||
"version": "4.46.0",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-4.46.0.tgz",
|
||||
|
@ -1,28 +0,0 @@
|
||||
let config = {
|
||||
name: 'enso-studio-content',
|
||||
version: '1.0.0',
|
||||
scripts: {
|
||||
build: 'npx webpack',
|
||||
watch: 'npx webpack-dev-server',
|
||||
},
|
||||
dependencies: {
|
||||
'enso-studio-common': '1.0.0',
|
||||
firebase: '^8.6.8',
|
||||
firebaseui: '^4.8.0',
|
||||
'copy-webpack-plugin': '^5.1.1',
|
||||
'html-loader': '^1.3.2',
|
||||
'mixpanel-browser': '2.40.1',
|
||||
},
|
||||
devDependencies: {
|
||||
'compression-webpack-plugin': '^3.1.0',
|
||||
'copy-webpack-plugin': '^5.1.1',
|
||||
'yaml-loader': '^0.6.0',
|
||||
'source-map-loader': '^1.0.0',
|
||||
'ts-loader': '^8.0.3',
|
||||
typescript: '^4.0.2',
|
||||
webpack: '^4.44.1',
|
||||
'webpack-cli': '^3.3.12',
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = { config }
|
40
app/ide-desktop/lib/content/package.json
Normal file
40
app/ide-desktop/lib/content/package.json
Normal file
@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "enso-studio-content",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "Enso Team",
|
||||
"email": "contact@enso.org"
|
||||
},
|
||||
"homepage": "https://github.com/enso-org/ide",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:enso-org/ide.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/enso-org/ide/issues"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npx webpack",
|
||||
"watch": "npx webpack-dev-server"
|
||||
},
|
||||
"dependencies": {
|
||||
"enso-studio-common": "1.0.0",
|
||||
"firebase": "^8.6.8",
|
||||
"firebaseui": "^4.8.0",
|
||||
"html-loader": "^1.3.2",
|
||||
"mixpanel-browser": "2.40.1",
|
||||
"@types/semver": "^7.3.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"compression-webpack-plugin": "^9.2.0",
|
||||
"copy-webpack-plugin": "^10.2.4",
|
||||
"node-polyfill-webpack-plugin": "^1.1.4",
|
||||
"yaml-loader": "^0.6.0",
|
||||
"source-map-loader": "^3.0.1",
|
||||
"ts-loader": "^9.2.8",
|
||||
"typescript": "^4.6.3",
|
||||
"webpack": "^5.72.0",
|
||||
"webpack-cli": "^4.9.2",
|
||||
"webpack-dev-server": "4.8.1"
|
||||
}
|
||||
}
|
@ -7,18 +7,23 @@ import * as loader_module from 'enso-studio-common/src/loader'
|
||||
// @ts-ignore
|
||||
import * as html_utils from 'enso-studio-common/src/html_utils'
|
||||
// @ts-ignore
|
||||
import * as globalConfig from '../../../../gui/config.yaml'
|
||||
import globalConfig from '../../../../gui/config.yaml'
|
||||
// @ts-ignore
|
||||
import cfg from '../../../config'
|
||||
import { defaultLogServerHost } from '../../../config'
|
||||
// @ts-ignore
|
||||
import assert from 'assert'
|
||||
// @ts-ignore
|
||||
import buildCfg from '../../../build.json'
|
||||
|
||||
// @ts-ignore
|
||||
import firebase from 'firebase/app'
|
||||
// @ts-ignore
|
||||
import 'firebase/auth'
|
||||
// @ts-ignore
|
||||
import semver from 'semver'
|
||||
|
||||
import * as semver from 'semver'
|
||||
import { SemVer, Comparator } from 'semver'
|
||||
|
||||
const authInfo = 'auth-info'
|
||||
|
||||
// ==================
|
||||
// === Global API ===
|
||||
@ -474,42 +479,17 @@ class ErrorDetails {
|
||||
/// Utility methods helping to work with the versions.
|
||||
class Versions {
|
||||
/// Development version.
|
||||
static devVersion = semver.coerce('0.0.0')
|
||||
/// Version of the `client` js package.
|
||||
static clientVersion = require('../../client/package.json').version
|
||||
static devVersion = new SemVer('0.0.0')
|
||||
static devPrerelease = 'dev'
|
||||
|
||||
/// Compare the application version with the minimum supported version and
|
||||
/// return `true` if the application version is supported, i.e. greater or
|
||||
/// equal than the minimum supported version.
|
||||
static compare(minSupportedVersion: string, applicationVersion: string): boolean {
|
||||
const appVersion = semver.clean(applicationVersion, { loose: true })
|
||||
if (ok(appVersion)) {
|
||||
if (semver.eq(appVersion, Versions.devVersion)) {
|
||||
return true
|
||||
} else {
|
||||
const minVersion = semver.clean(minSupportedVersion, { loose: true })
|
||||
if (ok(minVersion)) {
|
||||
return semver.gte(appVersion, minVersion)
|
||||
} else {
|
||||
throw new ErrorDetails('Failed to parse app version.', { applicationVersion })
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new ErrorDetails('Failed to parse minimum supported version.', {
|
||||
minSupportedVersion,
|
||||
})
|
||||
}
|
||||
}
|
||||
/// Version of the `client` js package.
|
||||
static ideVersion = new SemVer(buildCfg.version, { loose: true })
|
||||
|
||||
static isDevVersion(): boolean {
|
||||
const clientVersion = Versions.clientVersion
|
||||
const appVersion = semver.clean(clientVersion, { loose: true })
|
||||
if (ok(appVersion)) {
|
||||
return semver.eq(appVersion, Versions.devVersion)
|
||||
} else {
|
||||
console.error('Failed to parse applicationVersion.', { clientVersion })
|
||||
return false
|
||||
}
|
||||
const clientVersion = Versions.ideVersion
|
||||
const releaseDev = clientVersion.compareMain(Versions.devVersion) === 0
|
||||
const prereleaseDev = clientVersion.prerelease.toString().includes(Versions.devPrerelease)
|
||||
return releaseDev || prereleaseDev
|
||||
}
|
||||
}
|
||||
|
||||
@ -552,13 +532,16 @@ async function fetchApplicationConfig(url: string) {
|
||||
/// one of the compared versions does not match the semver scheme, it returns
|
||||
/// `true`.
|
||||
async function checkMinSupportedVersion(config: Config) {
|
||||
console.log(config)
|
||||
if (config.skip_min_version_check === true || Versions.isDevVersion()) {
|
||||
return true
|
||||
}
|
||||
try {
|
||||
const appConfig: any = await fetchApplicationConfig(config.application_config_url)
|
||||
const clientVersion = Versions.clientVersion
|
||||
const minSupportedVersion = appConfig.minimumSupportedVersion
|
||||
|
||||
console.log(`Application version check.`, { minSupportedVersion, clientVersion })
|
||||
return Versions.compare(minSupportedVersion, clientVersion)
|
||||
// const appConfig: any = await fetchApplicationConfig(config.application_config_url)
|
||||
// const clientVersion = Versions.ideVersion
|
||||
// const minSupportedVersion = appConfig.minimumSupportedVersion
|
||||
const comparator = new Comparator('>=2.0.0-alpha.6')
|
||||
return comparator.test(Versions.ideVersion)
|
||||
} catch (e) {
|
||||
console.error('Minimum version check failed.', e)
|
||||
return true
|
||||
@ -578,7 +561,7 @@ class FirebaseAuthentication {
|
||||
|
||||
constructor(authCallback: any) {
|
||||
this.firebaseui = require('firebaseui')
|
||||
this.config = this.getFirebaseConfig()
|
||||
this.config = require('../firebase.yaml')
|
||||
// initialize Firebase
|
||||
firebase.initializeApp(this.config)
|
||||
// create HTML markup
|
||||
@ -601,19 +584,6 @@ class FirebaseAuthentication {
|
||||
})
|
||||
}
|
||||
|
||||
protected getFirebaseConfig() {
|
||||
const config = require('../firebase.yaml')
|
||||
// @ts-ignore
|
||||
const firebaseApiKey = FIREBASE_API_KEY
|
||||
if (ok(firebaseApiKey) && firebaseApiKey.length > 0) {
|
||||
// @ts-ignore
|
||||
config['apiKey'] = firebaseApiKey
|
||||
return config
|
||||
} else {
|
||||
throw new Error('Empty FIREBASE_API_KEY')
|
||||
}
|
||||
}
|
||||
|
||||
protected hasEmailAuth(user: any): boolean {
|
||||
const emailProviderId = firebase.auth.EmailAuthProvider.PROVIDER_ID
|
||||
const hasEmailProvider = user.providerData.some(
|
||||
@ -700,13 +670,11 @@ class FirebaseAuthentication {
|
||||
/// ```
|
||||
protected createHtml() {
|
||||
const authContainer = 'auth-container'
|
||||
const authInfo = 'auth-info'
|
||||
const authHeader = 'auth-header'
|
||||
const authText = 'auth-text'
|
||||
const firebaseuiContainer = 'firebaseui-container'
|
||||
const userSignedOut = 'user-signed-out'
|
||||
const userEmailNotVerified = 'user-email-not-verified'
|
||||
const versionCheck = 'version-check'
|
||||
|
||||
const authHeaderText = document.createTextNode('Sign in to Enso')
|
||||
const authTextText = document.createTextNode(
|
||||
@ -715,9 +683,6 @@ class FirebaseAuthentication {
|
||||
const userEmailNotVerifiedText = document.createTextNode(
|
||||
'Verification link is sent. You can sign in after verifying your email.'
|
||||
)
|
||||
const versionCheckText = document.createTextNode(
|
||||
'This version is no longer supported. Please download a new one.'
|
||||
)
|
||||
|
||||
let root = document.getElementById('root')
|
||||
|
||||
@ -756,14 +721,7 @@ class FirebaseAuthentication {
|
||||
authContainerDiv.appendChild(userSignedOutDiv)
|
||||
authContainerDiv.appendChild(userEmailNotVerifiedDiv)
|
||||
|
||||
// div#version-check
|
||||
let versionCheckDiv = document.createElement('div')
|
||||
versionCheckDiv.id = versionCheck
|
||||
versionCheckDiv.className = authInfo
|
||||
versionCheckDiv.appendChild(versionCheckText)
|
||||
|
||||
root.appendChild(authContainerDiv)
|
||||
root.appendChild(versionCheckDiv)
|
||||
}
|
||||
}
|
||||
|
||||
@ -817,19 +775,23 @@ class Config {
|
||||
public email: string
|
||||
public application_config_url: string
|
||||
public test_workflow: string
|
||||
public skip_min_version_check: boolean
|
||||
public preferred_engine_version: SemVer
|
||||
|
||||
static default() {
|
||||
let config = new Config()
|
||||
config.use_loader = true
|
||||
config.wasm_url = '/assets/ide.wasm'
|
||||
config.wasm_glue_url = '/assets/wasm_imports.js'
|
||||
config.crash_report_host = cfg.defaultLogServerHost
|
||||
config.crash_report_host = defaultLogServerHost
|
||||
config.data_gathering = true
|
||||
config.is_in_cloud = false
|
||||
config.entry = null
|
||||
config.authentication_enabled = true
|
||||
config.authentication_enabled = !Versions.isDevVersion()
|
||||
config.application_config_url =
|
||||
'https://raw.githubusercontent.com/enso-org/ide/develop/config.json'
|
||||
'https://raw.githubusercontent.com/enso-org/ide/develop/config.json' // FIXME
|
||||
config.skip_min_version_check = false
|
||||
config.preferred_engine_version = Versions.ideVersion
|
||||
return config
|
||||
}
|
||||
|
||||
@ -882,6 +844,11 @@ class Config {
|
||||
this.test_workflow = ok(other.test_workflow)
|
||||
? tryAsString(other.test_workflow)
|
||||
: this.test_workflow
|
||||
this.skip_min_version_check = ok(other.skip_min_version_check)
|
||||
? tryAsBoolean(other.skip_min_version_check)
|
||||
: this.skip_min_version_check
|
||||
this.preferred_engine_version =
|
||||
semver.parse(other.preferred_engine_version) ?? this.preferred_engine_version
|
||||
}
|
||||
}
|
||||
|
||||
@ -969,6 +936,21 @@ async function runEntryPoint(config: Config) {
|
||||
}
|
||||
}
|
||||
|
||||
function createVersionCheckHtml() {
|
||||
// div#version-check
|
||||
const versionCheckText = document.createTextNode(
|
||||
'This version is no longer supported. Please download a new one.'
|
||||
)
|
||||
|
||||
let root = document.getElementById('root')
|
||||
let versionCheckDiv = document.createElement('div')
|
||||
versionCheckDiv.id = 'version-check'
|
||||
versionCheckDiv.className = authInfo
|
||||
versionCheckDiv.style.display = 'block'
|
||||
versionCheckDiv.appendChild(versionCheckText)
|
||||
root.appendChild(versionCheckDiv)
|
||||
}
|
||||
|
||||
API.main = async function (inputConfig: any) {
|
||||
const urlParams = new URLSearchParams(window.location.search)
|
||||
// @ts-ignore
|
||||
@ -979,7 +961,7 @@ API.main = async function (inputConfig: any) {
|
||||
config.updateFromObject(urlConfig)
|
||||
|
||||
if (await checkMinSupportedVersion(config)) {
|
||||
if (config.authentication_enabled && !Versions.isDevVersion()) {
|
||||
if (config.authentication_enabled) {
|
||||
new FirebaseAuthentication(function (user: any) {
|
||||
config.email = user.email
|
||||
runEntryPoint(config)
|
||||
@ -989,7 +971,6 @@ API.main = async function (inputConfig: any) {
|
||||
}
|
||||
} else {
|
||||
// Display a message asking to update the application.
|
||||
document.getElementById('auth-container').style.display = 'none'
|
||||
document.getElementById('version-check').style.display = 'block'
|
||||
createVersionCheckHtml()
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,25 @@
|
||||
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')
|
||||
import path, { dirname } from 'node:path'
|
||||
import child_process from 'node:child_process'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const thisPath = path.resolve(__dirname)
|
||||
import webpack from 'webpack'
|
||||
import CompressionPlugin from 'compression-webpack-plugin'
|
||||
import CopyWebpackPlugin from 'copy-webpack-plugin'
|
||||
import NodePolyfillPlugin from 'node-polyfill-webpack-plugin'
|
||||
|
||||
import { require_env } from '../../utils.mjs'
|
||||
import * as BUILD_INFO from '../../build.json' assert { type: 'json' }
|
||||
|
||||
const thisPath = path.resolve(dirname(fileURLToPath(import.meta.url)))
|
||||
|
||||
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(paths.dist.buildInfo, 'utf8'))
|
||||
const output_path = require_env('ENSO_BUILD_GUI')
|
||||
const wasm_path = require_env('ENSO_BUILD_GUI_WASM')
|
||||
const js_glue_path = require_env('ENSO_BUILD_GUI_JS_GLUE')
|
||||
const assets_path = require_env('ENSO_BUILD_GUI_ASSETS')
|
||||
|
||||
// scala-parser.js is compiled from Scala code, so no source map is available for it.
|
||||
const IGNORE_SOURCE_MAPS = [/scala-parser\.js/]
|
||||
@ -31,54 +39,56 @@ const sourceMapLoader = ignored => ({
|
||||
},
|
||||
})
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
entry: {
|
||||
index: path.resolve(thisPath, 'src', 'index.ts'),
|
||||
wasm_imports: './src/wasm_imports.js',
|
||||
},
|
||||
output: {
|
||||
path: paths.dist.assets,
|
||||
path: path.resolve(output_path, 'assets'),
|
||||
publicPath: '/assets/',
|
||||
filename: '[name].js',
|
||||
libraryTarget: 'umd',
|
||||
},
|
||||
node: {
|
||||
fs: 'empty',
|
||||
},
|
||||
plugins: [
|
||||
new CompressionPlugin(),
|
||||
new CopyWebpackPlugin([
|
||||
path.resolve(thisPath, 'src', 'index.html'),
|
||||
path.resolve(thisPath, 'src', 'run.js'),
|
||||
path.resolve(thisPath, 'src', 'style.css'),
|
||||
path.resolve(thisPath, 'src', 'docsStyle.css'),
|
||||
path.resolve(thisPath, 'assets'),
|
||||
paths.dist.wasm.main,
|
||||
]),
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
path.resolve(thisPath, 'src', 'index.html'),
|
||||
path.resolve(thisPath, 'src', 'run.js'),
|
||||
path.resolve(thisPath, 'src', 'style.css'),
|
||||
path.resolve(thisPath, 'src', 'docsStyle.css'),
|
||||
assets_path,
|
||||
wasm_path,
|
||||
],
|
||||
options: {},
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
GIT_HASH: JSON.stringify(git('rev-parse HEAD')),
|
||||
GIT_STATUS: JSON.stringify(git('status --short --porcelain')),
|
||||
BUILD_INFO: JSON.stringify(BUILD_INFO),
|
||||
FIREBASE_API_KEY: JSON.stringify(process.env.FIREBASE_API_KEY),
|
||||
}),
|
||||
new NodePolyfillPlugin({}),
|
||||
],
|
||||
devtool: 'eval-source-map',
|
||||
devServer: {
|
||||
publicPath: '/assets/',
|
||||
historyApiFallback: {
|
||||
index: '/assets/',
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
wasm_rust_glue$: paths.dist.wasm.glue,
|
||||
wasm_rust_glue$: js_glue_path,
|
||||
},
|
||||
extensions: ['.ts', '.js'],
|
||||
fallback: {
|
||||
fs: false,
|
||||
},
|
||||
},
|
||||
performance: {
|
||||
hints: false,
|
||||
},
|
||||
mode: 'none',
|
||||
stats: 'minimal',
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
@ -95,11 +105,14 @@ module.exports = {
|
||||
test: /\.html$/i,
|
||||
loader: 'html-loader',
|
||||
},
|
||||
{
|
||||
test: [/\.js$/, /\.tsx?$/],
|
||||
enforce: 'pre',
|
||||
loader: sourceMapLoader(IGNORE_SOURCE_MAPS),
|
||||
},
|
||||
Object.assign(
|
||||
{
|
||||
test: [/\.js$/, /\.tsx?$/],
|
||||
enforce: 'pre',
|
||||
exclude: /node_modules[\\\/]@firebase/,
|
||||
},
|
||||
sourceMapLoader(IGNORE_SOURCE_MAPS)
|
||||
),
|
||||
],
|
||||
},
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
let config = {
|
||||
name: 'enso-studio-icons',
|
||||
version: '1.0.0',
|
||||
scripts: {
|
||||
build: 'node src/index.js',
|
||||
},
|
||||
devDependencies: {
|
||||
sharp: '^0.29.3',
|
||||
'to-ico': '^1.1.5',
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = { config }
|
24
app/ide-desktop/lib/icons/package.json
Normal file
24
app/ide-desktop/lib/icons/package.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "enso-studio-icons",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "Enso Team",
|
||||
"email": "contact@enso.org"
|
||||
},
|
||||
"homepage": "https://github.com/enso-org/ide",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:enso-org/ide.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/enso-org/ide/issues"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node src/index.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"sharp": "^0.29.3",
|
||||
"to-ico": "^1.1.5"
|
||||
},
|
||||
"type": "module"
|
||||
}
|
@ -1,6 +1,16 @@
|
||||
/// This file generates the product logo as SVG and then converts it to set of PNGs, MacOS ICNS, and
|
||||
/// Windows ICO formats.
|
||||
|
||||
import { default as fss } from 'fs'
|
||||
import { promises as fs } from 'fs'
|
||||
|
||||
import { execSync } from 'child_process'
|
||||
import { default as toIco } from 'to-ico'
|
||||
import { default as sharp } from 'sharp'
|
||||
import { platform } from 'os'
|
||||
import path from 'path'
|
||||
import url from 'url'
|
||||
|
||||
class Logo {
|
||||
constructor(size = 64, compatibleMode = true) {
|
||||
this.xsize = size
|
||||
@ -111,41 +121,34 @@ class AppLogo extends Logo {
|
||||
}
|
||||
}
|
||||
|
||||
fastGenerate =
|
||||
const fastGenerate =
|
||||
cons =>
|
||||
(...args) =>
|
||||
new cons(...args).generate()
|
||||
|
||||
exports.generateMinimalWhiteLogo = fastGenerate(AppLogo)
|
||||
function generateMinimalWhiteLogo() {
|
||||
return fastGenerate(AppLogo)
|
||||
}
|
||||
|
||||
const fss = require('fs')
|
||||
const fs = fss.promises
|
||||
const execSync = require('child_process').execSync
|
||||
const toIco = require('to-ico')
|
||||
const sharp = require('sharp')
|
||||
const path = require('path')
|
||||
const platform = require('os').platform
|
||||
|
||||
const thisPath = path.resolve(__dirname)
|
||||
const root = path.resolve(thisPath, '..', '..', '..', '..', '..')
|
||||
const distPath = path.resolve(root, 'dist', 'icons')
|
||||
const donePath = path.resolve(distPath, 'init')
|
||||
|
||||
async function genIcons() {
|
||||
async function genIcons(outputDir) {
|
||||
let sizes = [16, 32, 64, 128, 256, 512, 1024]
|
||||
let win_sizes = [16, 32, 64, 128, 256]
|
||||
|
||||
const donePath = path.join(outputDir, 'init')
|
||||
if (fss.existsSync(donePath)) {
|
||||
console.log(`The ${donePath} file exists. Icons will not be regenerated.`)
|
||||
return
|
||||
} else {
|
||||
console.log(`Generating icons to ${outputDir}`)
|
||||
}
|
||||
|
||||
console.log('Generating SVG icons.')
|
||||
await fs.mkdir(path.resolve(distPath, 'svg'), { recursive: true })
|
||||
await fs.mkdir(path.resolve(distPath, 'png'), { recursive: true })
|
||||
await fs.mkdir(path.resolve(outputDir, 'svg'), { recursive: true })
|
||||
await fs.mkdir(path.resolve(outputDir, 'png'), { recursive: true })
|
||||
for (let size of sizes) {
|
||||
let name = `icon_${size}x${size}.svg`
|
||||
await fs.writeFile(`${distPath}/svg/${name}`, exports.generateMinimalWhiteLogo(size, true))
|
||||
let logo = generateMinimalWhiteLogo()(size, true)
|
||||
await fs.writeFile(`${outputDir}/svg/${name}`, logo)
|
||||
}
|
||||
|
||||
/// Please note that this function converts the SVG to PNG
|
||||
@ -156,47 +159,58 @@ async function genIcons() {
|
||||
for (let size of sizes) {
|
||||
let inName = `icon_${size}x${size}.svg`
|
||||
let outName = `icon_${size}x${size}.png`
|
||||
await sharp(`${distPath}/svg/${inName}`, { density: 144 })
|
||||
await sharp(`${outputDir}/svg/${inName}`, { density: 144 })
|
||||
.png()
|
||||
.resize({
|
||||
width: size,
|
||||
kernel: sharp.kernel.mitchell,
|
||||
})
|
||||
.toFile(`${distPath}/png/${outName}`)
|
||||
.toFile(`${outputDir}/png/${outName}`)
|
||||
}
|
||||
|
||||
for (let size of sizes.slice(1)) {
|
||||
let size2 = size / 2
|
||||
let inName = `icon_${size}x${size}.svg`
|
||||
let outName = `icon_${size2}x${size2}@2x.png`
|
||||
await sharp(`${distPath}/svg/${inName}`, { density: 144 })
|
||||
await sharp(`${outputDir}/svg/${inName}`, { density: 144 })
|
||||
.png()
|
||||
.resize({
|
||||
width: size,
|
||||
kernel: sharp.kernel.mitchell,
|
||||
})
|
||||
.toFile(`${distPath}/png/${outName}`)
|
||||
.toFile(`${outputDir}/png/${outName}`)
|
||||
}
|
||||
|
||||
if (platform() === 'darwin') {
|
||||
console.log('Generating ICNS.')
|
||||
execSync(`cp -R ${distPath}/png ${distPath}/png.iconset`)
|
||||
execSync(`iconutil --convert icns --output ${distPath}/icon.icns ${distPath}/png.iconset`)
|
||||
execSync(`cp -R ${outputDir}/png ${outputDir}/png.iconset`)
|
||||
execSync(`iconutil --convert icns --output ${outputDir}/icon.icns ${outputDir}/png.iconset`)
|
||||
}
|
||||
|
||||
console.log('Generating ICO.')
|
||||
let files = []
|
||||
for (let size of win_sizes) {
|
||||
let inName = `icon_${size}x${size}.png`
|
||||
let data = await fs.readFile(`${distPath}/png/${inName}`)
|
||||
let data = await fs.readFile(`${outputDir}/png/${inName}`)
|
||||
files.push(data)
|
||||
}
|
||||
toIco(files).then(buf => {
|
||||
fss.writeFileSync(`${distPath}/icon.ico`, buf)
|
||||
fss.writeFileSync(`${outputDir}/icon.ico`, buf)
|
||||
})
|
||||
|
||||
let handle = await fs.open(donePath, 'w')
|
||||
await handle.close()
|
||||
}
|
||||
|
||||
genIcons()
|
||||
async function main() {
|
||||
const outputDir = process.env.ENSO_BUILD_ICONS ?? process.argv[2]
|
||||
if (!outputDir) {
|
||||
const script = process.env.npm_package_name ?? url.fileURLToPath(import.meta.url)
|
||||
throw Error(
|
||||
`Script '${script}' invocation needs to be given an output path either through command line argument or 'ENSO_BUILD_ICONS' environment variable.`
|
||||
)
|
||||
}
|
||||
await genIcons(outputDir)
|
||||
}
|
||||
|
||||
await main()
|
||||
|
@ -1,16 +0,0 @@
|
||||
let config = {
|
||||
name: 'enso-studio-project-manager',
|
||||
version: '1.0.0',
|
||||
scripts: {
|
||||
build: 'npx ts-node src/build.ts',
|
||||
},
|
||||
|
||||
devDependencies: {
|
||||
unzipper: '^0.10',
|
||||
tar: '^6.0.5',
|
||||
'follow-redirects': '^1.13',
|
||||
typescript: `^3.4`,
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = { config }
|
@ -1,225 +0,0 @@
|
||||
/// Build script that downloads and extracts the project manager from CI.
|
||||
/// The project manager will be available at `paths.dist.bin` after running this script.
|
||||
|
||||
// @ts-ignore
|
||||
import { http } from 'follow-redirects'
|
||||
import * as os from 'os'
|
||||
import * as fss from 'fs'
|
||||
import * as path from 'path'
|
||||
// @ts-ignore
|
||||
import * as tar from 'tar'
|
||||
// @ts-ignore
|
||||
import * as unzipper from 'unzipper'
|
||||
import * as url from 'url'
|
||||
// @ts-ignore
|
||||
import * as paths from './../../../../../build/paths'
|
||||
// @ts-ignore
|
||||
import { ENGINE_VERSION } from './../../../../../build/release'
|
||||
import { IncomingMessage } from 'http'
|
||||
const fs = fss.promises
|
||||
|
||||
const distPath = paths.dist.bin
|
||||
const buildInfoPath = paths.dist.buildInfo
|
||||
|
||||
// =============
|
||||
// === Utils ===
|
||||
// =============
|
||||
|
||||
async function get_build_config() {
|
||||
let exists = fss.existsSync(buildInfoPath)
|
||||
if (exists) {
|
||||
let configFile = await fs.readFile(buildInfoPath)
|
||||
return JSON.parse(configFile.toString())
|
||||
} else {
|
||||
throw `Could not find build file at "${buildInfoPath}".`
|
||||
}
|
||||
}
|
||||
|
||||
// =======================
|
||||
// === Project Manager ===
|
||||
// =======================
|
||||
|
||||
interface BuildInfo {
|
||||
version: string
|
||||
target: string
|
||||
}
|
||||
|
||||
function get_project_manager_url({ version, target }: BuildInfo): string {
|
||||
console.log('webpack target ' + target)
|
||||
let base_url: string = 'https://github.com/enso-org/'
|
||||
base_url += 'enso/releases/download/'
|
||||
base_url += `enso-${version}/enso-project-manager-${version}`
|
||||
let postfix
|
||||
if (target === 'linux') {
|
||||
postfix = `linux-amd64.tar.gz`
|
||||
} else if (target === 'macos') {
|
||||
postfix = `macos-amd64.tar.gz`
|
||||
} else if (target === 'win') {
|
||||
postfix = `windows-amd64.zip`
|
||||
} else {
|
||||
throw 'UnsupportedPlatform: ' + target
|
||||
}
|
||||
return `${base_url}-${postfix}`
|
||||
}
|
||||
|
||||
function project_manager_path() {
|
||||
return paths.get_project_manager_path(distPath)
|
||||
}
|
||||
|
||||
function make_project_manager_binary_executable() {
|
||||
const bin_path = project_manager_path()
|
||||
if (os.platform() != 'win32') {
|
||||
fss.chmodSync(bin_path, '744')
|
||||
}
|
||||
}
|
||||
|
||||
async function decompress_project_manager(source_file_path: fss.PathLike, target_folder: string) {
|
||||
await fs.mkdir(target_folder, { recursive: true })
|
||||
await fs.rm(path.join(target_folder, 'enso'), { recursive: true, force: true })
|
||||
let decompressor
|
||||
if (source_file_path.toString().endsWith('.zip')) {
|
||||
decompressor = unzipper.Extract({ path: target_folder })
|
||||
} else {
|
||||
decompressor = tar.x({
|
||||
C: target_folder,
|
||||
})
|
||||
}
|
||||
fss.createReadStream(source_file_path)
|
||||
.pipe(decompressor)
|
||||
.on('finish', make_project_manager_binary_executable)
|
||||
}
|
||||
|
||||
class DownloadProgressIndicator {
|
||||
private progress_bytes: number
|
||||
private progress_truncated: string
|
||||
|
||||
constructor() {
|
||||
this.progress_bytes = 0
|
||||
this.progress_truncated = '0.0'
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that progress has been made. Will emit a console log for each tenth of an MB that
|
||||
* has been progressed.
|
||||
*/
|
||||
add_progress_bytes(count: number): void {
|
||||
this.progress_bytes += count
|
||||
/// Update truncated progress
|
||||
const progress_new = `${Math.trunc(this.progress_bytes / 10e4) / 10}`
|
||||
if (progress_new != this.progress_truncated) {
|
||||
this.progress_truncated = progress_new
|
||||
console.log(this.formatted_message())
|
||||
}
|
||||
}
|
||||
|
||||
formatted_message(): string {
|
||||
return `Download progress: ${this.progress_truncated}MB.`
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Consider adding to common library for re-use in other parts of the build system.
|
||||
async function download_project_manager(file_url: string, overwrite: boolean): Promise<void> {
|
||||
const parse_result = url.parse(file_url).pathname
|
||||
if (parse_result === undefined || parse_result === null) {
|
||||
throw `File URL does not contain valid path name: ` + file_url
|
||||
}
|
||||
const file_name = parse_result.split('/').pop()
|
||||
if (file_name === undefined || file_name === null) {
|
||||
throw `File URL does not contain path separator: ` + file_url
|
||||
}
|
||||
const download_dir = path.resolve(paths.dist.tmp, 'project-manager/')
|
||||
const file_path = path.resolve(download_dir, file_name)
|
||||
|
||||
if (fss.existsSync(file_path) && !overwrite) {
|
||||
console.log(
|
||||
`The file ${file_path} exists. ` +
|
||||
'Project manager executable does not need to be downloaded.'
|
||||
)
|
||||
} else {
|
||||
await fs.mkdir(download_dir, { recursive: true })
|
||||
|
||||
const parsed = url.parse(file_url)
|
||||
const options = {
|
||||
host: parsed.host,
|
||||
port: 80,
|
||||
path: parsed.pathname,
|
||||
}
|
||||
|
||||
const target_file = fss.createWriteStream(file_path)
|
||||
const progress_indicator = new DownloadProgressIndicator()
|
||||
await new Promise((resolve, reject) =>
|
||||
http
|
||||
.get(options, (res: IncomingMessage) => {
|
||||
res.on('data', (data: string) => {
|
||||
target_file.write(data)
|
||||
progress_indicator.add_progress_bytes(data.length)
|
||||
}).on('end', () => {
|
||||
target_file.end()
|
||||
console.log(`${file_url} downloaded to "${file_path}".`)
|
||||
resolve(undefined)
|
||||
})
|
||||
})
|
||||
.on('error', async (e: http.ClientRequest) => {
|
||||
target_file.end()
|
||||
await fs.rm(file_path)
|
||||
reject('Error: The download of the project manager was interrupted:\n' + e)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
await decompress_project_manager(file_path, distPath)
|
||||
}
|
||||
|
||||
// ============
|
||||
// === Main ===
|
||||
// ============
|
||||
|
||||
async function main() {
|
||||
const buildInfo: BuildInfo = {
|
||||
version: ENGINE_VERSION,
|
||||
target: (await get_build_config()).target,
|
||||
}
|
||||
|
||||
// The file at path `buildInfoFile` should always contain the build info of the project manager
|
||||
// that is currently installed in the dist directory. We read the file if it exists and compare
|
||||
// it with the version and target platform that we need. If they already agree then the right
|
||||
// project manager is already installed and there is nothing to do.
|
||||
const build_info_file = path.join(distPath, 'installed-enso-version')
|
||||
let existing_build_info: BuildInfo | null
|
||||
try {
|
||||
const build_info_file_content = await fs.readFile(build_info_file)
|
||||
existing_build_info = JSON.parse(build_info_file_content.toString())
|
||||
} catch (error) {
|
||||
const file_does_not_exist = error.code === 'ENOENT' // Standing for "Error NO ENTry"
|
||||
if (file_does_not_exist) {
|
||||
existing_build_info = null
|
||||
} else {
|
||||
console.error(error)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
if (
|
||||
buildInfo.version !== existing_build_info?.version ||
|
||||
buildInfo.target !== existing_build_info?.target
|
||||
) {
|
||||
// We remove the build info file to avoid misinformation if the build is interrupted during
|
||||
// the call to `download_project_manager`.
|
||||
// We use `force: true` because the file might not exist.
|
||||
await fs.rm(build_info_file, { force: true })
|
||||
let project_manager_url = get_project_manager_url(buildInfo)
|
||||
try {
|
||||
await download_project_manager(project_manager_url, false)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
process.exit(1)
|
||||
}
|
||||
await fs.writeFile(build_info_file, JSON.stringify(buildInfo))
|
||||
} else {
|
||||
console.log(
|
||||
`The right version of the project manager is already installed, ` +
|
||||
`according to ${build_info_file}.`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
52951
app/ide-desktop/package-lock.json
generated
52951
app/ide-desktop/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,24 +0,0 @@
|
||||
let config = {
|
||||
name: 'root',
|
||||
version: '1.0.0',
|
||||
private: true,
|
||||
devDependencies: {
|
||||
lerna: '^3.20.2',
|
||||
webpack: '^4.42.1',
|
||||
'webpack-cli': '^3.3.11',
|
||||
'webpack-dev-server': '^3.1.5',
|
||||
},
|
||||
scripts: {
|
||||
// IMPORTANT! Please remember to run "bootstrap" before "build" or "watch" to install
|
||||
// or update the required dependencies.
|
||||
bootstrap: 'npx lerna bootstrap',
|
||||
build: 'npx lerna run build --stream',
|
||||
clean: 'npx lerna clean -y && rm -Rf node_modules',
|
||||
dist: 'npx lerna run build --stream && npx lerna run dist --stream',
|
||||
install: 'npm install lerna && npx lerna bootstrap',
|
||||
start: 'npm run build && npx lerna run start --stream -- -- ',
|
||||
watch: 'npx lerna run watch --stream',
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = { config }
|
26
app/ide-desktop/package.json
Normal file
26
app/ide-desktop/package.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "Enso Team",
|
||||
"email": "contact@enso.org"
|
||||
},
|
||||
"homepage": "https://github.com/enso-org/enso",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:enso-org/enso.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/enso-org/enso/issues"
|
||||
},
|
||||
"name": "root",
|
||||
"private": true,
|
||||
"workspaces": [
|
||||
"lib/icons",
|
||||
"lib/common",
|
||||
"lib/content",
|
||||
"lib/client"
|
||||
],
|
||||
"scripts": {
|
||||
"watch": "npm run watch --workspace enso-studio-content"
|
||||
}
|
||||
}
|
14
app/ide-desktop/utils.mjs
Normal file
14
app/ide-desktop/utils.mjs
Normal file
@ -0,0 +1,14 @@
|
||||
export function require_env(name) {
|
||||
return (
|
||||
process.env[name] ??
|
||||
(() => {
|
||||
throw Error(`Missing ${name} environment variable.`)
|
||||
})()
|
||||
)
|
||||
}
|
||||
|
||||
export function require_env_path_exist(name) {
|
||||
const value = require_env(name)
|
||||
if (path.existsSync(value)) return value
|
||||
else throw Error(`File with path ${value} read from environment variable ${name} is missing.`)
|
||||
}
|
7
build-config.yaml
Normal file
7
build-config.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
# Options intended to be common for all developers.
|
||||
|
||||
wasm-size-limit: 4.37MB
|
||||
required-versions:
|
||||
node: =16.15.0
|
||||
wasm-pack: ^0.10.2
|
||||
flatc: =1.12.0
|
9
build/Cargo.toml
Normal file
9
build/Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "enso-build3"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[dependencies]
|
||||
enso-build = { git = "https://github.com/enso-org/ci-build", branch = "develop" }
|
||||
ide-ci = { git = "https://github.com/enso-org/ci-build", branch = "develop" }
|
124
build/cmd.js
124
build/cmd.js
@ -1,124 +0,0 @@
|
||||
const https = require('https')
|
||||
const spawn = require('child_process').spawn
|
||||
const exec = require('child_process').exec
|
||||
|
||||
function download(url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
https
|
||||
.get(url, res => {
|
||||
let data = ''
|
||||
res.on('data', chunk => (data += chunk))
|
||||
res.on('end', () => resolve(data))
|
||||
})
|
||||
.on('error', error => reject(error))
|
||||
})
|
||||
}
|
||||
|
||||
function section(title) {
|
||||
let border = '-'.repeat(8 + title.length)
|
||||
let middle = '--- ' + title + ' ---'
|
||||
console.log()
|
||||
console.log()
|
||||
console.log()
|
||||
console.log(border)
|
||||
console.log(middle)
|
||||
console.log(border)
|
||||
console.log()
|
||||
}
|
||||
|
||||
async function with_cwd(dir, fn) {
|
||||
let cwd = process.cwd()
|
||||
process.chdir(dir)
|
||||
let out = await fn()
|
||||
process.chdir(cwd)
|
||||
return out
|
||||
}
|
||||
|
||||
function run(cmd, args) {
|
||||
let out = ''
|
||||
return new Promise((resolve, reject) => {
|
||||
console.log(`Calling '${cmd} ${args.join(' ')}'`)
|
||||
let proc = spawn(cmd, args, { stdio: 'inherit', shell: true })
|
||||
proc.on('exit', code => {
|
||||
if (code) process.exit(code)
|
||||
resolve(out)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function run_read(cmd, args) {
|
||||
let out = ''
|
||||
return new Promise((resolve, reject) => {
|
||||
let proc = spawn(cmd, args, { shell: true })
|
||||
proc.stderr.pipe(process.stderr)
|
||||
proc.stdout.on('data', data => {
|
||||
out += data
|
||||
})
|
||||
proc.on('exit', code => {
|
||||
if (code) process.exit(code)
|
||||
resolve(out)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async function check_version(name, required, cfg) {
|
||||
if (!cfg) {
|
||||
cfg = {}
|
||||
}
|
||||
let version = await run_read(name, ['--version'])
|
||||
version = version.trim()
|
||||
if (cfg.preprocess) {
|
||||
version = cfg.preprocess(version)
|
||||
}
|
||||
if (cfg.silent !== true) {
|
||||
console.log(`Checking if '${name}' version is '${required}'.`)
|
||||
}
|
||||
if (version != required) {
|
||||
throw `[ERROR] The '${name}' version '${version}' does not match the required one '${required}'.`
|
||||
}
|
||||
}
|
||||
|
||||
async function get_npm_info(name) {
|
||||
let info = await run_read('npm', ['info', name, '--json'])
|
||||
return JSON.parse(info)
|
||||
}
|
||||
|
||||
async function get_npm_lts_version_of(name) {
|
||||
let info = await get_npm_info(name)
|
||||
version = info['dist-tags'].lts
|
||||
return version
|
||||
}
|
||||
|
||||
async function get_node_dist_index() {
|
||||
let index = await download('https://nodejs.org/dist/index.json')
|
||||
return JSON.parse(index)
|
||||
}
|
||||
|
||||
async function get_node_lts_version() {
|
||||
let index = await get_node_dist_index()
|
||||
let newest = null
|
||||
for (let entry of index) {
|
||||
if (entry.lts !== false) {
|
||||
newest = entry
|
||||
break
|
||||
}
|
||||
}
|
||||
if (!newest) {
|
||||
throw 'Cannot fetch the info about node LTS version.'
|
||||
}
|
||||
let node = newest.version
|
||||
let npm = newest.npm
|
||||
return [node, npm]
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
section,
|
||||
run,
|
||||
run_read,
|
||||
check_version,
|
||||
get_npm_info,
|
||||
get_npm_lts_version_of,
|
||||
with_cwd,
|
||||
get_node_dist_index,
|
||||
get_node_lts_version,
|
||||
}
|
@ -7,4 +7,3 @@ edition = "2021"
|
||||
[dependencies]
|
||||
regex = "1"
|
||||
lazy_static = "1.4.0"
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
{
|
||||
"name": "build-script",
|
||||
"version": "1.0.0",
|
||||
"description": "Build Scripts",
|
||||
"repository": "git@github.com:enso-org/ide.git",
|
||||
"dependencies": {
|
||||
"glob": "^7.1.6",
|
||||
"js-yaml": "4.0.0",
|
||||
"semver": "7.3.4",
|
||||
"unzipper": "^0.10.11",
|
||||
"yargs": "^15.3.0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"prettier": "2.2.0",
|
||||
"prettier-plugin-toml": "0.3.1"
|
||||
}
|
||||
}
|
13
build/prettier/package.json
Normal file
13
build/prettier/package.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "enso-prettier-wrapper",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"prettier": "^2.6.2",
|
||||
"prettier-plugin-toml": "^0.3.1"
|
||||
},
|
||||
"scripts": {
|
||||
"write": "cd ../../ && prettier --write .",
|
||||
"check": "cd ../../ && prettier --check ."
|
||||
}
|
||||
}
|
216
build/release.js
216
build/release.js
@ -1,216 +0,0 @@
|
||||
/// Package release utilities. Especially, utilities to load `CHANGELOG.md`, extract the newest
|
||||
/// entry, and use it to generate package version and description.
|
||||
|
||||
const fss = require('fs')
|
||||
const path = require('path')
|
||||
const paths = require('./paths')
|
||||
const semver = require('semver')
|
||||
const yaml = require('js-yaml')
|
||||
|
||||
// =================
|
||||
// === Constants ===
|
||||
// =================
|
||||
|
||||
const config = yaml.load(fss.readFileSync(path.join(paths.gui.root, 'config.yaml'), 'utf-8'))
|
||||
|
||||
const CHANGELOG_FILE_NAME = 'CHANGELOG.md'
|
||||
const CHANGELOG_FILE = path.join(paths.root, CHANGELOG_FILE_NAME)
|
||||
const ENGINE_VERSION = config.engineVersionSupported
|
||||
|
||||
// ===============
|
||||
// === Version ===
|
||||
// ===============
|
||||
|
||||
class NextReleaseVersion {
|
||||
/// Version used for config files when building the package with "next version" in changelog.
|
||||
toString() {
|
||||
return '0.0.0'
|
||||
}
|
||||
|
||||
isPrerelease() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
class Version {
|
||||
constructor(major, minor, patch, tag, tagVersion, rcTag, rcTagVersion) {
|
||||
this.major = major
|
||||
this.minor = minor
|
||||
this.patch = patch
|
||||
this.tag = tag
|
||||
this.tagVersion = parseInt(tagVersion)
|
||||
this.rcTag = rcTag
|
||||
this.rcTagVersion = rcTagVersion
|
||||
}
|
||||
|
||||
lt(that) {
|
||||
if (this.major < that.major) {
|
||||
return true
|
||||
}
|
||||
if (this.minor < that.minor) {
|
||||
return true
|
||||
}
|
||||
if (this.patch < that.patch) {
|
||||
return true
|
||||
}
|
||||
if (this.tag === 'alpha' && that.tag === 'beta') {
|
||||
return true
|
||||
}
|
||||
if (this.tag === 'alpha' && that.tag === 'rc') {
|
||||
return true
|
||||
}
|
||||
if (this.tag === 'beta' && that.tag === 'rc') {
|
||||
return true
|
||||
}
|
||||
if (this.tagVersion < that.tagVersion) {
|
||||
return true
|
||||
}
|
||||
if (this.rcTagVersion < that.rcTagVersion) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
isPrerelease() {
|
||||
if (this.tag) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
toString() {
|
||||
let suffix = ''
|
||||
if (this.tag) {
|
||||
suffix = `-${this.tag}.${this.tagVersion}`
|
||||
if (this.rcTag) {
|
||||
suffix += `.${this.rcTag}.${this.rcTagVersion}`
|
||||
}
|
||||
}
|
||||
return `${this.major}.${this.minor}.${this.patch}${suffix}`
|
||||
}
|
||||
}
|
||||
|
||||
// ======================
|
||||
// === ChangelogEntry ===
|
||||
// ======================
|
||||
|
||||
class ChangelogEntry {
|
||||
constructor(version, body) {
|
||||
this.version = version
|
||||
this.body = body
|
||||
}
|
||||
|
||||
assert_is_newest_version_defined() {
|
||||
if (this.version instanceof NextReleaseVersion) {
|
||||
throw `The newest entry in CHANGELOG.md does not have version assigned.`
|
||||
}
|
||||
}
|
||||
|
||||
assert_is_unstable() {
|
||||
this.assert_is_newest_version_defined()
|
||||
if (!this.isPrerelease()) {
|
||||
throw 'Assertion failed. The version is stable.'
|
||||
}
|
||||
}
|
||||
|
||||
assert_is_stable() {
|
||||
this.assert_is_newest_version_defined()
|
||||
if (this.isPrerelease()) {
|
||||
throw 'Assertion failed. The version is unstable.'
|
||||
}
|
||||
}
|
||||
|
||||
isPrerelease() {
|
||||
return this.version.isPrerelease()
|
||||
}
|
||||
}
|
||||
|
||||
// =================
|
||||
// === Changelog ===
|
||||
// =================
|
||||
|
||||
class Changelog {
|
||||
constructor() {
|
||||
this.entries = changelogEntries()
|
||||
}
|
||||
|
||||
newestEntry() {
|
||||
return this.entries[0]
|
||||
}
|
||||
|
||||
currentVersion() {
|
||||
return this.newestEntry().version
|
||||
}
|
||||
}
|
||||
|
||||
function changelogSections() {
|
||||
let text = '\n' + fss.readFileSync(CHANGELOG_FILE, 'utf8')
|
||||
let chunks = text.split(/\r?\n#(?!#)/)
|
||||
return chunks.filter(s => s != '')
|
||||
}
|
||||
|
||||
function changelogEntries() {
|
||||
let sections = changelogSections()
|
||||
let entries = []
|
||||
let firstSection = true
|
||||
for (let section of sections) {
|
||||
let splitPoint = section.indexOf('\n')
|
||||
let header = section.substring(0, splitPoint)
|
||||
let body = section.substring(splitPoint).trim()
|
||||
if (firstSection && header.startsWith(' Next Release')) {
|
||||
let version = new NextReleaseVersion()
|
||||
entries.push(new ChangelogEntry(version, body))
|
||||
} else {
|
||||
let headerReg =
|
||||
/^ Enso (?<major>[0-9]+)\.(?<minor>[0-9]+)\.(?<patch>[0-9]+)(-(?<tag>alpha|beta|rc)\.(?<tagVersion>[0-9]+))?(.(?<rcTag>rc)\.(?<rcTagVersion>[0-9]+))? \((?<year>[0-9][0-9][0-9][0-9])-(?<month>[0-9][0-9])-(?<day>[0-9][0-9])\)/
|
||||
let match = header.match(headerReg)
|
||||
if (!match) {
|
||||
throw `Improper changelog entry header: '${header}'. See the 'CHANGELOG_TEMPLATE.md' for details.`
|
||||
}
|
||||
let grps = match.groups
|
||||
let version = new Version(
|
||||
grps.major,
|
||||
grps.minor,
|
||||
grps.patch,
|
||||
grps.tag,
|
||||
grps.tagVersion,
|
||||
grps.rcTag,
|
||||
grps.rcTagVersion
|
||||
)
|
||||
entries.push(new ChangelogEntry(version, body))
|
||||
}
|
||||
firstSection = false
|
||||
}
|
||||
|
||||
let firstEntry = true
|
||||
let lastVersion = null
|
||||
for (let entry of entries) {
|
||||
if (!(firstEntry && entry.version instanceof NextReleaseVersion)) {
|
||||
if (lastVersion !== null) {
|
||||
if (!entry.version.lt(lastVersion)) {
|
||||
let v1 = entry.version.toString()
|
||||
let v2 = lastVersion.toString()
|
||||
throw `Versions are not properly ordered in the changelog (${v1} >= ${v2}).`
|
||||
}
|
||||
}
|
||||
lastVersion = entry.version
|
||||
}
|
||||
firstEntry = false
|
||||
}
|
||||
return entries
|
||||
}
|
||||
|
||||
function changelog() {
|
||||
return new Changelog()
|
||||
}
|
||||
|
||||
function currentVersion() {
|
||||
return changelog().currentVersion()
|
||||
}
|
||||
|
||||
// ===============
|
||||
// === Exports ===
|
||||
// ===============
|
||||
|
||||
module.exports = { ENGINE_VERSION, Version, NextReleaseVersion, changelog, currentVersion }
|
774
build/run.js
774
build/run.js
@ -1,774 +0,0 @@
|
||||
const child_process = require('child_process')
|
||||
const cmd = require('./cmd')
|
||||
const fs = require('fs').promises
|
||||
const fss = require('fs')
|
||||
const unzipper = require('unzipper')
|
||||
const glob = require('glob')
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
const paths = require('./paths')
|
||||
const prettier = require('prettier')
|
||||
const release = require('./release')
|
||||
const stream = require('stream')
|
||||
const workflow = require('./workflow')
|
||||
const yargs = require('yargs')
|
||||
const zlib = require('zlib')
|
||||
const { promisify } = require('util')
|
||||
const pipe = promisify(stream.pipeline)
|
||||
|
||||
// ==============
|
||||
// === Errors ===
|
||||
// ==============
|
||||
|
||||
process.on('unhandledRejection', error => {
|
||||
throw error
|
||||
})
|
||||
process.chdir(paths.root)
|
||||
|
||||
// ========================
|
||||
// === Global Variables ===
|
||||
// ========================
|
||||
|
||||
/// Arguments passed to cargo build system called from this script. This variable is set to a
|
||||
/// specific value after the command line args get parsed.
|
||||
let cargoArgs = undefined
|
||||
|
||||
/// Arguments passed to a target binary if any. This variable is set to a specific value after the
|
||||
// command line args get parsed.
|
||||
let targetArgs = undefined
|
||||
|
||||
// =============
|
||||
// === Utils ===
|
||||
// =============
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
/// 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))
|
||||
}
|
||||
|
||||
/// Run the command with the provided args and all args passed to this script after the `--` symbol.
|
||||
async function run(command, args) {
|
||||
await cmd.run(command, args)
|
||||
}
|
||||
|
||||
/// Defines a new command argument builder.
|
||||
function command(docs) {
|
||||
return { docs }
|
||||
}
|
||||
|
||||
/// Build the project manager module, which downloads the project manager binary for the current
|
||||
/// platform.
|
||||
async function build_project_manager() {
|
||||
console.log(`Getting project manager manager.`)
|
||||
await cmd.with_cwd(paths.ide_desktop.lib.projectManager, async () => {
|
||||
await run('npm', ['run-script build'])
|
||||
})
|
||||
}
|
||||
|
||||
/// Run the local project manager binary.
|
||||
function run_project_manager(options = {}) {
|
||||
const bin_path = paths.get_project_manager_path(paths.dist.bin)
|
||||
console.log(`Starting the project manager from "${bin_path}".`)
|
||||
return child_process.execFile(bin_path, [], options, (error, stdout, stderr) => {
|
||||
console.log(`Project manager finished.`)
|
||||
console.error(stderr)
|
||||
if (error && !error.killed) {
|
||||
throw error
|
||||
}
|
||||
console.log(stdout)
|
||||
})
|
||||
}
|
||||
|
||||
// ================
|
||||
// === Commands ===
|
||||
// ================
|
||||
|
||||
const DEFAULT_CRATE = 'app/gui'
|
||||
let commands = {}
|
||||
|
||||
// === Clean ===
|
||||
|
||||
commands.clean = command(`Clean all build artifacts`)
|
||||
commands.clean.js = async function () {
|
||||
await cmd.with_cwd(paths.ide_desktop.root, async () => {
|
||||
await run('npm', ['run', 'clean'])
|
||||
})
|
||||
try {
|
||||
await fs.unlink(paths.dist.init)
|
||||
await fs.unlink(paths.dist.buildInit)
|
||||
} catch {}
|
||||
}
|
||||
|
||||
commands.clean.rust = async function () {
|
||||
await run_cargo('cargo', ['clean'])
|
||||
}
|
||||
|
||||
// === Check ===
|
||||
|
||||
commands.check = command(`Fast check if project builds (only Rust target)`)
|
||||
commands.check.rust = async function () {
|
||||
await run_cargo('cargo', [
|
||||
'check',
|
||||
'--workspace',
|
||||
' -p',
|
||||
'enso-integration-test',
|
||||
'--all-targets',
|
||||
])
|
||||
}
|
||||
|
||||
// === Build ===
|
||||
|
||||
commands.build = command(`Build the sources in release mode`)
|
||||
commands.build.options = {
|
||||
crate: {
|
||||
describe: 'Target crate to build',
|
||||
type: 'string',
|
||||
},
|
||||
}
|
||||
commands.build.js = async function () {
|
||||
await installJsDeps()
|
||||
console.log(`Building JS target.`)
|
||||
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}'` : ``
|
||||
console.log(`Building WASM target${crate_sfx}.`)
|
||||
let args = [
|
||||
'build',
|
||||
'--target',
|
||||
'web',
|
||||
'--out-dir',
|
||||
paths.wasm.root,
|
||||
'--out-name',
|
||||
'ide',
|
||||
crate,
|
||||
]
|
||||
|
||||
if (argv.dev) {
|
||||
args.push('--dev')
|
||||
}
|
||||
let allowExtraMb = 0
|
||||
// Use the environment-variable API provided by the `enso_profiler_macros` library to implement
|
||||
// the public interface to profiling-level configuration
|
||||
// (see: https://github.com/enso-org/design/blob/main/epics/profiling/implementation.md)
|
||||
if (argv['profiling-level']) {
|
||||
process.env.ENSO_MAX_PROFILING_LEVEL = argv['profiling-level']
|
||||
// Enabling more profiling can increase the binary size a bit. Since profiling must be
|
||||
// performed in release mode for accuracy, builds with profiling enabled will tend to be
|
||||
// subject to the binary size check below.
|
||||
// Because builds with a profiling-level set are not true release builds, we could disable
|
||||
// the limit here; instead we set an extra allowance, as a sanity check on the size increase
|
||||
// caused by high profiling levels. This value is chosen to be higher than extensive profiling
|
||||
// should ever exceed.
|
||||
allowExtraMb = 0.5
|
||||
}
|
||||
args.push('--')
|
||||
// Enable a Rust unstable feature that the `#[profile]` macro uses to obtain source-file and line
|
||||
// number information to include in generated profile files.
|
||||
//
|
||||
// The IntelliJ Rust plugin does not support the `proc_macro_span` Rust feature; using it causes
|
||||
// JetBrains IDEs to become entirely unaware of the items produced by `#[profile]`.
|
||||
// (See: https://github.com/intellij-rust/intellij-rust/issues/8655)
|
||||
//
|
||||
// In order to have line number information in actual usage, but keep everything understandable
|
||||
// by JetBrains IDEs, we need IntelliJ/CLion to build crates differently from how they are
|
||||
// built for the application to be run. This is accomplished by gating the use of the unstable
|
||||
// functionality by a `cfg` flag. A `cfg` flag is disabled by default, so when a Rust IDE builds
|
||||
// crates internally in order to determine macro expansions, it will do so without line numbers.
|
||||
// When this script is used to build the application, it is not for the purpose of IDE macro
|
||||
// expansion, so we can safely enable line numbers.
|
||||
//
|
||||
// The reason we don't use a Cargo feature for this is because this script can build different
|
||||
// crates, and we'd like to enable this feature when building any crate that depends on the
|
||||
// `profiler` crates. We cannot do something like '--feature=enso_profiler/line-numbers' without
|
||||
// causing build to fail when building a crate that doesn't have `enso_profiler` in its
|
||||
// dependency tree.
|
||||
process.env.ENSO_ENABLE_PROC_MACRO_SPAN = 1
|
||||
await run_cargo('wasm-pack', args)
|
||||
await patch_file(paths.wasm.glue, js_workaround_patcher)
|
||||
await fs.rename(paths.wasm.mainRaw, paths.wasm.main)
|
||||
if (!argv.dev) {
|
||||
console.log('Minimizing the WASM binary.')
|
||||
await gzip(paths.wasm.main, paths.wasm.mainGz)
|
||||
|
||||
const releaseLimitMb = 4.37
|
||||
let limitMb = releaseLimitMb + allowExtraMb
|
||||
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).`
|
||||
}
|
||||
}
|
||||
|
||||
/// Workaround fix by wdanilo, see: https://github.com/rustwasm/wasm-pack/issues/790
|
||||
function js_workaround_patcher(code) {
|
||||
code = code.replace(/if \(typeof input === 'string'.*return wasm;/gs, 'return imports')
|
||||
code = code.replace(
|
||||
/if \(typeof input === 'undefined'.*const imports = {};/gs,
|
||||
'const imports = {};'
|
||||
)
|
||||
code = code.replace(/export default init;/gs, 'export default init')
|
||||
code += '\nexport function after_load(w,m) { wasm = w; init.__wbindgen_wasm_module = m;}'
|
||||
return code
|
||||
}
|
||||
|
||||
async function patch_file(path, patcher) {
|
||||
let code_to_patch = await fs.readFile(path, 'utf8')
|
||||
let patched_code = patcher(code_to_patch)
|
||||
await fs.writeFile(path, patched_code)
|
||||
}
|
||||
|
||||
// === Start ===
|
||||
|
||||
commands.start = command(`Build and start desktop client`)
|
||||
commands.start.rust = async function (argv) {
|
||||
let argv2 = Object.assign({}, argv, { dev: true })
|
||||
await commands.build.rust(argv2)
|
||||
}
|
||||
|
||||
commands.start.js = async function (argv) {
|
||||
await installJsDeps()
|
||||
console.log(`Building JS target.` + argv)
|
||||
const args = []
|
||||
if (argv.backend) {
|
||||
// The backend path is being prepended here, as appending would be incorrect.
|
||||
// That is because `targetArgs` might include `-- …` and appended args could
|
||||
// end up being passed to the spawned backend process.
|
||||
args.push('--backend-path')
|
||||
args.push(paths.get_project_manager_path(paths.dist.bin))
|
||||
} else {
|
||||
args.push('--no-backend')
|
||||
}
|
||||
args.concat(targetArgs)
|
||||
if (argv.dev) {
|
||||
args.push('--dev')
|
||||
}
|
||||
await cmd.with_cwd(paths.ide_desktop.root, async () => {
|
||||
await run('npm', ['run', 'start', '--'].concat(args))
|
||||
})
|
||||
}
|
||||
|
||||
// === Test ===
|
||||
|
||||
commands.test = command(`Run test suites`)
|
||||
commands.test.rust = async function (argv) {
|
||||
if (argv.native) {
|
||||
console.log(`Running Rust test suite.`)
|
||||
await run_cargo('cargo', ['test', '--workspace'])
|
||||
}
|
||||
|
||||
if (argv.wasm) {
|
||||
console.log(`Running Rust WASM test suite.`)
|
||||
let args = [
|
||||
'run',
|
||||
'--manifest-path=build/rust-scripts/Cargo.toml',
|
||||
'--bin',
|
||||
'test_all',
|
||||
'--',
|
||||
'--headless',
|
||||
'--chrome',
|
||||
]
|
||||
process.env.WASM_BINDGEN_TEST_TIMEOUT = 60
|
||||
await run_cargo('cargo', args)
|
||||
}
|
||||
}
|
||||
|
||||
// === Integration Test ===
|
||||
|
||||
commands['integration-test'] = command('Run integration test suite')
|
||||
commands['integration-test'].rust = async function (argv) {
|
||||
let pm_process = null
|
||||
if (argv.backend) {
|
||||
let env = { ...process.env, PROJECTS_ROOT: path.resolve(os.tmpdir(), 'enso') }
|
||||
pm_process = await build_project_manager().then(() => run_project_manager({ env: env }))
|
||||
}
|
||||
try {
|
||||
console.log(`Running Rust WASM test suite.`)
|
||||
process.env.WASM_BINDGEN_TEST_TIMEOUT = 300
|
||||
let args = [
|
||||
'test',
|
||||
'--headless',
|
||||
'--chrome',
|
||||
'integration-test',
|
||||
'--profile=integration-test',
|
||||
]
|
||||
await run_cargo('wasm-pack', args)
|
||||
} finally {
|
||||
console.log(`Shutting down Project Manager`)
|
||||
if (pm_process !== null) {
|
||||
pm_process.kill()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// === Profile ===
|
||||
|
||||
commands.profile = command('Profile the application')
|
||||
commands.profile.rust = async function (argv) {
|
||||
console.log(`Building with full optimization. This may take a few minutes...`)
|
||||
let defaults = { 'profiling-level': 'debug' }
|
||||
let argv2 = Object.assign({}, defaults, argv)
|
||||
await commands.build.rust(argv2)
|
||||
}
|
||||
commands.profile.js = async function (argv) {
|
||||
await installJsDeps()
|
||||
console.log(`Profiling the application.` + argv)
|
||||
let workflow = argv['workflow']
|
||||
let save_profile = argv[`save-profile`]
|
||||
if (workflow === undefined) {
|
||||
console.error(
|
||||
`'Profile' command requires a workflow argument. ` +
|
||||
`For a list of available workflows, pass --workflow=help`
|
||||
)
|
||||
return
|
||||
}
|
||||
if (save_profile === undefined) {
|
||||
console.error(
|
||||
`'Profile' command requires a --save-profile argument ` +
|
||||
`indicating path to output file.`
|
||||
)
|
||||
return
|
||||
}
|
||||
let out_path = path.resolve(save_profile)
|
||||
const tail = ['--entry-point=profile', '--workflow=' + workflow, '--save-profile=' + out_path]
|
||||
const args = ['--backend-path', paths.get_project_manager_path(paths.dist.bin)].concat(
|
||||
targetArgs
|
||||
)
|
||||
await cmd.with_cwd(paths.ide_desktop.root, async () => {
|
||||
await run('npm', ['run', 'start', '--'].concat(args).concat(tail))
|
||||
})
|
||||
}
|
||||
|
||||
// === Lint ===
|
||||
|
||||
commands.lint = command(`Lint the codebase`)
|
||||
commands.lint.rust = async function () {
|
||||
await run_cargo('cargo', [
|
||||
'clippy',
|
||||
'--workspace',
|
||||
'-p',
|
||||
'enso-integration-test',
|
||||
'--all-targets',
|
||||
'--',
|
||||
'-D',
|
||||
'warnings',
|
||||
])
|
||||
await run_cargo('cargo', ['fmt', '--', '--check'])
|
||||
}
|
||||
|
||||
// === TomlFmt ===
|
||||
|
||||
commands['toml-fmt'] = command(`Lint the codebase`)
|
||||
commands['toml-fmt'].rust = async function () {
|
||||
console.log('Looking for all TOML files.')
|
||||
let files = glob.sync(paths.root + '/**/*.toml', { cwd: paths.root })
|
||||
console.log(`Found ${files.length} entries. Running auto-formatter.`)
|
||||
for (let file of files) {
|
||||
console.log(` Formatting '${file}'.`)
|
||||
let text = fss.readFileSync(file, 'utf8')
|
||||
let out = prettier.format(text, { parser: 'toml' })
|
||||
fss.writeFileSync(file, out)
|
||||
}
|
||||
}
|
||||
|
||||
// === Watch ===
|
||||
|
||||
commands.watch = command(`Start a file-watch utility and run interactive mode`)
|
||||
commands.watch.options = Object.assign({}, commands.build.options)
|
||||
commands.watch.parallel = false
|
||||
commands.watch.common = async function (argv) {
|
||||
argv.dev = true
|
||||
|
||||
// Init JS build and project manager.
|
||||
|
||||
await installJsDeps()
|
||||
if (argv.backend) {
|
||||
await build_project_manager().then(run_project_manager)
|
||||
}
|
||||
|
||||
// Run build processes.
|
||||
|
||||
await cmd.with_cwd(paths.root, async () => {
|
||||
return commands.build.rust(argv)
|
||||
})
|
||||
await cmd.with_cwd(paths.ide_desktop.root, async () => {
|
||||
// Among other things, this will call the build script of the project-manager package. But
|
||||
// this is unnecessary because that script is already called by `build_project_manager`
|
||||
// above.
|
||||
return commands.build.js(argv)
|
||||
})
|
||||
|
||||
// Run watch processes.
|
||||
|
||||
const rust_process = cmd.with_cwd(paths.root, async () => {
|
||||
let build_args = []
|
||||
if (argv.crate !== undefined) {
|
||||
build_args.push(`--crate=${argv.crate}`)
|
||||
}
|
||||
build_args = build_args.join(' ')
|
||||
const shellCommand =
|
||||
'"' +
|
||||
`node ${paths.script.main} build --skip-version-validation --no-js --dev ${build_args} -- ` +
|
||||
cargoArgs.join(' ') +
|
||||
'"'
|
||||
// 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 () => {
|
||||
return run('npm', ['run', 'watch'])
|
||||
})
|
||||
|
||||
await rust_process
|
||||
await js_process
|
||||
}
|
||||
|
||||
// === Dist ===
|
||||
|
||||
commands.dist = command(`Build the sources and create distribution packages`)
|
||||
commands.dist.rust = async function (argv) {
|
||||
await commands.build.rust(argv)
|
||||
}
|
||||
|
||||
commands.dist.js = async function () {
|
||||
await installJsDeps()
|
||||
await cmd.with_cwd(paths.ide_desktop.root, async () => {
|
||||
await run('npm', ['run', 'dist'])
|
||||
})
|
||||
}
|
||||
|
||||
// === CI Gen ===
|
||||
|
||||
/// The command is used by CI to generate the file `CURRENT_RELEASE_CHANGELOG.json`, which contains
|
||||
/// information about the newest release. It is then used by CI to generate version and description
|
||||
/// of the product release.
|
||||
commands['ci-gen'] = command(`Generate CI build related files`)
|
||||
commands['ci-gen'].rust = async function (argv) {
|
||||
let entry = release.changelog().newestEntry()
|
||||
let body = entry.body
|
||||
let version = entry.version.toString()
|
||||
let prerelease = entry.isPrerelease()
|
||||
let obj = { version, body, prerelease }
|
||||
let json = JSON.stringify(obj)
|
||||
fss.writeFileSync(path.join(paths.root, 'CURRENT_RELEASE_CHANGELOG.json'), json)
|
||||
}
|
||||
|
||||
/// Asserts whether the current version of the package (newest in CHANGELOG.md) is unstable.
|
||||
commands['assert-version-unstable'] = command(`Assert the current version is unstable`)
|
||||
commands['assert-version-unstable'].rust = async function (argv) {
|
||||
let entry = release.changelog().newestEntry().assert_is_unstable()
|
||||
}
|
||||
|
||||
/// Asserts whether the current version of the package (newest in CHANGELOG.md) is stable.
|
||||
commands['assert-version-stable'] = command(`Assert the current version is stable`)
|
||||
commands['assert-version-stable'].rust = async function (argv) {
|
||||
let entry = release.changelog().newestEntry().assert_is_stable()
|
||||
}
|
||||
|
||||
// ===========================
|
||||
// === Command Line Parser ===
|
||||
// ===========================
|
||||
|
||||
let usage = `run command [options]
|
||||
|
||||
All arguments after '--' will be passed to cargo build system.
|
||||
All arguments after second '--' will be passed to target executable if any.
|
||||
For example, 'run start -- --dev -- --debug-scene shapes' will pass '--dev' to cargo \
|
||||
and '--debug-scene shapes' to the output binary.`
|
||||
|
||||
let optParser = yargs
|
||||
.scriptName('')
|
||||
.usage(usage)
|
||||
.help()
|
||||
.parserConfiguration({ 'populate--': true })
|
||||
.demandCommand()
|
||||
|
||||
optParser.options('rust', {
|
||||
describe: 'Run the Rust target (use --no-rust to disable)',
|
||||
type: 'bool',
|
||||
default: true,
|
||||
})
|
||||
|
||||
optParser.options('js', {
|
||||
describe: 'Run the JavaScript target (use --no-js to disable)',
|
||||
type: 'bool',
|
||||
default: true,
|
||||
})
|
||||
|
||||
optParser.options('release', {
|
||||
describe: 'Enable all optimizations',
|
||||
type: 'bool',
|
||||
})
|
||||
|
||||
optParser.options('dev', {
|
||||
describe: 'Optimize for fast builds',
|
||||
type: 'bool',
|
||||
})
|
||||
|
||||
optParser.options('target', {
|
||||
describe:
|
||||
'Set the build target. Defaults to the current platform. ' +
|
||||
'Valid values are: "linux" "macos" and "win"',
|
||||
type: 'string',
|
||||
})
|
||||
|
||||
optParser.options('backend', {
|
||||
describe: 'Start own backend process (use --no-backend to disable)',
|
||||
type: 'bool',
|
||||
default: true,
|
||||
})
|
||||
|
||||
let commandList = Object.keys(commands)
|
||||
commandList.sort()
|
||||
for (let command of commandList) {
|
||||
let config = commands[command]
|
||||
optParser.command(command, config.docs, args => {
|
||||
for (let option in config.options) {
|
||||
args.options(option, config.options[option])
|
||||
}
|
||||
for (let arg in config.args) {
|
||||
args.positional(arg, config.args[arg])
|
||||
}
|
||||
args.options('native', {
|
||||
describe: 'Run native tests',
|
||||
type: 'bool',
|
||||
default: true,
|
||||
})
|
||||
args.options('wasm', {
|
||||
describe: 'Run WASM tests',
|
||||
type: 'bool',
|
||||
default: true,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// ======================
|
||||
// === Package Config ===
|
||||
// ======================
|
||||
|
||||
function defaultConfig() {
|
||||
return {
|
||||
version: `${release.currentVersion()}`,
|
||||
author: {
|
||||
name: 'Enso Team',
|
||||
email: 'contact@enso.org',
|
||||
},
|
||||
homepage: 'https://github.com/enso-org/ide',
|
||||
repository: {
|
||||
type: 'git',
|
||||
url: 'git@github.com:enso-org/ide.git',
|
||||
},
|
||||
bugs: {
|
||||
url: 'https://github.com/enso-org/ide/issues',
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
async function processPackageConfigs() {
|
||||
let files = []
|
||||
files = files.concat(glob.sync(paths.ide_desktop.root + '/package.js', { cwd: paths.root }))
|
||||
files = files.concat(
|
||||
glob.sync(paths.ide_desktop.root + '/lib/*/package.js', { cwd: paths.root })
|
||||
)
|
||||
for (file of files) {
|
||||
let dirPath = path.dirname(file)
|
||||
let outPath = path.join(dirPath, 'package.json')
|
||||
let src = await fs.readFile(file, 'utf8')
|
||||
let modSrc = `module = {}\n${src}\nreturn module.exports`
|
||||
let fn = new Function('require', 'paths', modSrc)
|
||||
let mod = fn(require, paths)
|
||||
let config = mod.config
|
||||
if (!config) {
|
||||
throw `Package config '${file}' do not export 'module.config'.`
|
||||
}
|
||||
config = Object.assign(defaultConfig(), config)
|
||||
fs.writeFile(outPath, JSON.stringify(config, undefined, 4))
|
||||
}
|
||||
}
|
||||
|
||||
// ============
|
||||
// === Main ===
|
||||
// ============
|
||||
|
||||
async function updateBuildVersion(argv) {
|
||||
const target = get_target_platform(argv)
|
||||
let config = {}
|
||||
let configPath = paths.dist.buildInfo
|
||||
let exists = fss.existsSync(configPath)
|
||||
if (exists) {
|
||||
let configFile = await fs.readFile(configPath)
|
||||
config = JSON.parse(configFile)
|
||||
}
|
||||
|
||||
let commitHashCmd = await cmd.run_read('git', ['rev-parse', '--short', 'HEAD'])
|
||||
let commitHash = commitHashCmd.trim()
|
||||
|
||||
if (config.buildVersion !== commitHash || config.target !== target) {
|
||||
config.target = target
|
||||
config.buildVersion = commitHash
|
||||
await fs.mkdir(paths.dist.root, { recursive: true })
|
||||
await fs.writeFile(configPath, JSON.stringify(config, undefined, 2))
|
||||
}
|
||||
}
|
||||
|
||||
async function installJsDeps() {
|
||||
let initialized = isInitialized()
|
||||
let isCI = process.env.hasOwnProperty('CI')
|
||||
// We update JS dependencies on CI every time to ensure that incremental build is always possible.
|
||||
// Otherwise adding new dependency will require a clean build on CI.
|
||||
if (!initialized || isCI) {
|
||||
console.log('Installing application dependencies.')
|
||||
await cmd.with_cwd(paths.ide_desktop.root, async () => {
|
||||
await cmd.run('npm', ['run', 'install'])
|
||||
})
|
||||
}
|
||||
if (!initialized) {
|
||||
console.log('Downloading binary assets.')
|
||||
await downloadJsAssets()
|
||||
markAsInitialized()
|
||||
}
|
||||
}
|
||||
|
||||
// Return true if markAsInitialized was run in the past, otherwise return false.
|
||||
function isInitialized() {
|
||||
return fss.existsSync(paths.dist.init)
|
||||
}
|
||||
|
||||
// Create an empty file at paths.dist.init to signal that the initialization was done.
|
||||
async function markAsInitialized() {
|
||||
await fs.mkdir(paths.dist.root, { recursive: true })
|
||||
let handle = await fs.open(paths.dist.init, 'w')
|
||||
await handle.close()
|
||||
}
|
||||
|
||||
async function downloadJsAssets() {
|
||||
const workdir = path.join(paths.root, '.assets-temp')
|
||||
await fs.mkdir(workdir, { recursive: true })
|
||||
const ideAssetsMainZip = 'ide-assets-main.zip'
|
||||
const ideAssetsUrl = `https://github.com/enso-org/ide-assets/archive/refs/heads/main.zip`
|
||||
const unzippedAssets = path.join(workdir, 'ide-assets-main', 'content', 'assets')
|
||||
const jsLibAssets = path.join(paths.ide_desktop.lib.content, 'assets')
|
||||
await cmd.with_cwd(workdir, async () => {
|
||||
await cmd.run('curl', [
|
||||
'--retry',
|
||||
'4',
|
||||
'--retry-connrefused',
|
||||
'-fsSL',
|
||||
'-o',
|
||||
ideAssetsMainZip,
|
||||
ideAssetsUrl,
|
||||
])
|
||||
})
|
||||
|
||||
const assetsArchive = await unzipper.Open.file(path.join(workdir, ideAssetsMainZip))
|
||||
await assetsArchive.extract({ path: workdir })
|
||||
await fs.cp(unzippedAssets, jsLibAssets, { recursive: true })
|
||||
await fs.rm(workdir, { recursive: true, force: true })
|
||||
}
|
||||
|
||||
async function runCommand(command, argv) {
|
||||
let config = commands[command]
|
||||
cargoArgs = argv['--']
|
||||
if (config === undefined) {
|
||||
console.error(`Invalid command '${command}'.`)
|
||||
return
|
||||
}
|
||||
if (cargoArgs === undefined) {
|
||||
cargoArgs = []
|
||||
}
|
||||
let index = cargoArgs.indexOf('--')
|
||||
if (index == -1) {
|
||||
targetArgs = []
|
||||
} else {
|
||||
targetArgs = cargoArgs.slice(index + 1)
|
||||
cargoArgs = cargoArgs.slice(0, index)
|
||||
}
|
||||
let runner = async function () {
|
||||
let do_common = config.common
|
||||
let do_rust = argv.rust && config.rust
|
||||
let do_js = argv.js && config.js
|
||||
|
||||
let commonCmd = () => cmd.with_cwd(paths.root, async () => await config.common(argv))
|
||||
let rustCmd = () => cmd.with_cwd(paths.root, async () => await config.rust(argv))
|
||||
let jsCmd = () => cmd.with_cwd(paths.ide_desktop.root, async () => await config.js(argv))
|
||||
if (config.parallel) {
|
||||
let promises = []
|
||||
if (do_common) {
|
||||
promises.push(commonCmd())
|
||||
}
|
||||
if (do_rust) {
|
||||
promises.push(rustCmd())
|
||||
}
|
||||
if (do_js) {
|
||||
promises.push(jsCmd())
|
||||
}
|
||||
await Promise.all(promises)
|
||||
} else {
|
||||
if (do_common) {
|
||||
await commonCmd()
|
||||
}
|
||||
if (do_rust) {
|
||||
await rustCmd()
|
||||
}
|
||||
if (do_js) {
|
||||
await jsCmd()
|
||||
}
|
||||
}
|
||||
}
|
||||
cmd.section(command)
|
||||
runner()
|
||||
}
|
||||
|
||||
function get_target_platform(argv) {
|
||||
let target = argv.target
|
||||
if (target === undefined) {
|
||||
const local_platform = os.platform()
|
||||
switch (local_platform) {
|
||||
case 'darwin':
|
||||
return 'macos'
|
||||
case 'win32':
|
||||
return 'win'
|
||||
default:
|
||||
return local_platform
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
|
||||
async function main() {
|
||||
let argv = optParser.parse()
|
||||
await updateBuildVersion(argv)
|
||||
await processPackageConfigs()
|
||||
workflow.generate()
|
||||
let command = argv._[0]
|
||||
await runCommand(command, argv)
|
||||
}
|
||||
|
||||
main()
|
5
build/src/main.rs
Normal file
5
build/src/main.rs
Normal file
@ -0,0 +1,5 @@
|
||||
use enso_build::prelude::*;
|
||||
|
||||
fn main() -> Result {
|
||||
enso_build::cli::main::main()
|
||||
}
|
@ -1,493 +0,0 @@
|
||||
/// GitHub workflow generator. We are using custom generator in order to re-use sub-steps. This
|
||||
/// may not be needed anymore after this feature request will be resolved by GitHub:
|
||||
/// https://github.community/t/support-for-yaml-anchors/16128
|
||||
|
||||
const fss = require('fs')
|
||||
const path = require('path')
|
||||
const paths = require('./paths')
|
||||
const yaml = require('js-yaml')
|
||||
|
||||
// =================
|
||||
// === Constants ===
|
||||
// =================
|
||||
|
||||
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]'
|
||||
|
||||
const LINUX_RUNNER_GITHUB_HOSTED = ['ubuntu-latest']
|
||||
const MACOS_RUNNER_GITHUB_HOSTED = ['macOS-latest']
|
||||
const WINDOWS_RUNNER_GITHUB_HOSTED = ['windows-latest']
|
||||
|
||||
// =============
|
||||
// === Utils ===
|
||||
// =============
|
||||
|
||||
function cached_linux_runner(cache_label) {
|
||||
return ['Linux', cache_label]
|
||||
}
|
||||
|
||||
function job(runners, name, steps, cfg) {
|
||||
if (!cfg) {
|
||||
cfg = {}
|
||||
}
|
||||
return {
|
||||
name: name,
|
||||
'runs-on': '${{ matrix.runner }}',
|
||||
strategy: {
|
||||
matrix: {
|
||||
runner: runners,
|
||||
},
|
||||
'fail-fast': false,
|
||||
},
|
||||
// WARNING!
|
||||
// Do not update to `checkout@v2` because it is broken:
|
||||
// https://github.com/actions/checkout/issues/438
|
||||
steps: list({ uses: 'actions/checkout@v1', with: { clean: false } }, ...steps),
|
||||
...cfg,
|
||||
}
|
||||
}
|
||||
|
||||
function job_on_macos(...args) {
|
||||
return job([MACOS_RUNNER_GITHUB_HOSTED], ...args)
|
||||
}
|
||||
|
||||
function job_on_linux_cached(cache_label, ...args) {
|
||||
return job([cached_linux_runner(cache_label)], ...args)
|
||||
}
|
||||
|
||||
function job_on_linux(...args) {
|
||||
return job([LINUX_RUNNER_GITHUB_HOSTED], [], ...args)
|
||||
}
|
||||
|
||||
function job_on_ubuntu_18_04(...args) {
|
||||
return job(['ubuntu-18.04'], ...args)
|
||||
}
|
||||
|
||||
function list(...args) {
|
||||
let out = []
|
||||
for (let arg of args) {
|
||||
if (Array.isArray(arg)) {
|
||||
out.push(...arg)
|
||||
} else {
|
||||
out.push(arg)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// ============
|
||||
// === Info ===
|
||||
// ============
|
||||
|
||||
dumpGitHubContext = {
|
||||
name: 'Dump GitHub context',
|
||||
env: {
|
||||
GITHUB_CONTEXT: '${{ toJson(github) }}',
|
||||
},
|
||||
run: 'echo "$GITHUB_CONTEXT"',
|
||||
}
|
||||
|
||||
// ====================
|
||||
// === Dependencies ===
|
||||
// ====================
|
||||
|
||||
let installNode = {
|
||||
name: 'Install Node',
|
||||
uses: 'actions/setup-node@v1',
|
||||
with: {
|
||||
'node-version': NODE_VERSION,
|
||||
},
|
||||
}
|
||||
|
||||
// Install fixed version to avoid upgrading to a breaking version.
|
||||
// Should be removed once this has a better solution as described here:
|
||||
// https://github.com/enso-org/ide/issues/1772
|
||||
let installTypeScript = {
|
||||
name: 'Install TypeScript',
|
||||
run: 'npm install -g ts-node@10.1.0',
|
||||
}
|
||||
|
||||
function installWasmPackOn(name, sys, pkg) {
|
||||
return {
|
||||
name: `Install wasm-pack (${name})`,
|
||||
env: {
|
||||
WASMPACKURL: `https://github.com/rustwasm/wasm-pack/releases/download/v${WASM_PACK_VERSION}`,
|
||||
WASMPACKDIR: `wasm-pack-v${WASM_PACK_VERSION}-x86_64-${pkg}`,
|
||||
},
|
||||
run: `
|
||||
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
|
||||
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
|
||||
rm -r $WASMPACKDIR`,
|
||||
shell: 'bash',
|
||||
if: `startsWith(matrix.os,'${sys}')`,
|
||||
}
|
||||
}
|
||||
|
||||
let installWasmPackOnMacOS = installWasmPackOn('macOS', 'macOS', 'apple-darwin')
|
||||
let installWasmPackOnWindows = installWasmPackOn('Windows', 'windows', 'pc-windows-msvc')
|
||||
let installWasmPackOnLinux = installWasmPackOn('Linux', 'ubuntu', 'unknown-linux-musl')
|
||||
|
||||
// We could use cargo install wasm-pack, but that takes 3.5 minutes compared to few seconds.
|
||||
let installWasmPack = [installWasmPackOnMacOS, installWasmPackOnWindows, installWasmPackOnLinux]
|
||||
|
||||
const installJava = {
|
||||
uses: 'actions/setup-java@v2',
|
||||
with: {
|
||||
distribution: 'adopt',
|
||||
'java-version': '11',
|
||||
},
|
||||
}
|
||||
|
||||
// =============================
|
||||
// === Build, Lint, and Test ===
|
||||
// =============================
|
||||
|
||||
let buildPackage = {
|
||||
name: 'Build Package',
|
||||
run: 'node ./run dist --no-rust --skip-version-validation',
|
||||
shell: 'bash',
|
||||
env: {
|
||||
CSC_LINK: '${{secrets.APPLE_CODE_SIGNING_CERT}}',
|
||||
CSC_KEY_PASSWORD: '${{secrets.APPLE_CODE_SIGNING_CERT_PASSWORD}}',
|
||||
CSC_IDENTITY_AUTO_DISCOVERY: true,
|
||||
APPLEID: '${{secrets.APPLE_NOTARIZATION_USERNAME}}',
|
||||
APPLEIDPASS: '${{secrets.APPLE_NOTARIZATION_PASSWORD}}',
|
||||
FIREBASE_API_KEY: '${{secrets.FIREBASE_API_KEY}}',
|
||||
},
|
||||
}
|
||||
|
||||
let lintRust = {
|
||||
name: 'Lint Rust sources',
|
||||
run: 'node ./run lint --skip-version-validation',
|
||||
}
|
||||
|
||||
let testNoWASM = {
|
||||
name: 'Run tests (no WASM)',
|
||||
run: 'node ./run test --no-wasm --skip-version-validation',
|
||||
}
|
||||
|
||||
let testWASM = {
|
||||
name: 'Run tests (WASM)',
|
||||
run: 'node ./run test --no-native --skip-version-validation',
|
||||
}
|
||||
|
||||
let buildWASM = {
|
||||
name: 'Build WASM',
|
||||
run: 'node ./run build --no-js --skip-version-validation',
|
||||
}
|
||||
|
||||
let uploadContentLinux = {
|
||||
name: `Upload Content Artifacts`,
|
||||
uses: 'actions/upload-artifact@v2',
|
||||
with: {
|
||||
name: 'content',
|
||||
path: `dist/content`,
|
||||
},
|
||||
if: `runner.os == 'Linux'`,
|
||||
}
|
||||
|
||||
let uploadWASM = {
|
||||
name: `Upload IDE WASM artifacts`,
|
||||
uses: 'actions/upload-artifact@v2',
|
||||
with: {
|
||||
name: 'ide-wasm',
|
||||
path: `dist/wasm`,
|
||||
},
|
||||
}
|
||||
|
||||
let downloadWASM = {
|
||||
name: `Download IDE WASM artifacts`,
|
||||
uses: 'actions/download-artifact@v2',
|
||||
with: {
|
||||
name: 'ide-wasm',
|
||||
path: `dist/wasm`,
|
||||
},
|
||||
}
|
||||
|
||||
// =================
|
||||
// === Artifacts ===
|
||||
// =================
|
||||
|
||||
function uploadArtifactsFor(name, ext, os) {
|
||||
return {
|
||||
name: `Upload Artifacts (${name}, ${ext})`,
|
||||
uses: 'actions/upload-artifact@v1',
|
||||
with: {
|
||||
name: `enso-${os}-\${{fromJson(steps.changelog.outputs.content).version}}.${ext}`,
|
||||
path: `dist/client/enso-${os}-\${{fromJson(steps.changelog.outputs.content).version}}.${ext}`,
|
||||
},
|
||||
if: `runner.os == '${name}'`,
|
||||
}
|
||||
}
|
||||
|
||||
function uploadBinArtifactsWithChecksumsFor(name, ext, os) {
|
||||
return [uploadArtifactsFor(name, ext, os), uploadArtifactsFor(name, ext + '.sha256', os)]
|
||||
}
|
||||
|
||||
uploadBinArtifactsForMacOS = uploadBinArtifactsWithChecksumsFor('macOS', 'dmg', 'mac')
|
||||
uploadBinArtifactsForLinux = uploadBinArtifactsWithChecksumsFor('Linux', 'AppImage', 'linux')
|
||||
uploadBinArtifactsForWindows = uploadBinArtifactsWithChecksumsFor('Windows', 'exe', 'win')
|
||||
|
||||
let downloadArtifacts = {
|
||||
name: 'Download artifacts',
|
||||
uses: 'actions/download-artifact@v2',
|
||||
with: {
|
||||
path: 'artifacts',
|
||||
},
|
||||
}
|
||||
|
||||
// ===========
|
||||
// === Git ===
|
||||
// ===========
|
||||
|
||||
/// Gets a space-separated list of changed files between this commit and the `develop` branch.
|
||||
let getListOfChangedFiles = {
|
||||
name: 'Get list of changed files',
|
||||
id: 'changed_files',
|
||||
run: `
|
||||
list=\`git diff --name-only origin/\${{github.base_ref}} HEAD | tr '\\n' ' '\`
|
||||
echo $list
|
||||
echo "::set-output name=list::'$list'"`,
|
||||
shell: 'bash',
|
||||
if: `github.base_ref == 'develop' || github.base_ref == 'unstable' || github.base_ref == 'stable'`,
|
||||
}
|
||||
|
||||
// =================
|
||||
// === Changelog ===
|
||||
// =================
|
||||
|
||||
let getCurrentReleaseChangelogInfo = {
|
||||
name: 'Read changelog info',
|
||||
id: 'changelog',
|
||||
run: `
|
||||
node ./run ci-gen --skip-version-validation
|
||||
content=\`cat CURRENT_RELEASE_CHANGELOG.json\`
|
||||
echo "::set-output name=content::$content"`,
|
||||
shell: 'bash',
|
||||
}
|
||||
|
||||
let assertChangelogWasUpdated = [
|
||||
getListOfChangedFiles,
|
||||
{
|
||||
name: 'Assert if CHANGELOG.md was updated (on pull request)',
|
||||
run: `if [[ \${{ contains(steps.changed_files.outputs.list,'CHANGELOG.md') || contains(github.event.head_commit.message,'${FLAG_NO_CHANGELOG_NEEDED}') || contains(github.event.pull_request.body,'${FLAG_NO_CHANGELOG_NEEDED}') }} == false ]]; then exit 1; fi`,
|
||||
if: `github.base_ref == 'develop' || github.base_ref == 'unstable' || github.base_ref == 'stable'`,
|
||||
},
|
||||
]
|
||||
|
||||
// ======================
|
||||
// === GitHub Release ===
|
||||
// ======================
|
||||
|
||||
let uploadGitHubRelease = [
|
||||
{
|
||||
name: `Upload GitHub Release`,
|
||||
uses: 'softprops/action-gh-release@v1',
|
||||
env: {
|
||||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}',
|
||||
},
|
||||
with: {
|
||||
files: 'artifacts/**/enso-*',
|
||||
name: 'Enso ${{fromJson(steps.changelog.outputs.content).version}}',
|
||||
tag_name: 'v${{fromJson(steps.changelog.outputs.content).version}}',
|
||||
body: '${{fromJson(steps.changelog.outputs.content).body}}',
|
||||
prerelease: '${{fromJson(steps.changelog.outputs.content).prerelease}}',
|
||||
draft: true,
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
// ===================
|
||||
// === CDN Release ===
|
||||
// ===================
|
||||
|
||||
prepareAwsSessionCDN = {
|
||||
shell: 'bash',
|
||||
run: `
|
||||
aws configure --profile s3-upload <<-EOF > /dev/null 2>&1
|
||||
\${{ secrets.ARTEFACT_S3_ACCESS_KEY_ID }}
|
||||
\${{ secrets.ARTEFACT_S3_SECRET_ACCESS_KEY }}
|
||||
us-west-1
|
||||
text
|
||||
EOF`,
|
||||
}
|
||||
|
||||
function uploadToCDN(...names) {
|
||||
const actions = []
|
||||
for (let name of names) {
|
||||
const action = {
|
||||
name: `Upload '${name}' to CDN`,
|
||||
shell: 'bash',
|
||||
run:
|
||||
`aws s3 cp ./artifacts/content/assets/${name} ` +
|
||||
`s3://ensocdn/ide/\${{fromJson(steps.changelog.outputs.content).version}}/${name} --profile ` +
|
||||
`s3-upload --acl public-read`,
|
||||
}
|
||||
if (name.endsWith('.gz')) {
|
||||
action.run += ' --content-encoding gzip'
|
||||
}
|
||||
if (name.endsWith('.wasm')) {
|
||||
action.run += " --content-type 'application/wasm'"
|
||||
}
|
||||
actions.push(action)
|
||||
}
|
||||
return actions
|
||||
}
|
||||
|
||||
// ==================
|
||||
// === Assertions ===
|
||||
// ==================
|
||||
|
||||
let assertVersionUnstable = {
|
||||
name: 'Assert Version Unstable',
|
||||
run: 'node ./run assert-version-unstable --skip-version-validation',
|
||||
if: `github.ref == 'refs/heads/unstable' || github.base_ref == 'unstable'`,
|
||||
}
|
||||
|
||||
let assertVersionStable = {
|
||||
name: 'Assert Version Stable',
|
||||
run: 'node ./run assert-version-stable --skip-version-validation',
|
||||
if: `github.ref == 'refs/heads/stable' || github.base_ref == 'stable'`,
|
||||
}
|
||||
|
||||
let assertReleaseDoNotExists = [
|
||||
{
|
||||
id: 'checkCurrentReleaseTag',
|
||||
uses: 'mukunku/tag-exists-action@v1.0.0',
|
||||
env: {
|
||||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}',
|
||||
},
|
||||
with: {
|
||||
tag: 'v${{fromJson(steps.changelog.outputs.content).version}}',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Fail if release already exists',
|
||||
run: 'if [[ ${{ steps.checkCurrentReleaseTag.outputs.exists }} == true ]]; then exit 1; fi',
|
||||
if: `github.base_ref == 'unstable' || github.base_ref == 'stable'`,
|
||||
},
|
||||
]
|
||||
|
||||
assertNoSquashCommitForRelease = {
|
||||
name: `Fail if squash commit to the 'unstable' or the 'stable' branch.`,
|
||||
run: 'if [[ "${{ github.base_ref }}" == "unstable" || "${{ github.base_ref }}" == "stable" ]]; then exit 1; fi',
|
||||
}
|
||||
|
||||
let assertions = list(
|
||||
assertVersionUnstable,
|
||||
assertVersionStable,
|
||||
assertReleaseDoNotExists,
|
||||
assertChangelogWasUpdated,
|
||||
assertNoSquashCommitForRelease
|
||||
)
|
||||
|
||||
// ===============
|
||||
// === Workflow ===
|
||||
// ===============
|
||||
|
||||
/// Make a release only if it was a push to 'unstable' or 'stable'. Even if it was a pull request
|
||||
/// FROM these branches, the `github.ref` will be different.
|
||||
let releaseCondition = `github.ref == 'refs/heads/unstable' || github.ref == 'refs/heads/stable'`
|
||||
|
||||
let workflow = {
|
||||
name: 'GUI CI',
|
||||
on: {
|
||||
push: {
|
||||
branches: ['develop', 'unstable', 'stable'],
|
||||
},
|
||||
pull_request: {},
|
||||
workflow_dispatch: {},
|
||||
},
|
||||
jobs: {
|
||||
info: job_on_macos('Build Info', [dumpGitHubContext]),
|
||||
version_assertions: job_on_macos('Assertions', [
|
||||
getCurrentReleaseChangelogInfo,
|
||||
assertions,
|
||||
]),
|
||||
lint: job_on_linux_cached('linter', 'Linter', [installNode, installTypeScript, lintRust]),
|
||||
test: job_on_linux_cached('test_native', 'Native Tests', [
|
||||
installNode,
|
||||
installTypeScript,
|
||||
testNoWASM,
|
||||
]),
|
||||
'wasm-test': job_on_linux_cached('test_wasm', 'WASM Tests', [
|
||||
installNode,
|
||||
installTypeScript,
|
||||
installWasmPack,
|
||||
testWASM,
|
||||
]),
|
||||
build_wasm: job_on_linux_cached('build_wasm', 'Build WASM', [
|
||||
installNode,
|
||||
installTypeScript,
|
||||
installWasmPack,
|
||||
installJava,
|
||||
buildWASM,
|
||||
uploadWASM,
|
||||
]),
|
||||
package: job(
|
||||
[
|
||||
MACOS_RUNNER_GITHUB_HOSTED,
|
||||
WINDOWS_RUNNER_GITHUB_HOSTED,
|
||||
cached_linux_runner('package'),
|
||||
],
|
||||
'Build package',
|
||||
[
|
||||
getCurrentReleaseChangelogInfo,
|
||||
installNode,
|
||||
installTypeScript,
|
||||
installWasmPack,
|
||||
installJava,
|
||||
|
||||
downloadWASM,
|
||||
buildPackage,
|
||||
uploadContentLinux,
|
||||
uploadBinArtifactsForMacOS,
|
||||
uploadBinArtifactsForWindows,
|
||||
uploadBinArtifactsForLinux,
|
||||
],
|
||||
{ needs: ['build_wasm'] }
|
||||
),
|
||||
release_to_github: job_on_macos(
|
||||
'GitHub Release',
|
||||
[
|
||||
downloadArtifacts,
|
||||
getCurrentReleaseChangelogInfo,
|
||||
// This assertion is checked earlier, but we should double-check it in case several
|
||||
// CI jobs wil be run on this branch and a release was created when this workflow was
|
||||
// running.
|
||||
assertReleaseDoNotExists,
|
||||
uploadGitHubRelease,
|
||||
],
|
||||
{ if: releaseCondition, needs: ['version_assertions', 'lint', 'test', 'package'] }
|
||||
),
|
||||
release_to_cdn: job_on_ubuntu_18_04(
|
||||
'CDN Release',
|
||||
[
|
||||
downloadArtifacts,
|
||||
getCurrentReleaseChangelogInfo,
|
||||
prepareAwsSessionCDN,
|
||||
uploadToCDN('index.js.gz', 'style.css', 'ide.wasm', 'wasm_imports.js.gz'),
|
||||
],
|
||||
{ if: releaseCondition, needs: ['version_assertions', 'lint', 'test', 'package'] }
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
let header = `# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
# DO NOT CHANGE THIS FILE. IT WAS GENERATED FROM 'build/workflow.js'. READ DOCS THERE TO LEARN MORE.
|
||||
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
`
|
||||
|
||||
/// Generates a new GitHub workflow file (in .github/workflow/...).
|
||||
function generate() {
|
||||
let workflow_script = header + '\n' + yaml.dump(workflow, { noRefs: true, quotingType: '"' })
|
||||
fss.writeFileSync(path.join(paths.github.workflows, 'gui.yml'), workflow_script)
|
||||
}
|
||||
|
||||
// ===============
|
||||
// === Exports ===
|
||||
// ===============
|
||||
|
||||
module.exports = { generate }
|
@ -209,11 +209,11 @@ learn details on setting your system up. Quick summary:
|
||||
```bash
|
||||
enso$ rustup toolchain install stable # Stable toolchain required for the following tools.
|
||||
enso$ cargo +stable install wasm-pack --version 0.10.2 # Install the wasm-pack toolkit.
|
||||
enso$ cargo +stable install cargo-watch # To enable ./run watch utility
|
||||
enso$ cargo +stable install cargo-watch # To enable `./run.sh wasm watch` utility
|
||||
```
|
||||
|
||||
The previous three steps shall be enough to build the IDE via
|
||||
`./run build --dev`.
|
||||
`./run.sh wasm build run wasm build --wasm-profile dev`.
|
||||
|
||||
### Getting Set Up (JVM)
|
||||
|
||||
@ -498,8 +498,7 @@ 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 `./run 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.sh wasm test`.
|
||||
|
||||
#### Testing Enso Libraries
|
||||
|
||||
@ -607,22 +606,20 @@ Hello, World!
|
||||
#### Running IDE
|
||||
|
||||
You can start [IDE](https://github.com/enso-org/enso/tree/develop/gui) with a
|
||||
development version of the language server. IDE executable has `--no-backend`
|
||||
flag that switches off the bundled backend. That requires you to run the project
|
||||
manager process yourself. You can either get a project manager from one of the
|
||||
latest releases on [GitHub](https://github.com/enso-org/enso/releases), or build
|
||||
one using SBT `buildProjectManagerDistribution` command.
|
||||
development version of the language server. IDE executable has
|
||||
`--external-backend` flag that switches off the bundled backend. That requires
|
||||
you to run the project manager process yourself. You can either get a project
|
||||
manager from one of the latest releases on
|
||||
[GitHub](https://github.com/enso-org/enso/releases), or build one using SBT
|
||||
`buildProjectManagerDistribution` command.
|
||||
|
||||
Running development version of the IDE is possible via the `./run` script in the
|
||||
root of the repository:
|
||||
Running development version of the IDE is possible via the `./run.sh` script in
|
||||
the root of the repository:
|
||||
|
||||
```bash
|
||||
$ ./run start --dev --no-backend
|
||||
$ ./run.sh ide start --wasm-profile dev --external-backend
|
||||
```
|
||||
|
||||
One can also add `--no-rust` to speed the start up when no changes to IDE
|
||||
sources were made.
|
||||
|
||||
##### Bash
|
||||
|
||||
```bash
|
||||
|
@ -1,18 +1,15 @@
|
||||
[package]
|
||||
name = "enso-automata"
|
||||
name = "enso-automata"
|
||||
version = "0.2.0"
|
||||
authors = ["Enso Team <contact@luna-lang.org>"]
|
||||
edition = "2021"
|
||||
|
||||
description = "A finite-automata-based lexing engine."
|
||||
readme = "README.md"
|
||||
homepage = "https://github.com/enso-org/enso/lib/rust/automata"
|
||||
repository = "https://github.com/enso-org/enso"
|
||||
description = "A finite-automata-based lexing engine."
|
||||
readme = "README.md"
|
||||
homepage = "https://github.com/enso-org/enso/lib/rust/automata"
|
||||
repository = "https://github.com/enso-org/enso"
|
||||
license-file = "../../LICENSE"
|
||||
|
||||
keywords = ["lexer", "finite-automata"]
|
||||
categories = ["parsing"]
|
||||
|
||||
publish = true
|
||||
|
||||
[lib]
|
||||
|
@ -9,5 +9,5 @@ crate-type = ["rlib", "cdylib"]
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0" }
|
||||
serde_yaml = { version = "=0.8.14" }
|
||||
serde_yaml = { version = "0.8.23" }
|
||||
Inflector = { version = "0.11.4" }
|
||||
|
@ -1,18 +1,15 @@
|
||||
[package]
|
||||
name = "enso-data-structures"
|
||||
name = "enso-data-structures"
|
||||
version = "0.2.0"
|
||||
authors = ["Enso Team <contact@luna-lang.org>"]
|
||||
edition = "2021"
|
||||
|
||||
description = "A collection of useful data structures."
|
||||
readme = "README.md"
|
||||
homepage = "https://github.com/enso-org/enso/lib/rust/data"
|
||||
repository = "https://github.com/enso-org/enso"
|
||||
description = "A collection of useful data structures."
|
||||
readme = "README.md"
|
||||
homepage = "https://github.com/enso-org/enso/lib/rust/data"
|
||||
repository = "https://github.com/enso-org/enso"
|
||||
license-file = "../../LICENSE"
|
||||
|
||||
keywords = []
|
||||
categories = ["data-structures"]
|
||||
|
||||
publish = true
|
||||
|
||||
[lib]
|
||||
@ -20,9 +17,9 @@ crate-type = ["rlib", "cdylib"]
|
||||
|
||||
[dependencies]
|
||||
enso-prelude = { version = "^0.2.1", path = "../prelude" }
|
||||
serde = { version = "1.0" , features = ["derive"] }
|
||||
typenum = { version = "1.11.2" }
|
||||
rustversion = { version = "1.0" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
typenum = { version = "1.11.2" }
|
||||
rustversion = { version = "1.0" }
|
||||
failure = { version = "0.1.6" }
|
||||
|
||||
[dev-dependencies]
|
||||
|
@ -7,5 +7,5 @@ edition = "2021"
|
||||
[dependencies]
|
||||
derivative = "2.2.0"
|
||||
js-sys = { version = "0.3.28" }
|
||||
wasm-bindgen = { version = "0.2.78", features = [ "nightly" ] }
|
||||
web-sys = { version = "0.3.4", features = [ "console" ] }
|
||||
wasm-bindgen = { version = "0.2.78", features = ["nightly"] }
|
||||
web-sys = { version = "0.3.4", features = ["console"] }
|
||||
|
@ -7,8 +7,8 @@ edition = "2021"
|
||||
[dependencies]
|
||||
enso-web = { path = "../../../web" }
|
||||
enso-frp = { path = "../../../frp" }
|
||||
enso-logger = { path = "../../../logger"}
|
||||
enso-prelude = { path = "../../../prelude"}
|
||||
enso-logger = { path = "../../../logger" }
|
||||
enso-prelude = { path = "../../../prelude" }
|
||||
js-sys = { version = "0.3.28" }
|
||||
wasm-bindgen = { version = "0.2.78", features = ["nightly"] }
|
||||
wasm-bindgen-futures = { version = "0.4.8" }
|
||||
@ -16,10 +16,10 @@ wasm-bindgen-futures = { version = "0.4.8" }
|
||||
[dependencies.web-sys]
|
||||
version = "0.3.4"
|
||||
features = [
|
||||
'Blob',
|
||||
'DragEvent',
|
||||
'DataTransfer',
|
||||
'File',
|
||||
'FileList',
|
||||
'ReadableStream',
|
||||
'Blob',
|
||||
'DragEvent',
|
||||
'DataTransfer',
|
||||
'File',
|
||||
'FileList',
|
||||
'ReadableStream',
|
||||
]
|
||||
|
@ -14,4 +14,4 @@ ensogl-core = { path = "../../core" }
|
||||
|
||||
[dev-dependencies]
|
||||
wasm-bindgen-test = { version = "0.3.8" }
|
||||
float_eq = "0.5"
|
||||
float_eq = "0.5"
|
||||
|
@ -13,4 +13,3 @@ ensogl-text = { path = "../text" }
|
||||
|
||||
[dev-dependencies]
|
||||
approx = "0.5.1"
|
||||
|
||||
|
@ -10,7 +10,7 @@ ensogl-core = { path = "../../core" }
|
||||
ensogl-hardcoded-theme = { path = "../../app/theme/hardcoded" }
|
||||
ensogl-shadow = { path = "../shadow" }
|
||||
ensogl-text = { path = "../text" }
|
||||
ensogl-toggle-button = { path = "../toggle-button" }
|
||||
ensogl-toggle-button = { path = "../toggle-button" }
|
||||
|
||||
[dev-dependencies]
|
||||
float_eq = "0.5"
|
||||
float_eq = "0.5"
|
||||
|
@ -4,7 +4,6 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
enso-frp = { path = "../../../frp" }
|
||||
enso-profiler = { path = "../../../profiler" }
|
||||
|
@ -9,8 +9,8 @@ crate-type = ["rlib", "cdylib"]
|
||||
|
||||
[dependencies]
|
||||
enso-frp = { path = "../../../frp" }
|
||||
enso-prelude = { path = "../../../prelude"}
|
||||
enso-shapely = { path = "../../../shapely"}
|
||||
enso-prelude = { path = "../../../prelude" }
|
||||
enso-shapely = { path = "../../../shapely" }
|
||||
enso-text = { path = "../../../text" }
|
||||
enso-types = { path = "../../../types" }
|
||||
ensogl-core = { path = "../../core" }
|
||||
|
@ -9,7 +9,7 @@ crate-type = ["cdylib", "rlib"]
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[dependencies]
|
||||
enso-prelude = { path = "../../../../prelude"}
|
||||
enso-prelude = { path = "../../../../prelude" }
|
||||
|
||||
[build-dependencies]
|
||||
enso-build-utilities = { path = "../../../../build-utils" }
|
||||
|
@ -8,7 +8,7 @@ edition = "2021"
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[dependencies]
|
||||
enso-prelude = { path = "../../../../prelude"}
|
||||
enso-prelude = { path = "../../../../prelude" }
|
||||
js-sys = { version = "0.3" }
|
||||
nalgebra = { version = "0.26.1" }
|
||||
wasm-bindgen = { version = "0.2.78" }
|
||||
|
@ -4,7 +4,6 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
enso-frp = { path = "../../../frp" }
|
||||
ensogl-core = { path = "../../core" }
|
||||
|
@ -18,12 +18,12 @@ enso-callback = { path = "../../callback" }
|
||||
enso-data-structures = { path = "../../data-structures" }
|
||||
enso-debug-api = { path = "../../debug-api" }
|
||||
enso-frp = { path = "../../frp" }
|
||||
enso-generics = { path = "../../generics"}
|
||||
enso-logger = { path = "../../logger"}
|
||||
enso-optics = { path = "../../optics"}
|
||||
enso-prelude = { path = "../../prelude"}
|
||||
enso-profiler = { path = "../../profiler"}
|
||||
enso-shapely = { path = "../../shapely"}
|
||||
enso-generics = { path = "../../generics" }
|
||||
enso-logger = { path = "../../logger" }
|
||||
enso-optics = { path = "../../optics" }
|
||||
enso-prelude = { path = "../../prelude" }
|
||||
enso-profiler = { path = "../../profiler" }
|
||||
enso-shapely = { path = "../../shapely" }
|
||||
enso-shortcuts = { path = "../../shortcuts" }
|
||||
enso-types = { path = "../../types" }
|
||||
enso-web = { path = "../../web" }
|
||||
@ -40,11 +40,11 @@ nalgebra = { version = "0.26.1" }
|
||||
num_enum = { version = "0.5.1" }
|
||||
num-traits = { version = "0.2" }
|
||||
rustc-hash = { version = "1.0.1" }
|
||||
semver = { version = "1.0.9" }
|
||||
serde = { version = "1" }
|
||||
shrinkwraprs = { version = "0.3.0" }
|
||||
smallvec = { version = "1.0.0" }
|
||||
typenum = { version = "1.11.2" }
|
||||
|
||||
# We require exact version of wasm-bindgen because we do patching final js in our build process,
|
||||
# and this is vulnerable to any wasm-bindgen version change.
|
||||
wasm-bindgen = { version = "0.2.78", features = ["nightly"] }
|
||||
|
@ -71,6 +71,13 @@ impl ArgReader for bool {
|
||||
}
|
||||
}
|
||||
|
||||
impl ArgMarker for semver::Version {}
|
||||
impl ArgReader for semver::Version {
|
||||
fn read_arg(str: String) -> Option<Self> {
|
||||
semver::Version::parse(&str).ok()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// =================
|
||||
|
@ -12,4 +12,4 @@ enso-frp = { path = "../../../frp" }
|
||||
ensogl-core = { path = "../../core" }
|
||||
ensogl-text-msdf-sys = { path = "../../component/text/msdf-sys" }
|
||||
enso-prelude = { path = "../../../prelude" }
|
||||
wasm-bindgen = { version = "0.2.78", features = [ "nightly" ] }
|
||||
wasm-bindgen = { version = "0.2.78", features = ["nightly"] }
|
||||
|
@ -7,7 +7,6 @@ edition = "2021"
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
ensogl-core = { path = "../../core" }
|
||||
wasm-bindgen = { version = "0.2.78", features = [ "nightly" ] }
|
||||
wasm-bindgen = { version = "0.2.78", features = ["nightly"] }
|
||||
|
@ -7,9 +7,8 @@ edition = "2021"
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
ensogl-core = { path = "../../core" }
|
||||
enso-frp = { path = "../../../frp" }
|
||||
wasm-bindgen = { version = "0.2.78", features = [ "nightly" ] }
|
||||
enso-profiler = { path = "../../../profiler"}
|
||||
wasm-bindgen = { version = "0.2.78", features = ["nightly"] }
|
||||
enso-profiler = { path = "../../../profiler" }
|
||||
|
@ -7,8 +7,7 @@ edition = "2021"
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
ensogl-core = { path = "../../core" }
|
||||
wasm-bindgen = { version = "0.2.78", features = [ "nightly" ] }
|
||||
wasm-bindgen = { version = "0.2.78", features = ["nightly"] }
|
||||
nalgebra = { version = "0.26.1" }
|
||||
|
@ -7,11 +7,10 @@ edition = "2021"
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
enso-frp = { path = "../../../frp" }
|
||||
ensogl-core = { path = "../../core" }
|
||||
ensogl-drop-manager = { path = "../../component/drop-manager" }
|
||||
enso-prelude = { path = "../../../prelude" }
|
||||
wasm-bindgen = { version = "0.2.78", features = [ "nightly" ] }
|
||||
wasm-bindgen = { version = "0.2.78", features = ["nightly"] }
|
||||
wasm-bindgen-futures = { version = "0.4.8" }
|
||||
|
@ -7,10 +7,9 @@ edition = "2021"
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
ensogl-core = { path = "../../core" }
|
||||
wasm-bindgen = { version = "0.2.78", features = [ "nightly" ] }
|
||||
wasm-bindgen = { version = "0.2.78", features = ["nightly"] }
|
||||
js-sys = { version = "0.3.28" }
|
||||
nalgebra = { version = "0.26.1" }
|
||||
web-sys = { version = "0.3.4" }
|
||||
|
@ -7,9 +7,8 @@ edition = "2021"
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
ensogl-core = { path = "../../core" }
|
||||
ensogl-text = { path = "../../component/text" }
|
||||
ensogl-text-msdf-sys = { path = "../../component/text/msdf-sys" }
|
||||
wasm-bindgen = { version = "0.2.78", features = [ "nightly" ] }
|
||||
wasm-bindgen = { version = "0.2.78", features = ["nightly"] }
|
||||
|
@ -7,7 +7,6 @@ edition = "2021"
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
enso-frp = { path = "../../../frp" }
|
||||
ensogl-core = { path = "../../core" }
|
||||
@ -15,4 +14,4 @@ ensogl-hardcoded-theme = { path = "../../app/theme/hardcoded" }
|
||||
ensogl-list-view = { path = "../../component/list-view" }
|
||||
ensogl-text-msdf-sys = { path = "../../component/text/msdf-sys" }
|
||||
enso-text = { path = "../../../text" }
|
||||
wasm-bindgen = { version = "0.2.78", features = [ "nightly" ] }
|
||||
wasm-bindgen = { version = "0.2.78", features = ["nightly"] }
|
||||
|
@ -7,9 +7,8 @@ edition = "2021"
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
enso-frp = { path = "../../../frp" }
|
||||
ensogl-core = { path = "../../core" }
|
||||
ensogl-text-msdf-sys = { path = "../../component/text/msdf-sys" }
|
||||
wasm-bindgen = { version = "0.2.78", features = [ "nightly" ] }
|
||||
wasm-bindgen = { version = "0.2.78", features = ["nightly"] }
|
||||
|
@ -23,7 +23,7 @@ ensogl-text = { path = "../../component/text" }
|
||||
ensogl-text-msdf-sys = { path = "../../component/text/msdf-sys" }
|
||||
futures = "0.3"
|
||||
serde = "1"
|
||||
wasm-bindgen = { version = "0.2.58", features = [ "nightly" ] }
|
||||
wasm-bindgen = { version = "0.2.58", features = ["nightly"] }
|
||||
wasm-bindgen-futures = "0.4"
|
||||
url = "2.2.2"
|
||||
qstring = "0.7.2"
|
||||
@ -31,10 +31,10 @@ qstring = "0.7.2"
|
||||
[dependencies.web-sys]
|
||||
version = "0.3"
|
||||
features = [
|
||||
'Headers',
|
||||
'Request',
|
||||
'RequestInit',
|
||||
'RequestMode',
|
||||
'Response',
|
||||
'Window',
|
||||
'Headers',
|
||||
'Request',
|
||||
'RequestInit',
|
||||
'RequestMode',
|
||||
'Response',
|
||||
'Window',
|
||||
]
|
||||
|
@ -7,7 +7,6 @@ edition = "2021"
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
enso-frp = { path = "../../../frp" }
|
||||
enso-profiler = { path = "../../../profiler" }
|
||||
@ -21,10 +20,9 @@ ensogl-text = { path = "../../component/text" }
|
||||
ensogl-text-msdf-sys = { path = "../../component/text/msdf-sys" }
|
||||
ensogl-tooltip = { path = "../../component/tooltip" }
|
||||
futures = "0.3"
|
||||
wasm-bindgen = { version = "0.2.58", features = [ "nightly" ] }
|
||||
wasm-bindgen = { version = "0.2.58", features = ["nightly"] }
|
||||
wasm-bindgen-futures = "0.4"
|
||||
|
||||
|
||||
[dependencies.web-sys]
|
||||
version = "0.3"
|
||||
features = [
|
||||
|
@ -7,10 +7,9 @@ edition = "2021"
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
ensogl-core = { path = "../../core" }
|
||||
ensogl-hardcoded-theme = { path = "../../app/theme/hardcoded" }
|
||||
ensogl-scroll-area = { path = "../../component/scroll-area" }
|
||||
ensogl-text-msdf-sys = { path = "../../component/text/msdf-sys" }
|
||||
wasm-bindgen = { version = "0.2.78", features = [ "nightly" ] }
|
||||
wasm-bindgen = { version = "0.2.78", features = ["nightly"] }
|
||||
|
@ -7,8 +7,7 @@ edition = "2021"
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
ensogl-core = { path = "../../core" }
|
||||
wasm-bindgen = { version = "0.2.78", features = [ "nightly" ] }
|
||||
enso-profiler = { path = "../../../profiler"}
|
||||
wasm-bindgen = { version = "0.2.78", features = ["nightly"] }
|
||||
enso-profiler = { path = "../../../profiler" }
|
||||
|
@ -7,10 +7,9 @@ edition = "2021"
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
ensogl-core = { path = "../../core" }
|
||||
ensogl-hardcoded-theme = { path = "../../app/theme/hardcoded" }
|
||||
ensogl-text-msdf-sys = { path = "../../component/text/msdf-sys" }
|
||||
ensogl-selector = { path = "../../component/selector" }
|
||||
wasm-bindgen = { version = "0.2.78", features = [ "nightly" ] }
|
||||
wasm-bindgen = { version = "0.2.78", features = ["nightly"] }
|
||||
|
@ -7,8 +7,7 @@ edition = "2021"
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
ensogl-core = { path = "../../core" }
|
||||
nalgebra = { version = "0.26.1" }
|
||||
wasm-bindgen = { version = "0.2.78", features = [ "nightly" ] }
|
||||
wasm-bindgen = { version = "0.2.78", features = ["nightly"] }
|
||||
|
@ -7,8 +7,7 @@ edition = "2021"
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
ensogl-core = { path = "../../core" }
|
||||
enso-web = { path = "../../../web" }
|
||||
wasm-bindgen = { version = "0.2.78", features = [ "nightly" ] }
|
||||
wasm-bindgen = { version = "0.2.78", features = ["nightly"] }
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user