Skip to content

Commit 6fd8001

Browse files
Update CIs and documents to make naming of generated binaries consistent (#1823)
1 parent d04f398 commit 6fd8001

6 files changed

Lines changed: 97 additions & 58 deletions

File tree

.github/workflows/build_wamr_lldb.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
./core/deps/llvm-project/build/libexec
5151
./core/deps/llvm-project/build/share
5252
./core/deps/llvm-project/lldb/tools/
53-
./core/deps/llvm-project/inst/
53+
./core/deps/llvm-project/wamr-lldb/
5454
key: ${{inputs.arch}}-${{ inputs.runner }}-lldb_build
5555

5656
- name: setup xcode macos
@@ -92,10 +92,10 @@ jobs:
9292
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'ubuntu')
9393
run: |
9494
echo "start to build lldb..."
95-
mkdir -p inst
95+
mkdir -p wamr-lldb
9696
cmake -S ./llvm -B build \
9797
-G Ninja \
98-
-DCMAKE_INSTALL_PREFIX=../inst \
98+
-DCMAKE_INSTALL_PREFIX=../wamr-lldb \
9999
-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lldb" \
100100
-DLLVM_TARGETS_TO_BUILD=X86 \
101101
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DLLVM_BUILD_BENCHMARKS:BOOL=OFF \
@@ -111,10 +111,10 @@ jobs:
111111
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos')
112112
run: |
113113
echo "start to build lldb..."
114-
mkdir -p inst
114+
mkdir -p wamr-lldb
115115
cmake -S ./llvm -B build \
116116
-G Ninja \
117-
-DCMAKE_INSTALL_PREFIX=../inst \
117+
-DCMAKE_INSTALL_PREFIX=../wamr-lldb \
118118
-DCMAKE_BUILD_TYPE:STRING="Release" \
119119
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
120120
-DLLVM_ENABLE_PROJECTS="clang;lldb" \
@@ -134,30 +134,30 @@ jobs:
134134
- name: pack a distribution
135135
if: steps.lldb_build_cache.outputs.cache-hit != 'true'
136136
run: |
137-
mkdir -p inst/bin
138-
mkdir -p inst/lib
139-
cp build/bin/lldb* inst/bin
140-
cp lldb/tools/lldb-vscode/package.json inst
141-
cp -r lldb/tools/lldb-vscode/syntaxes/ inst
137+
mkdir -p wamr-lldb/bin
138+
mkdir -p wamr-lldb/lib
139+
cp build/bin/lldb* wamr-lldb/bin
140+
cp lldb/tools/lldb-vscode/package.json wamr-lldb
141+
cp -r lldb/tools/lldb-vscode/syntaxes/ wamr-lldb
142142
working-directory: core/deps/llvm-project
143143

144144
- name: pack ubuntu specific libraries
145145
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'ubuntu')
146146
run: |
147-
cp build/lib/liblldb*.so inst/lib
148-
cp build/lib/liblldb*.so.* inst/lib
147+
cp build/lib/liblldb*.so wamr-lldb/lib
148+
cp build/lib/liblldb*.so.* wamr-lldb/lib
149149
working-directory: core/deps/llvm-project
150150

151151
- name: pack macos specific libraries
152152
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos')
153153
run: |
154-
cp build/lib/liblldb*.dylib inst/lib
154+
cp build/lib/liblldb*.dylib wamr-lldb/lib
155155
working-directory: core/deps/llvm-project
156156

157157
- name: compress the binary
158158
run: |
159-
tar czf wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz inst
160-
zip -r wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.zip inst
159+
tar czf wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamr-lldb
160+
zip -r wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.zip wamr-lldb
161161
working-directory: core/deps/llvm-project
162162

163163
- name: upload release tar.gz

.github/workflows/build_wamr_vscode_ext.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ jobs:
4141

4242
- name: compress the vscode extension
4343
run: |
44-
tar czf wamr_ide-${{ inputs.ver_num }}.tar.gz wamride-*.vsix
45-
zip wamr_ide-${{ inputs.ver_num }}.zip wamride-*.vsix
44+
mv wamride-*.vsix wamr-ide.vsix
45+
tar czf wamr-ide-${{ inputs.ver_num }}.tar.gz wamr-ide.vsix
46+
zip wamr-ide-${{ inputs.ver_num }}.zip wamr-ide.vsix
4647
working-directory: test-tools/wamr-ide/VSCode-Extension
4748

4849
- name: upload release tar.gz
@@ -51,8 +52,8 @@ jobs:
5152
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5253
with:
5354
upload_url: ${{ inputs.upload_url }}
54-
asset_path: test-tools/wamr-ide/VSCode-Extension/wamr_ide-${{ inputs.ver_num }}.tar.gz
55-
asset_name: wamr_ide-${{ inputs.ver_num }}.tar.gz
55+
asset_path: test-tools/wamr-ide/VSCode-Extension/wamr-ide-${{ inputs.ver_num }}.tar.gz
56+
asset_name: wamr-ide-${{ inputs.ver_num }}.tar.gz
5657
asset_content_type: application/x-gzip
5758

5859
- name: upload release zip
@@ -61,6 +62,6 @@ jobs:
6162
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6263
with:
6364
upload_url: ${{ inputs.upload_url }}
64-
asset_path: test-tools/wamr-ide/VSCode-Extension/wamr_ide-${{ inputs.ver_num }}.zip
65-
asset_name: wamr_ide-${{ inputs.ver_num }}.zip
65+
asset_path: test-tools/wamr-ide/VSCode-Extension/wamr-ide-${{ inputs.ver_num }}.zip
66+
asset_name: wamr-ide-${{ inputs.ver_num }}.zip
6667
asset_content_type: application/zip

test-tools/wamr-ide/README.md

Lines changed: 55 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ The WAMR-IDE is an Integrated Development Environment to develop WebAssembly app
1414

1515
## How to setup WAMR IDE
1616

17-
Note: Please ensure that the scripts under `resource` directories have
18-
execution permission. While on git they have x bits, you might have dropped
19-
them eg. by copying them from Windows.
20-
Similarly, do not drop execution permission when copying `lldb` binaries
21-
under `resource/debug/bin`.
17+
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).
2218

23-
#### 1. Install `VSCode` on host.
19+
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).
20+
21+
### 1. Preparation
22+
23+
#### 1.1. Install `VSCode` on host
2424

2525
- make sure the version of [vscode](https://code.visualstudio.com/Download) you installed is at least _1.59.0_
2626

27-
#### 2. Install `Docker` on host.
27+
#### 1.2. Install `Docker` on host
2828

2929
1. [Windows: Docker Desktop](https://docs.docker.com/desktop/windows/install/)
3030
2. [Ubuntu: Docker Engine](https://docs.docker.com/engine/install/ubuntu)
@@ -37,11 +37,13 @@ under `resource/debug/bin`.
3737
- Ubuntu Bionic 18.04(LTS)
3838
```
3939

40-
#### 3. Load docker images from the release tar file or build docker images on the host
40+
### 2. WAMR VS Code extension: download from the GitHub release or build locally
41+
42+
#### 2.1 Download WAMR VS Code extension from the GitHub release(Recommended approach)
4143

42-
##### 3.1 Load docker images from the release tar file
44+
##### 2.1.1 Load docker images from the GitHub release tar file
4345

44-
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.
46+
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.
4547

4648
You could download the tar archive files for docker images from the release, and then load them using the following commands:
4749

@@ -68,7 +70,23 @@ docker load --input ./wasm-toolchain.tar
6870
docker load --input ./wasm-debug-server.tar
6971
```
7072

71-
##### 3.2 Build docker images on host
73+
##### 2.1.2 Download the VS Code extension installation file from the GitHub release
74+
75+
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.
76+
77+
##### 2.1.3 Install extension from vsix
78+
79+
![install_from_vsix](./Media/install_from_vsix.png "install wamr-ide from vsix")
80+
81+
select `wamr-ide.vsix` which you have decompressed from `.tar.gz` or `.zip` file.
82+
83+
#### 2.2 Build WAMR VS Code extension locally(Alternative approach)
84+
85+
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.
86+
87+
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`.
88+
89+
##### 2.2.1 Build docker images on host
7290

7391
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.
7492

@@ -90,11 +108,11 @@ $ cd ./WASM-Debug-Server/Docker
90108
$ ./build_docker_image.sh
91109
```
92110

93-
#### After building, you can find `wasm-toolchain` and `wasm-debug-server` docker images on your local
111+
##### 2.2.2 After building, you can find `wasm-toolchain` and `wasm-debug-server` docker images on your local
94112

95113
![docker-images](./Media/docker_images.png)
96114

97-
#### If building docker images fail during the process
115+
##### 2.2.3 If building docker images fail during the process
98116

99117
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.
100118

@@ -114,15 +132,15 @@ $ docker build --no-cache --build-arg http_proxy=http://proxy.example.com:1234
114132
--build-arg https_proxy=http://proxy.example.com:1234 -t wasm-toolchain:1.0 .
115133
```
116134

117-
#### If you encounter the problem `failed to solve with frontend dockerfile.v0: failed to create LLB definition`, please config your docker desktop
135+
##### 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
118136

119137
![docker-engine-config](./Media/docker_engine_config.png)
120138

121-
#### Points To Remember
139+
##### 2.2.5 Points To Remember
122140

123141
- 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.
124142

125-
#### 4. Generate wamride extension package file
143+
##### 2.2.6 Generate wamride extension package file
126144

127145
`wamride-1.0.0.vsix` can be packaged by [`npm vsce`](https://code.visualstudio.com/api/working-with-extensions/publishing-extension).
128146

@@ -134,14 +152,29 @@ $ npm install
134152
$ vsce package
135153
```
136154

137-
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.
138-
Please follow this [instruction](../../doc/source_debugging.md#debugging-with-interpreter) to build `lldb`.
139-
Please follow this [instruction](./VSCode-Extension/resource/debug/README.md)
140-
to copy the binaries.
155+
##### 2.2.7 Enable VS Code debugging feature
156+
157+
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.
158+
159+
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.
160+
161+
Example commands on an Ubuntu 20.04 machine:
162+
163+
```shell
164+
# decompress .tar.gz file and get the folder
165+
$ ls wamr-lldb
166+
bin lib package.json syntaxes
167+
# copy everything to the vscode extension installation path(in this case, it's /home/{usrname}/.vscode-server/extensions/wamr.wamride-1.0.0/)
168+
$ cp inst/* /home/{usrname}/.vscode-server/extensions/wamr.wamride-1.0.0/resource/debug/linux/
169+
```
170+
171+
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)
172+
to copy the binaries to replace the existing ones.
173+
141174

142175
> **You can also debug the extension directly follow this [instruction](./VSCode-Extension/README.md) without packing the extension.**
143176
144-
#### 5. Install extension from vsix
177+
##### 2.2.7 Install extension from vsix
145178

146179
![install_from_vsix](./Media/install_from_vsix.png "install wamr-ide from vsix")
147180

@@ -215,7 +248,7 @@ Click `Change workspace` button, a dialog will show as following. You can select
215248

216249
![right click menus](./Media/right_click_menus_2.png "right click menus")
217250

218-
#### After setting up `include path` and `exclude files`, the corresponding folder and files will be decorated with color and icon as following picture shows.
251+
#### After setting up `include path` and `exclude files`, the corresponding folder and files will be decorated with color and icon as following picture shows
219252

220253
![decoration for files](./Media/decoration_for_files.png "decoration for files")
221254

test-tools/wamr-ide/VSCode-Extension/README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
### An integrated development environment for WASM.
44

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

test-tools/wamr-ide/VSCode-Extension/resource/debug/README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
### If you want to enable `source debugging` for this extension, please build `lldb` firstly following this [instruction](../../../../../doc/source_debugging.md#debugging-with-interpreter).
1+
### 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)
22

3-
### After building(`linux` for example), create `bin` folder and `lib` folder respectively in `linux` directory, add following necessary target files into the folders.
3+
### After building(`linux` for example), create `bin` folder and `lib` folder respectively in `linux` directory, add following necessary target files into the folders
44

5-
```shell
6-
/llvm/build-lldb/bin/lldb # move this file to resource/debug/linux/bin/
7-
/llvm/build-lldb/bin/lldb-vscode # move this file to resource/debug/linux/bin/
8-
/llvm/build-lldb/lib/liblldb.so.13 # move this file to resource/debug/linux/lib/
9-
```
5+
```shell
6+
/llvm/build-lldb/bin/lldb # move this file to {VS Code directory}/resource/debug/linux/bin/
7+
/llvm/build-lldb/bin/lldb-vscode # move this file to {VS Code directory}/resource/debug/linux/bin/
8+
/llvm/build-lldb/lib/liblldb.so.13 # move this file to {VS Code directory}/resource/debug/linux/lib/
9+
```
10+
11+
> 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`.
1012
1113
Note: For macOS, the library is named like `liblldb.13.0.1.dylib`.
1214

test-tools/wamr-ide/VSCode-Extension/src/utilities/lldbUtilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const WAMR_LLDB_NOT_SUPPORTED_ERROR = new Error(
2727

2828
function getLLDBUnzipFilePath(destinationFolder: string, filename: string) {
2929
const dirs = filename.split('/');
30-
if (dirs[0] === 'inst') {
30+
if (dirs[0] === 'wamr-lldb') {
3131
dirs.shift();
3232
}
3333

0 commit comments

Comments
 (0)