From 4d7962fa9d0d7834f2e93f675806e7d51a7b9380 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Sun, 3 Nov 2024 09:51:15 +0800 Subject: [PATCH] chore: remove the requirement of bootstrap (#4) --- .github/workflows/test.yml | 24 --------------------- package.json | 10 +-------- scripts/README.md | 7 ------ src/README.md | 22 ------------------- src/asconfig.json | 44 -------------------------------------- 5 files changed, 1 insertion(+), 106 deletions(-) delete mode 100644 src/asconfig.json diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 77a4f733..9728e3de 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,30 +49,6 @@ jobs: run: npm run build - name: Test run: npm test - bootstrap: - name: "Bootstrap (${{ matrix.target }})" - runs-on: ubuntu-latest - needs: check - strategy: - matrix: - target: ["debug", "release"] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: current - - name: Install dependencies - run: npm ci --no-audit - - name: Build - run: npm run build - - name: "Bootstrap ${{ matrix.target }}" - run: npm run bootstrap:${{ matrix.target }} - - name: "Test ${{ matrix.target }}" - run: npm run test:compiler -- --wasm build/assemblyscript.${{ matrix.target }}-bootstrap.js - - name: "Compile ${{ matrix.target }} -> ${{ matrix.target == 'debug' && 'release' || 'debug' }}" - run: node bin/asc --config src/asconfig.json --target ${{ matrix.target == 'debug' && 'release' || 'debug' }}-bootstrap --wasm ./build/assemblyscript.${{ matrix.target }}-bootstrap.js - - name: "Test ${{ matrix.target == 'debug' && 'release' || 'debug' }}" - run: npm run test:compiler -- --wasm build/assemblyscript.${{ matrix.target == 'debug' && 'release' || 'debug' }}-bootstrap.js features: name: "Features" runs-on: ubuntu-latest diff --git a/package.json b/package.json index 8cf6cd95..59e43bea 100644 --- a/package.json +++ b/package.json @@ -84,15 +84,7 @@ "test:transform": "npm run test:transform:esm && npm run test:transform:cjs", "test:transform:esm": "node bin/asc tests/compiler/empty --transform ./tests/transform/index.js --noEmit && node bin/asc tests/compiler/empty --transform ./tests/transform/simple.js --noEmit", "test:transform:cjs": "node bin/asc tests/compiler/empty --transform ./tests/transform/cjs/index.js --noEmit && node bin/asc tests/compiler/empty --transform ./tests/transform/cjs/simple.js --noEmit", - "test:cli": "node tests/cli/options.js", - "asbuild": "npm run asbuild:debug && npm run asbuild:release", - "asbuild:debug": "node bin/asc --config src/asconfig.json --target debug", - "asbuild:release": "node bin/asc --config src/asconfig.json --target release", - "asbuild:rtraced": "node bin/asc --config src/asconfig.json --target rtraced", - "bootstrap": "npm run bootstrap:debug && npm run bootstrap:release", - "bootstrap:debug": "node bin/asc --config src/asconfig.json --target debug && node bin/asc --config src/asconfig.json --target debug-bootstrap --wasm ./build/assemblyscript.debug.js && node bin/asc --config src/asconfig.json --target debug-bootstrap --wasm ./build/assemblyscript.debug-bootstrap.js && git --no-pager diff --no-index build/assemblyscript.debug.wast build/assemblyscript.debug-bootstrap.wast", - "bootstrap:release": "node bin/asc --config src/asconfig.json --target release && node bin/asc --config src/asconfig.json --target release-bootstrap --wasm ./build/assemblyscript.release.js && node bin/asc --config src/asconfig.json --target release-bootstrap --wasm ./build/assemblyscript.release-bootstrap.js && git --no-pager diff --no-index build/assemblyscript.release.wast build/assemblyscript.release-bootstrap.wast", - "bootstrap:rtraced": "node bin/asc --config src/asconfig.json --target rtraced && node bin/asc --config src/asconfig.json --target rtraced --wasm ./build/assemblyscript.rtraced.js" + "test:cli": "node tests/cli/options.js" }, "files": [ "bin/", diff --git a/scripts/README.md b/scripts/README.md index 803ea4e6..9d02ca7b 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -11,10 +11,3 @@ Various scripts for development purposes. | npm run watch | Builds the compiler and watches for changes | | npm run check | Performs sanity checks on code style etc. | | npm test | Runs the test suite | - -### WebAssembly target - -| Command | Description | -| ----------------- | -------------------------------------- | -| npm run asbuild | Compiles the compiler to WebAssembly | -| npm run bootstrap | Bootstraps the compiler to WebAssembly | diff --git a/src/README.md b/src/README.md index f8987d3e..28e87650 100644 --- a/src/README.md +++ b/src/README.md @@ -28,25 +28,3 @@ The rebuild automatically when there are changes, do: ```sh npm run watch ``` - -### Building to WebAssembly - -To build the compiler to a WebAssembly binary, run: - -```sh -npm run bootstrap -``` - -Uses the AssemblyScript compiler compiled to JavaScript to compile itself to WebAssembly, building to WebAssembly again using itself compiled to WebAssembly. Builds to `build/`. Performs a `git diff` to make sure that both the initial and the final artifacts are the same. Note that this builds the compiler as a library, while the `asc` frontend setting it up and feeding it source files is JavaScript for now. - -Running `asc` with the WebAssembly variant: - -```ts -asc [options...] --wasm build/assemblyscript.release-bootstrap.js -``` - -Running the compiler tests with the WebAssembly variant: - -```ts -npm run test:compiler -- --wasm build/assemblyscript.release-bootstrap.js -``` diff --git a/src/asconfig.json b/src/asconfig.json deleted file mode 100644 index 84cf96a9..00000000 --- a/src/asconfig.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "entries": ["./glue/wasm/index.ts", "./index-wasm.ts"], - "options": { - "exportStart": "_initialize", - "exportRuntime": true, - "initialMemory": 768, - "runtime": "incremental", - "bindings": ["esm"], - "stats": true - }, - "targets": { - "debug": { - "outFile": "../build/assemblyscript.debug.wasm", - "textFile": "../build/assemblyscript.debug.wast", - "debug": true, - "sourceMap": true - }, - "release": { - "outFile": "../build/assemblyscript.release.wasm", - "textFile": "../build/assemblyscript.release.wast", - "optimizeLevel": 3, - "shrinkLevel": 0 - }, - "rtraced": { - "outFile": "../build/assemblyscript.rtraced.wasm", - "textFile": "../build/assemblyscript.rtraced.wast", - "debug": true, - "use": "ASC_RTRACE=1", - "runPasses": [] - }, - "debug-bootstrap": { - "outFile": "../build/assemblyscript.debug-bootstrap.wasm", - "textFile": "../build/assemblyscript.debug-bootstrap.wast", - "debug": true, - "sourceMap": true - }, - "release-bootstrap": { - "outFile": "../build/assemblyscript.release-bootstrap.wasm", - "textFile": "../build/assemblyscript.release-bootstrap.wast", - "optimizeLevel": 3, - "shrinkLevel": 0 - } - } -}