Update CIs and documents to make naming of generated binaries consistent (#1823)

This commit is contained in:
TianlongLiang 2022-12-24 09:17:39 +08:00 committed by GitHub
parent d04f3988c3
commit 6fd8001eb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 97 additions and 58 deletions

View File

@ -50,7 +50,7 @@ jobs:
./core/deps/llvm-project/build/libexec ./core/deps/llvm-project/build/libexec
./core/deps/llvm-project/build/share ./core/deps/llvm-project/build/share
./core/deps/llvm-project/lldb/tools/ ./core/deps/llvm-project/lldb/tools/
./core/deps/llvm-project/inst/ ./core/deps/llvm-project/wamr-lldb/
key: ${{inputs.arch}}-${{ inputs.runner }}-lldb_build key: ${{inputs.arch}}-${{ inputs.runner }}-lldb_build
- name: setup xcode macos - name: setup xcode macos
@ -92,10 +92,10 @@ jobs:
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'ubuntu') if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'ubuntu')
run: | run: |
echo "start to build lldb..." echo "start to build lldb..."
mkdir -p inst mkdir -p wamr-lldb
cmake -S ./llvm -B build \ cmake -S ./llvm -B build \
-G Ninja \ -G Ninja \
-DCMAKE_INSTALL_PREFIX=../inst \ -DCMAKE_INSTALL_PREFIX=../wamr-lldb \
-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lldb" \ -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lldb" \
-DLLVM_TARGETS_TO_BUILD=X86 \ -DLLVM_TARGETS_TO_BUILD=X86 \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DLLVM_BUILD_BENCHMARKS:BOOL=OFF \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DLLVM_BUILD_BENCHMARKS:BOOL=OFF \
@ -111,10 +111,10 @@ jobs:
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos') if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos')
run: | run: |
echo "start to build lldb..." echo "start to build lldb..."
mkdir -p inst mkdir -p wamr-lldb
cmake -S ./llvm -B build \ cmake -S ./llvm -B build \
-G Ninja \ -G Ninja \
-DCMAKE_INSTALL_PREFIX=../inst \ -DCMAKE_INSTALL_PREFIX=../wamr-lldb \
-DCMAKE_BUILD_TYPE:STRING="Release" \ -DCMAKE_BUILD_TYPE:STRING="Release" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DLLVM_ENABLE_PROJECTS="clang;lldb" \ -DLLVM_ENABLE_PROJECTS="clang;lldb" \
@ -134,30 +134,30 @@ jobs:
- name: pack a distribution - name: pack a distribution
if: steps.lldb_build_cache.outputs.cache-hit != 'true' if: steps.lldb_build_cache.outputs.cache-hit != 'true'
run: | run: |
mkdir -p inst/bin mkdir -p wamr-lldb/bin
mkdir -p inst/lib mkdir -p wamr-lldb/lib
cp build/bin/lldb* inst/bin cp build/bin/lldb* wamr-lldb/bin
cp lldb/tools/lldb-vscode/package.json inst cp lldb/tools/lldb-vscode/package.json wamr-lldb
cp -r lldb/tools/lldb-vscode/syntaxes/ inst cp -r lldb/tools/lldb-vscode/syntaxes/ wamr-lldb
working-directory: core/deps/llvm-project working-directory: core/deps/llvm-project
- name: pack ubuntu specific libraries - name: pack ubuntu specific libraries
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'ubuntu') if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'ubuntu')
run: | run: |
cp build/lib/liblldb*.so inst/lib cp build/lib/liblldb*.so wamr-lldb/lib
cp build/lib/liblldb*.so.* inst/lib cp build/lib/liblldb*.so.* wamr-lldb/lib
working-directory: core/deps/llvm-project working-directory: core/deps/llvm-project
- name: pack macos specific libraries - name: pack macos specific libraries
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos') if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos')
run: | run: |
cp build/lib/liblldb*.dylib inst/lib cp build/lib/liblldb*.dylib wamr-lldb/lib
working-directory: core/deps/llvm-project working-directory: core/deps/llvm-project
- name: compress the binary - name: compress the binary
run: | run: |
tar czf wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz inst tar czf wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamr-lldb
zip -r wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.zip inst zip -r wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.zip wamr-lldb
working-directory: core/deps/llvm-project working-directory: core/deps/llvm-project
- name: upload release tar.gz - name: upload release tar.gz

View File

@ -41,8 +41,9 @@ jobs:
- name: compress the vscode extension - name: compress the vscode extension
run: | run: |
tar czf wamr_ide-${{ inputs.ver_num }}.tar.gz wamride-*.vsix mv wamride-*.vsix wamr-ide.vsix
zip wamr_ide-${{ inputs.ver_num }}.zip wamride-*.vsix tar czf wamr-ide-${{ inputs.ver_num }}.tar.gz wamr-ide.vsix
zip wamr-ide-${{ inputs.ver_num }}.zip wamr-ide.vsix
working-directory: test-tools/wamr-ide/VSCode-Extension working-directory: test-tools/wamr-ide/VSCode-Extension
- name: upload release tar.gz - name: upload release tar.gz
@ -51,8 +52,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
upload_url: ${{ inputs.upload_url }} upload_url: ${{ inputs.upload_url }}
asset_path: test-tools/wamr-ide/VSCode-Extension/wamr_ide-${{ inputs.ver_num }}.tar.gz asset_path: test-tools/wamr-ide/VSCode-Extension/wamr-ide-${{ inputs.ver_num }}.tar.gz
asset_name: wamr_ide-${{ inputs.ver_num }}.tar.gz asset_name: wamr-ide-${{ inputs.ver_num }}.tar.gz
asset_content_type: application/x-gzip asset_content_type: application/x-gzip
- name: upload release zip - name: upload release zip
@ -61,6 +62,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
upload_url: ${{ inputs.upload_url }} upload_url: ${{ inputs.upload_url }}
asset_path: test-tools/wamr-ide/VSCode-Extension/wamr_ide-${{ inputs.ver_num }}.zip asset_path: test-tools/wamr-ide/VSCode-Extension/wamr-ide-${{ inputs.ver_num }}.zip
asset_name: wamr_ide-${{ inputs.ver_num }}.zip asset_name: wamr-ide-${{ inputs.ver_num }}.zip
asset_content_type: application/zip asset_content_type: application/zip

View File

@ -14,17 +14,17 @@ The WAMR-IDE is an Integrated Development Environment to develop WebAssembly app
## How to setup WAMR IDE ## How to setup WAMR IDE
Note: Please ensure that the scripts under `resource` directories have Now, we have same version tagged docker images, lldb binaries and VS Code installation file(.vsix file) packed for each GitHub release. So if you simply want to use WAMR debugging features in VS Code, the ideal(and effortless) way is following the tutorial in [this section](#21-download-wamr-vs-code-extension-from-the-github-releaserecommended-approach).
execution permission. While on git they have x bits, you might have dropped
them eg. by copying them from Windows.
Similarly, do not drop execution permission when copying `lldb` binaries
under `resource/debug/bin`.
#### 1. Install `VSCode` on host. Alternatively, if you want to build lldb, docker images, or .vsix file locally so that you can try the effect of your modification, you could refer to the tutorial in [this section](#22-build-wamr-vs-code-extension-locallyalternative-approach).
### 1. Preparation
#### 1.1. Install `VSCode` on host
- make sure the version of [vscode](https://code.visualstudio.com/Download) you installed is at least _1.59.0_ - make sure the version of [vscode](https://code.visualstudio.com/Download) you installed is at least _1.59.0_
#### 2. Install `Docker` on host. #### 1.2. Install `Docker` on host
1. [Windows: Docker Desktop](https://docs.docker.com/desktop/windows/install/) 1. [Windows: Docker Desktop](https://docs.docker.com/desktop/windows/install/)
2. [Ubuntu: Docker Engine](https://docs.docker.com/engine/install/ubuntu) 2. [Ubuntu: Docker Engine](https://docs.docker.com/engine/install/ubuntu)
@ -37,11 +37,13 @@ under `resource/debug/bin`.
- Ubuntu Bionic 18.04(LTS) - Ubuntu Bionic 18.04(LTS)
``` ```
#### 3. Load docker images from the release tar file or build docker images on the host ### 2. WAMR VS Code extension: download from the GitHub release or build locally
##### 3.1 Load docker images from the release tar file #### 2.1 Download WAMR VS Code extension from the GitHub release(Recommended approach)
From now on, for each release, we have the same version tagged docker image saved as a tar file, which you can find and download in the release. ##### 2.1.1 Load docker images from the GitHub release tar file
From now on, for each GitHub release, we have the same version tagged docker image saved as a tar file, which you can find and download in the GitHub release.
You could download the tar archive files for docker images from the release, and then load them using the following commands: You could download the tar archive files for docker images from the release, and then load them using the following commands:
@ -68,7 +70,23 @@ docker load --input ./wasm-toolchain.tar
docker load --input ./wasm-debug-server.tar docker load --input ./wasm-debug-server.tar
``` ```
##### 3.2 Build docker images on host ##### 2.1.2 Download the VS Code extension installation file from the GitHub release
From now on, for each GitHub release, we have the same version tagged zip/tar.gz file. For example, in release version 1.1.2, you can easily download and decompress `wamr-ide-1.1.2.tar.gz` `wamr-ide-1.1.2.zip`, which contains `wamr-ide.vsix` VS Code extension installation file. As you can imagine, in the future, when new releases are available, you can freely choose whichever version(for example, 1.2.0, 1.3.0, etc.) you prefer. It should work as long as you download the same version tagged docker image and .vsix file.
##### 2.1.3 Install extension from vsix
![install_from_vsix](./Media/install_from_vsix.png "install wamr-ide from vsix")
select `wamr-ide.vsix` which you have decompressed from `.tar.gz` or `.zip` file.
#### 2.2 Build WAMR VS Code extension locally(Alternative approach)
You could also build the VS Code extension locally, the following instruction provides a thorough tutorial. It's worth noting that in the local build tutorial we use hard-coded tag version 1.0 other than the semantic version of WAMR.
Note: Please ensure that the scripts under `resource` directories have execution permission. While on git they have x bits, you might have dropped them eg. by copying them from Windows. Similarly, do not drop execution permission when copying `lldb` binaries under `resource/debug/bin`.
##### 2.2.1 Build docker images on host
We have 2 docker images which should be built or loaded on your host, `wasm-toolchain` and `wasm-debug-server`. To build these 2 images, please enter the `WASM-Debug-Server/Docker` & `WASM-Toolchain/Docker`, then execute the `build_docker_image` script respectively. We have 2 docker images which should be built or loaded on your host, `wasm-toolchain` and `wasm-debug-server`. To build these 2 images, please enter the `WASM-Debug-Server/Docker` & `WASM-Toolchain/Docker`, then execute the `build_docker_image` script respectively.
@ -90,11 +108,11 @@ $ cd ./WASM-Debug-Server/Docker
$ ./build_docker_image.sh $ ./build_docker_image.sh
``` ```
#### After building, you can find `wasm-toolchain` and `wasm-debug-server` docker images on your local ##### 2.2.2 After building, you can find `wasm-toolchain` and `wasm-debug-server` docker images on your local
![docker-images](./Media/docker_images.png) ![docker-images](./Media/docker_images.png)
#### If building docker images fail during the process ##### 2.2.3 If building docker images fail during the process
Sometimes building the Docker images may fail due to bad network conditions. If the `wasm-toolchain` and `wasm-debug-server` images do not exist after building, please build them manually. Fix the proxy setting if needed and execute the following command to build docker images. Sometimes building the Docker images may fail due to bad network conditions. If the `wasm-toolchain` and `wasm-debug-server` images do not exist after building, please build them manually. Fix the proxy setting if needed and execute the following command to build docker images.
@ -114,15 +132,15 @@ $ docker build --no-cache --build-arg http_proxy=http://proxy.example.com:1234
--build-arg https_proxy=http://proxy.example.com:1234 -t wasm-toolchain:1.0 . --build-arg https_proxy=http://proxy.example.com:1234 -t wasm-toolchain:1.0 .
``` ```
#### If you encounter the problem `failed to solve with frontend dockerfile.v0: failed to create LLB definition`, please config your docker desktop ##### 2.2.4 If you encounter the problem `failed to solve with frontend dockerfile.v0: failed to create LLB definition`, please config your docker desktop
![docker-engine-config](./Media/docker_engine_config.png) ![docker-engine-config](./Media/docker_engine_config.png)
#### Points To Remember ##### 2.2.5 Points To Remember
- Make sure that the `wasm-toolchain:1.0` and `wasm-debug-server:1.0` docker images are both successfully built before using `WAMR IDE`, otherwise `Build`, `Run` and `Debug` will not work. - Make sure that the `wasm-toolchain:1.0` and `wasm-debug-server:1.0` docker images are both successfully built before using `WAMR IDE`, otherwise `Build`, `Run` and `Debug` will not work.
#### 4. Generate wamride extension package file ##### 2.2.6 Generate wamride extension package file
`wamride-1.0.0.vsix` can be packaged by [`npm vsce`](https://code.visualstudio.com/api/working-with-extensions/publishing-extension). `wamride-1.0.0.vsix` can be packaged by [`npm vsce`](https://code.visualstudio.com/api/working-with-extensions/publishing-extension).
@ -134,14 +152,29 @@ $ npm install
$ vsce package $ vsce package
``` ```
Note that patched `lldb` should be built and put into the `VSCode-Extension/resource/debug` folder before your package or extension debug process if you want to enable `source debugging` feature. ##### 2.2.7 Enable VS Code debugging feature
Please follow this [instruction](../../doc/source_debugging.md#debugging-with-interpreter) to build `lldb`.
Please follow this [instruction](./VSCode-Extension/resource/debug/README.md) By default, when you build .vsix locally, the debugging feature is off. Suppose you want to enable the source debugging feature. In that case, you could download `lldb` binaries from our GitHub release (for example, `wamr-lldb-1.1.2-x86_64-ubuntu-20.04.tar.gz`), decompress and put every subdirectory and file to the installed directory of your VS Code extension.
to copy the binaries.
For example, let's say you are on an Ubuntu 20.04 machine. You first download and decompress `wamr-lldb-1.1.2-x86_64-ubuntu-20.04.tar.gz`, and you will get a `wamr-lldb` folder (or `inst` folder in our earlier release). Then, you can simply copy the files and directory inside that folder to the relative path `resource/debug/linux/` under your VS Code extension installation directory.
Example commands on an Ubuntu 20.04 machine:
```shell
# decompress .tar.gz file and get the folder
$ ls wamr-lldb
bin lib package.json syntaxes
# copy everything to the vscode extension installation path(in this case, it's /home/{usrname}/.vscode-server/extensions/wamr.wamride-1.0.0/)
$ cp inst/* /home/{usrname}/.vscode-server/extensions/wamr.wamride-1.0.0/resource/debug/linux/
```
If you want to use your own patched `lldb`, you could follow this [instruction](../../doc/source_debugging.md#debugging-with-interpreter) to build `lldb`. And follow this [instruction](./VSCode-Extension/resource/debug/README.md)
to copy the binaries to replace the existing ones.
> **You can also debug the extension directly follow this [instruction](./VSCode-Extension/README.md) without packing the extension.** > **You can also debug the extension directly follow this [instruction](./VSCode-Extension/README.md) without packing the extension.**
#### 5. Install extension from vsix ##### 2.2.7 Install extension from vsix
![install_from_vsix](./Media/install_from_vsix.png "install wamr-ide from vsix") ![install_from_vsix](./Media/install_from_vsix.png "install wamr-ide from vsix")
@ -215,7 +248,7 @@ Click `Change workspace` button, a dialog will show as following. You can select
![right click menus](./Media/right_click_menus_2.png "right click menus") ![right click menus](./Media/right_click_menus_2.png "right click menus")
#### After setting up `include path` and `exclude files`, the corresponding folder and files will be decorated with color and icon as following picture shows. #### After setting up `include path` and `exclude files`, the corresponding folder and files will be decorated with color and icon as following picture shows
![decoration for files](./Media/decoration_for_files.png "decoration for files") ![decoration for files](./Media/decoration_for_files.png "decoration for files")

View File

@ -6,10 +6,13 @@
> Note that when you download and > Note that when you download and
> decompress to get .vsix file from [our release](https://github.com/bytecodealliance/wasm-micro-runtime/releases). > decompress to get .vsix file from [our release](https://github.com/bytecodealliance/wasm-micro-runtime/releases).
> It's by default that the `source debugging` feature is not enabled. > It's by default that the `source debugging` feature is not enabled.
> If you want to enable `source debugging` feature of this extension, > If you want to enable the `source debugging` feature of this extension,
> you could either download `lldb` from [our release](https://github.com/bytecodealliance/wasm-micro-runtime/releases) and put them in correct path > you could download `lldb` from [our release](https://github.com/bytecodealliance/wasm-micro-runtime/releases)
mentioned in this [instruction](./resource/debug/README.md) (This is recommended way), > (This is the recommended way, and you could do it with a single click in VS Code).
> or you could build `lldb` yourself follow this [instruction](./resource/debug/README.md) > Then if you want to use your customized lldb patch,
> you could build your own version of `lldb`
> and then follow this [instruction](./resource/debug/README.md)
> to put them in the correct path
### 1. open `VSCode_Extension` directory with the `vscode` ### 1. open `VSCode_Extension` directory with the `vscode`

View File

@ -1,13 +1,15 @@
### If you want to enable `source debugging` for this extension, please build `lldb` firstly following this [instruction](../../../../../doc/source_debugging.md#debugging-with-interpreter). ### If you want to enable `source debugging` for this extension and use your own patched `lldb`, please build `lldb` firstly following this [instruction](../../../../../doc/source_debugging.md#debugging-with-interpreter)
### After building(`linux` for example), create `bin` folder and `lib` folder respectively in `linux` directory, add following necessary target files into the folders. ### After building(`linux` for example), create `bin` folder and `lib` folder respectively in `linux` directory, add following necessary target files into the folders
```shell ```shell
/llvm/build-lldb/bin/lldb # move this file to resource/debug/linux/bin/ /llvm/build-lldb/bin/lldb # move this file to {VS Code directory}/resource/debug/linux/bin/
/llvm/build-lldb/bin/lldb-vscode # move this file to resource/debug/linux/bin/ /llvm/build-lldb/bin/lldb-vscode # move this file to {VS Code directory}/resource/debug/linux/bin/
/llvm/build-lldb/lib/liblldb.so.13 # move this file to resource/debug/linux/lib/ /llvm/build-lldb/lib/liblldb.so.13 # move this file to {VS Code directory}/resource/debug/linux/lib/
``` ```
> If you are debugging this extension following this [tutorial](../../README.md), {VS Code directory} will be `{WAMR root directory}/test-tools/wamr-ide/VSCode-Extension`. If you want to replace the current lldb with your own patched version so that you can use your patched lldb in VS Code, {VS Code directory} will be `~/.vscode/extensions/wamr.wamride-1.1.2` or `~/.vscode-server/extensions/wamr.wamride-1.1.2`.
Note: For macOS, the library is named like `liblldb.13.0.1.dylib`. Note: For macOS, the library is named like `liblldb.13.0.1.dylib`.
### Then you can start the extension and run the execute source debugging by clicking the `debug` button in the extension panel. ### Then you can start the extension and run the execute source debugging by clicking the `debug` button in the extension panel.

View File

@ -27,7 +27,7 @@ const WAMR_LLDB_NOT_SUPPORTED_ERROR = new Error(
function getLLDBUnzipFilePath(destinationFolder: string, filename: string) { function getLLDBUnzipFilePath(destinationFolder: string, filename: string) {
const dirs = filename.split('/'); const dirs = filename.split('/');
if (dirs[0] === 'inst') { if (dirs[0] === 'wamr-lldb') {
dirs.shift(); dirs.shift();
} }