summaryrefslogtreecommitdiffstats
path: root/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide
diff options
context:
space:
mode:
Diffstat (limited to 'src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide')
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/.gitattributes2
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/Config_building_target.pngbin0 -> 12887 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/build_folder.pngbin0 -> 14087 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/build_terminal.pngbin0 -> 162976 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/change_workspace_dialog.pngbin0 -> 9410 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/compilation_config.pngbin0 -> 36218 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/compilation_config_2.pngbin0 -> 22681 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/debug.pngbin0 -> 78021 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/decoration_for_files.pngbin0 -> 3348 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/docker_config.jpgbin0 -> 63049 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/docker_engine_config.pngbin0 -> 85397 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/docker_images.pngbin0 -> 15172 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/install_from_vsix.pngbin0 -> 53293 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/new_project_page.pngbin0 -> 7630 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/open_project_page.pngbin0 -> 2239 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/project_template.pngbin0 -> 8564 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/right_click_menus_1.pngbin0 -> 30639 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/right_click_menus_2.pngbin0 -> 32933 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/run.pngbin0 -> 22293 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/save_configuration.pngbin0 -> 3618 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/set_up_workspace_message.pngbin0 -> 4629 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/wamr_ide_main_menu.pngbin0 -> 29110 bytes
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/README.md303
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Script/build.bat41
-rwxr-xr-xsrc/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Script/build.sh46
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.eslintrc.json19
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.gitignore7
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.prettierrc.json12
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.vscode/extensions.json5
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.vscode/launch.json15
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.vscode/tasks.json20
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.vscodeignore11
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/CONTRIBUTING.md34
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/LICENSE219
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/README.md40
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/package.json258
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/debug/README.md15
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/debug/darwin/.placeholder0
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/debug/linux/.placeholder0
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/debug/windows/.placeholder0
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/CMakeLists.txt32
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/boot_debugger_server.bat10
-rwxr-xr-xsrc/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/boot_debugger_server.sh12
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/build.bat11
-rwxr-xr-xsrc/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/build.sh12
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/destroy.bat36
-rwxr-xr-xsrc/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/destroy.sh34
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/project.cmake17
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/run.bat9
-rwxr-xr-xsrc/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/run.sh11
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/assert.h17
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/ctype.h38
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/errno.h17
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/fcntl.h17
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/inttypes.h19
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/limits.h34
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/pthread.h91
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/stdarg.h27
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/stdbool.h19
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/stdint.h50
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/stdio.h34
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/stdlib.h34
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/string.h52
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/strings.h17
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/webview/css/style.css70
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/webview/js/configbuildtarget.js27
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/webview/js/newproj.js37
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/webview/page/configBuildTarget.html63
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/webview/page/newProject.html55
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/constants.ts7
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/debugConfigurationProvider.ts42
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/decorationProvider.ts81
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/extension.ts1027
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/taskProvider.ts228
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/utilities/directoryUtilities.ts211
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/utilities/dockerUtilities.ts125
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/utilities/getUri.ts14
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/utilities/lldbUtilities.ts119
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/view/NewProjectPanel.ts260
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/view/TargetConfigPanel.ts238
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/tsconfig.json16
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/Dockerfile30
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/README.md20
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/build_docker_image.bat8
-rwxr-xr-xsrc/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/build_docker_image.sh9
-rwxr-xr-xsrc/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/resource/debug.sh6
-rwxr-xr-xsrc/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/resource/run.sh6
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/.dockerignore4
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/Dockerfile71
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/README.md18
-rw-r--r--src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/build_docker_image.bat9
-rwxr-xr-xsrc/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/build_docker_image.sh9
-rwxr-xr-xsrc/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/resource/build_wasm.sh25
-rwxr-xr-xsrc/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/resource/wamr_toolchain.cmake33
94 files changed, 4565 insertions, 0 deletions
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/.gitattributes b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/.gitattributes
new file mode 100644
index 000000000..dcd444fbe
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/.gitattributes
@@ -0,0 +1,2 @@
+# Convert to LF line endings on checkout.
+*.sh text eol=lf \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/Config_building_target.png b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/Config_building_target.png
new file mode 100644
index 000000000..a1270007f
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/Config_building_target.png
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/build_folder.png b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/build_folder.png
new file mode 100644
index 000000000..0ca05ff16
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/build_folder.png
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/build_terminal.png b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/build_terminal.png
new file mode 100644
index 000000000..24fe26eeb
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/build_terminal.png
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/change_workspace_dialog.png b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/change_workspace_dialog.png
new file mode 100644
index 000000000..9f6a61428
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/change_workspace_dialog.png
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/compilation_config.png b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/compilation_config.png
new file mode 100644
index 000000000..43c60a21f
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/compilation_config.png
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/compilation_config_2.png b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/compilation_config_2.png
new file mode 100644
index 000000000..c16bb09ec
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/compilation_config_2.png
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/debug.png b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/debug.png
new file mode 100644
index 000000000..1d8636da7
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/debug.png
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/decoration_for_files.png b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/decoration_for_files.png
new file mode 100644
index 000000000..dd5c0bd74
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/decoration_for_files.png
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/docker_config.jpg b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/docker_config.jpg
new file mode 100644
index 000000000..50cea7192
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/docker_config.jpg
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/docker_engine_config.png b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/docker_engine_config.png
new file mode 100644
index 000000000..c3757075e
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/docker_engine_config.png
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/docker_images.png b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/docker_images.png
new file mode 100644
index 000000000..67d38e714
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/docker_images.png
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/install_from_vsix.png b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/install_from_vsix.png
new file mode 100644
index 000000000..f313ec590
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/install_from_vsix.png
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/new_project_page.png b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/new_project_page.png
new file mode 100644
index 000000000..b498aca4b
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/new_project_page.png
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/open_project_page.png b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/open_project_page.png
new file mode 100644
index 000000000..d4e534307
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/open_project_page.png
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/project_template.png b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/project_template.png
new file mode 100644
index 000000000..e10b102ec
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/project_template.png
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/right_click_menus_1.png b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/right_click_menus_1.png
new file mode 100644
index 000000000..0649f2f49
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/right_click_menus_1.png
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/right_click_menus_2.png b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/right_click_menus_2.png
new file mode 100644
index 000000000..9d8e32216
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/right_click_menus_2.png
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/run.png b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/run.png
new file mode 100644
index 000000000..0213dcab3
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/run.png
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/save_configuration.png b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/save_configuration.png
new file mode 100644
index 000000000..39a5c1c4a
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/save_configuration.png
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/set_up_workspace_message.png b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/set_up_workspace_message.png
new file mode 100644
index 000000000..c812a59a4
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/set_up_workspace_message.png
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/wamr_ide_main_menu.png b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/wamr_ide_main_menu.png
new file mode 100644
index 000000000..89c56fa92
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Media/wamr_ide_main_menu.png
Binary files differ
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/README.md b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/README.md
new file mode 100644
index 000000000..8a6e1509f
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/README.md
@@ -0,0 +1,303 @@
+# WAMR-IDE (Experimental)
+
+## Introduction
+
+The WAMR-IDE is an Integrated Development Environment to develop WebAssembly application with coding, compiling and source debugging support. It contains 3 components: `VSCode extension`, `wasm-toolchain docker image` and `wasm-debug-server docker image`.
+
+- `VSCode extension` is an `vscode` extension, with which user can build and manage projects, develop `wasm application`, including `building`, `running` and `debugging`.
+
+- `WASM-toolchain` is a docker image which provides building environment for wasm.
+
+- `WASM source debug server` is a docker image which provides running and source debugging environment for wasm application.
+
+---
+
+## How to setup WAMR IDE
+
+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).
+
+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_
+
+#### 1.2. Install `Docker` on host
+
+ 1. [Windows: Docker Desktop](https://docs.docker.com/desktop/windows/install/)
+ 2. [Ubuntu: Docker Engine](https://docs.docker.com/engine/install/ubuntu)
+ ```xml
+ OS requirements:
+ To install Docker Engine, you need the 64-bit version of one of these Ubuntu versions:
+ - Ubuntu Impish 21.10
+ - Ubuntu Hirsute 21.04
+ - Ubuntu Focal 20.04(LTS)
+ - Ubuntu Bionic 18.04(LTS)
+ ```
+
+### 2. WAMR VS Code extension: download from the GitHub release or build locally
+
+#### 2.1 Download WAMR VS Code extension from the GitHub release(Recommended approach)
+
+##### 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:
+
+```sh
+# download the zip or tar.gz from release depending on your platform
+# decompress and get the tar file
+
+# on Linux/MacOS, you could use tar
+tar xf wasm-toolchain-{version number}.tar.gz
+tar xf wasm-debug-server-{version number}.tar.gz
+# or you could use unzip
+unzip wasm-toolchain-{version number}.zip
+unzip wasm-debug-server-{version number}.zip
+# load wasm-toolchain
+docker load --input wasm-toolchain.tar
+# load wasm-debug-server
+docker load --input wasm-debug-server.tar
+
+# on Windows, you could use any unzip software you like
+# then loading docker images using powershell or git bash
+# load wasm-toolchain
+docker load --input ./wasm-toolchain.tar
+# load wasm-debug-server
+docker load --input ./wasm-debug-server.tar
+```
+
+##### 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.
+
+Windows (powershell):
+
+```batch
+$ cd .\WASM-Toolchain\Docker
+$ .\build_docker_image.bat
+$ cd .\WASM-Debug-Server\Docker
+$ .\build_docker_image.bat
+```
+
+Linux:
+
+```shell
+$ cd ./WASM-Toolchain/Docker
+$ ./build_docker_image.sh
+$ cd ./WASM-Debug-Server/Docker
+$ ./build_docker_image.sh
+```
+
+##### 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)
+
+##### 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.
+
+![docker-engine-config](./Media/docker_config.jpg)
+
+> Note: please correctly replace example proxy address with your own before you run manually.
+
+```xml
+$ cd .\docker_images\wasm-debug-server
+$ docker build --no-cache --build-arg http_proxy=http://proxy.example.com:1234
+--build-arg https_proxy=http://proxy.example.com:1234 -t wasm-debug-server:1.0 .
+```
+
+```xml
+$ cd .\docker_images\wasm-toolchain
+$ 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 .
+```
+
+##### 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)
+
+##### 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.
+
+##### 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).
+
+```shell
+$ npm install -g vsce
+$ cd VSCode-Extension
+$ rm -rf node_modules
+$ npm install
+$ vsce package
+```
+
+##### 2.2.7 Enable VS Code debugging feature
+
+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.
+
+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.**
+
+##### 2.2.7 Install extension from vsix
+
+![install_from_vsix](./Media/install_from_vsix.png "install wamr-ide from vsix")
+
+select `wamride-1.0.0.vsix` which you have packed on your host.
+
+---
+
+## How to use `wamr-ide`
+
+#### `WAMR-IDE` extension contains 2 components as following picture showing. `WAMR IDE` for workspace and project management and `Current Project` for project's execution.
+
+![wamr_ide_main_menu](./Media/wamr_ide_main_menu.png "wamr-ide main menu")
+
+### Project Execution
+
+#### 1. New project
+
+When you click `New project` button, the extension will pop up a message box at the bottom right of the screen as following:
+
+![set-up-workspace-message](./Media/set_up_workspace_message.png "set up workspace message box")
+
+You can click `Set up now` and select the target folder to create project workspace, or you click `Maybe later` to close the message box.
+
+> Note that your selected workspace folder should be **empty** or the folder you have set up as workspace.
+
+After setting up workspace, extension will prompt successful message:
+
+```xml
+Workspace has been set up successfully!
+```
+
+Then click `New project` button again, a new page will show as following.
+
+![new-project-page](./Media/new_project_page.png "new project page")
+
+Enter the `Project name` and select the `Template`, then click `Create` button. A new project will be generated and opened in your current `VS Code window` or in a new `VS Code window`.
+
+> Opening in current windows or a new one depends on whether your `vscode's explorer` is empty or not. If empty, open in current window, or open in the new vscode window.
+
+A new initialized project is as following picture shows.
+
+![project-template](./Media/project_template.png "default project template")
+
+`.wamr` is the project configuration folder which contains 3 files, `CMakeLists.txt`, `project.cmake`, and `compilation_config.json`. `CMakeLists.txt` is used to build `wasm target` and the `project.cmake` is included in `CMakeLists.txt`. `compilation_config.json` includes the user's customized configuration such as folders which should be added in the include path.
+
+#### 2. Open project
+
+Click `Open project` button, `quick-pick-box` will show as following. All projects under your current workspace will be shown and can be selected.
+
+![configuration file](./Media/open_project_page.png "configuration file")
+
+#### 3. Change workspace
+
+Click `Change workspace` button, a dialog will show as following. You can select 1 folder in file system as workspace, and the new workspace path will override previous workspace, and all new created projects will be generated in the new workspace.
+
+![change workspace ](./Media/change_workspace_dialog.png "change workspace dialog")
+
+#### 4. Customize `include paths` and `exclude source files`
+
+ Extension supports adding header file folder to `include path` and excluding source file from build.
+
+- `Add to include path`
+
+ - Move the cursor to the `folder` and right click, then `menus` will be shown as following. Click `Toggle state of path including`.
+
+ ![right click menus](./Media/right_click_menus_1.png "right click menus")
+
+- `Exclude source file from build`
+
+ - Move the cursor to the `source file` and right click, then `menus` will be shown as following. Click `Toggle state of excluding`.
+
+ ![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
+
+ ![decoration for files](./Media/decoration_for_files.png "decoration for files")
+
+ At the same time, all added `include path` and `exclude files` will be saved in `.wamr/compilation_config.json` as json array.
+
+ ![compilation config](./Media/compilation_config_2.png "compilation config")
+
+> `Toggle state of path including` just shows when selecting `folder` and hides with other resources.
+>
+> `Toggle state of excluding` just shows when selecting `[.c | .cpp | .cxx] source files` and hides with other resources.
+
+### Current Project Management
+
+#### 1. Configuration
+
+Click `Configuration` button, a new page will be shown as following. You can config building target with `Include paths`, `Initial & Max linear memory`, `stack size`, `exported_symbols` and `include paths`, `exclude files`.
+
+![config building target](./Media/Config_building_target.png "config building target")
+
+Then click `Modify` button to confirm, if configurations are modified successfully and following message will pop. Click `OK`, the page will be auto closed.
+
+![save configuration](./Media/save_configuration.png "save configuration")
+
+And all configuration will be saved in `.wamr/compilation_config.json`.
+
+![configuration file](./Media/compilation_config.png "configuration file")
+
+#### 2. `Build`
+
+When you have completed coding and ready to build target, click `build` button and the `wasm-toolchain` will auto start a container and execute the building process.
+
+![build terminal output](./Media/build_terminal.png "build terminal output")
+
+After successful building execution, `build` folder will be generated in `explorer`, in which `${output_file_name}.wasm` is exist.
+
+![build folder](./Media/build_folder.png "build folder")
+
+> Note that to start `docker service` firstly.
+
+#### 3. Run
+
+Click `Run` button and `wasm-debug-server` docker image will auto start a container and execute the running process.
+
+![run](./Media/run.png "run wasm")
+
+#### 4. Debug
+
+Click `Debug` button will trigger start ip `wamr-debug-server` docker image, and boot up `lldb debug server` inside of iwasm. Then start a debugging session with configuration to connect. Tap `F11` or click `step into` to start debugging.
+
+![debug](./Media/debug.png "source debugging")
+
+> Docker containers will be auto stopped and removed after the execution.
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Script/build.bat b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Script/build.bat
new file mode 100644
index 000000000..5274dad46
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Script/build.bat
@@ -0,0 +1,41 @@
+@REM Copyright (C) 2019 Intel Corporation. All rights reserved.
+@REM SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+@echo off
+set DIR_ROOT=%cd%\..
+
+echo "=== Verify the vscode status ==="
+call code --version
+IF %ERRORLEVEL%==0 (
+ echo "vscode is ready."
+) ELSE (
+ echo "VSCode is not installed, please install firstly."
+ exit /b 1
+)
+
+echo "=== Verify the docker status ==="
+call docker --version
+IF %ERRORLEVEL%==0 (
+ echo "docker is ready."
+) ELSE (
+ echo "Docker is not installed, please install firstly."
+ exit /b 1
+)
+
+cd %DIR_ROOT%\WASM-Debug-Server\Docker
+call docker build -t wasm-debug-server:1.0 .
+IF %ERRORLEVEL%==0 (
+ echo "wasm-debug-server image is ready."
+) ELSE (
+ echo "build wasm-debug-server image failed."
+ exit /b 1
+)
+
+cd %DIR_ROOT%\WASM-Toolchain\Docker
+call docker build -t wasm-toolchain:1.0 .
+IF %ERRORLEVEL%==0 (
+ echo "wasm-toolchain image is ready."
+) ELSE (
+ echo "build wasm-toolchain image failed."
+ exit /b 1
+) \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Script/build.sh b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Script/build.sh
new file mode 100755
index 000000000..c30cb5af2
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/Script/build.sh
@@ -0,0 +1,46 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+#!/bin/bash
+
+# 1. verify the environment: vscode & docker
+# 1.1 if docker is installed, config docker command execution without sudo, promp if not installed and exit.
+# 1.2 if vscode is not installed, promp and exit.
+# 2. build wasm-toolchain & wasm-debug-server docker image
+
+DIR_ROOT=$(pwd)/..
+
+echo "=== Verify the vscode status ==="
+if [ "$(code --version)" ]; then
+ echo "VSCode is ready."
+else
+ echo "VSCode is not installed, please install firstly."
+ exit 1
+fi
+
+echo "=== Verify the docker status ==="
+if [ "$(docker --version)" ]; then
+ echo "Docker is ready."
+else
+ echo "Docker is not installed, please install firstly."
+ exit 1
+fi
+
+# setup docker command exectuion without sudo permission
+sudo groupadd docker
+sudo gpasswd -a ${USER} docker
+sudo service docker restart
+
+# create new group and execute the rest commands
+newgrp - docker << REST
+
+# 2. build wasm-debug-server docker image
+cd ${DIR_ROOT}/WASM-Debug-Server/Docker
+docker build -t wasm-debug-server:1.0 .
+
+# 3. build wasm-toolchain docker image
+cd ${DIR_ROOT}/WASM-Toolchain/Docker
+docker pull ubuntu:20.04
+docker build -t wasm-toolchain:1.0 .
+
+REST \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.eslintrc.json b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.eslintrc.json
new file mode 100644
index 000000000..5c1fd464c
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.eslintrc.json
@@ -0,0 +1,19 @@
+{
+ "root": true,
+ "parser": "@typescript-eslint/parser",
+ "extends": ["plugin:@typescript-eslint/recommended"],
+ "parserOptions": {
+ "ecmaVersion": "latest",
+ "sourceType": "module"
+ },
+ "plugins": ["@typescript-eslint"],
+ "rules": {
+ "@typescript-eslint/naming-convention": "warn",
+ "@typescript-eslint/semi": "warn",
+ "curly": "warn",
+ "eqeqeq": "warn",
+ "no-throw-literal": "warn",
+ "semi": "off"
+ },
+ "ignorePatterns": ["out", "dist", "**/*.d.ts"]
+}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.gitignore b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.gitignore
new file mode 100644
index 000000000..417c854d2
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.gitignore
@@ -0,0 +1,7 @@
+out
+dist
+node_modules
+.vscode-test/
+*.vsix
+package-lock.json
+src/test \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.prettierrc.json b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.prettierrc.json
new file mode 100644
index 000000000..b2b00da56
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.prettierrc.json
@@ -0,0 +1,12 @@
+{
+ "printWidth": 80,
+ "tabWidth": 4,
+ "useTabs": false,
+ "semi": true,
+ "singleQuote": true,
+ "trailingComma": "es5",
+ "bracketSpacing": true,
+ "jsxBracketSameLine": false,
+ "arrowParens": "avoid",
+ "proseWrap": "always"
+}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.vscode/extensions.json b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.vscode/extensions.json
new file mode 100644
index 000000000..b1a2d99f0
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.vscode/extensions.json
@@ -0,0 +1,5 @@
+{
+ // See http://go.microsoft.com/fwlink/?LinkId=827846
+ // for the documentation about the extensions.json format
+ "recommendations": ["dbaeumer.vscode-eslint"]
+}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.vscode/launch.json b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.vscode/launch.json
new file mode 100644
index 000000000..4e9ccc24b
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.vscode/launch.json
@@ -0,0 +1,15 @@
+// A launch configuration that compiles the extension and then opens it inside a new window
+
+{
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "Launch Extension",
+ "type": "extensionHost",
+ "request": "launch",
+ "args": ["--extensionDevelopmentPath=${workspaceFolder}"],
+ "outFiles": ["${workspaceFolder}/out/**/*.js"],
+ "preLaunchTask": "${defaultBuildTask}"
+ }
+ ]
+}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.vscode/tasks.json b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.vscode/tasks.json
new file mode 100644
index 000000000..5deb2bccd
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.vscode/tasks.json
@@ -0,0 +1,20 @@
+// See https://go.microsoft.com/fwlink/?LinkId=733558
+// for the documentation about the tasks.json format
+{
+ "version": "2.0.0",
+ "tasks": [
+ {
+ "type": "npm",
+ "script": "watch",
+ "problemMatcher": "$tsc-watch",
+ "isBackground": true,
+ "presentation": {
+ "reveal": "never"
+ },
+ "group": {
+ "kind": "build",
+ "isDefault": true
+ }
+ }
+ ]
+}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.vscodeignore b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.vscodeignore
new file mode 100644
index 000000000..b2d2b4787
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/.vscodeignore
@@ -0,0 +1,11 @@
+.gitignore
+.yarnrc
+
+.vscode/**
+.vscode-test/**
+out/test/**
+
+**/tsconfig.json
+**/.eslintrc.json
+**/*.map
+**/*.ts
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/CONTRIBUTING.md b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/CONTRIBUTING.md
new file mode 100644
index 000000000..f70a959eb
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/CONTRIBUTING.md
@@ -0,0 +1,34 @@
+# CONTRIBUTING
+
+## Pull requests
+
+To submit your change:
+
+- Make sure your code is in line with our
+ [coding conventions](##Coding-conventions).
+- Create an [issue] describing the bug the PR fixes or the feature you intend
+ to implement.
+- Submit a [pull request] into the main branch.
+
+## Coding conventions
+
+#### Format
+
+The codebase is formatted by `Prettier` and the `.prettierrc.json` has been
+configured.
+
+- VSCode along with `Format on Save` configuration could easily format your
+ code during development.
+- You can run `prettier-format-check` and `prettier-format-apply` to check and
+ format your codebase with `prettier` in terminal.
+
+#### Lint
+
+`ESlint` is used as linter for the codebase and the `.eslintrc.json` has been
+configured.
+
+- It's suggested to run `npm run lint` then fix errors and warnings before
+ committing.
+
+[issue]: https://github.com/bytecodealliance/wasm-micro-runtime/issues
+[pull request]: https://github.com/bytecodealliance/wasm-micro-runtime/pulls
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/LICENSE b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/LICENSE
new file mode 100644
index 000000000..c6bd7e0c5
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/LICENSE
@@ -0,0 +1,219 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+--- LLVM Exceptions to the Apache 2.0 License ----
+
+As an exception, if, as a result of your compiling your source code, portions
+of this Software are embedded into an Object form of such source code, you
+may redistribute such embedded portions in such Object form without complying
+with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
+
+In addition, if you combine or link compiled forms of this Software with
+software that is licensed under the GPLv2 ("Combined Software") and if a
+court of competent jurisdiction determines that the patent provision (Section
+3), the indemnity provision (Section 9) or other Section of the License
+conflicts with the conditions of the GPLv2, you may retroactively and
+prospectively choose to deem waived or otherwise exclude such Section(s) of
+the License, but only in their entirety and only with respect to the Combined
+Software.
+
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/README.md b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/README.md
new file mode 100644
index 000000000..739e39a72
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/README.md
@@ -0,0 +1,40 @@
+# Introduction
+
+### An integrated development environment for WASM.
+
+# How to debug this extension
+> Note that when you download and
+> 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.
+> If you want to enable the `source debugging` feature of this extension,
+> you could download `lldb` from [our release](https://github.com/bytecodealliance/wasm-micro-runtime/releases)
+> (This is the recommended way, and you could do it with a single click in VS Code).
+> 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`
+
+```xml
+File -> Open Folder -> select `VSCode_Extension`
+```
+
+### 2. run `npm install` in `terminal` to install necessary dependencies.
+
+### 3. click `F5` or `ctrl+shift+D` switch to `Run and Debug` panel and click `Run Extension` to boot.
+
+# Code Format
+
+`prettier` is recommended and `.prettierrc.json` has been provided in workspace.
+More details and usage guidance please refer [prettier](https://prettier.io/docs/en/install.html)
+
+You can run following commands in current extension directory to check and apply
+```shell
+# install prettier firstly
+npm install --save-dev prettier
+# check format
+npm run prettier-format-check
+# apply
+npm run prettier-format-apply
+``` \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/package.json b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/package.json
new file mode 100644
index 000000000..dfe37961b
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/package.json
@@ -0,0 +1,258 @@
+{
+ "name": "wamride",
+ "publisher": "wamr-ide",
+ "repository": {
+ "url": "https://github.com/bytecodealliance/wasm-micro-runtime/tree/main/test-tools/wamr-ide"
+ },
+ "displayName": "WAMR-IDE",
+ "description": "An Integrated Development Environment for WASM",
+ "version": "1.2.1",
+ "engines": {
+ "vscode": "^1.59.0"
+ },
+ "categories": [
+ "Other"
+ ],
+ "activationEvents": [
+ "onStartupFinished"
+ ],
+ "main": "./out/extension.js",
+ "contributes": {
+ "commands": [
+ {
+ "command": "wamride.newProject",
+ "title": "Create new project",
+ "category": "New project"
+ },
+ {
+ "command": "wamride.changeWorkspace",
+ "title": "Change workspace",
+ "category": "Change Workspace"
+ },
+ {
+ "command": "wamride.build",
+ "title": "WAMRIDE:Build Wasm"
+ },
+ {
+ "command": "wamride.run",
+ "title": "WAMRIDE:Run Wasm"
+ },
+ {
+ "command": "wamride.debug",
+ "title": "WAMRIDE:Source Debug"
+ },
+ {
+ "command": "wamride.openFolder",
+ "title": "WAMRIDE:openWorkspace"
+ },
+ {
+ "command": "wamride.build.toggleStateIncludePath",
+ "title": "Toggle state of path including"
+ },
+ {
+ "command": "wamride.build.toggleStateExclude",
+ "title": "Toggle state of excluding"
+ },
+ {
+ "command": "wamride.targetConfig",
+ "title": "Target Configuration"
+ }
+ ],
+ "viewsContainers": {
+ "activitybar": [
+ {
+ "id": "wamride",
+ "title": "WAMRIDE",
+ "icon": "$(star)"
+ }
+ ]
+ },
+ "views": {
+ "wamride": [
+ {
+ "id": "wamride.views.welcome",
+ "name": "Quick Access"
+ }
+ ]
+ },
+ "viewsWelcome": [
+ {
+ "view": "wamride.views.welcome",
+ "contents": "[ WAMR IDE ]\n[$(project)New project](command:wamride.newProject)\n[$(files)Open project](command:wamride.openFolder)\n[$(book)Change workspace](command:wamride.changeWorkspace)"
+ },
+ {
+ "view": "wamride.views.welcome",
+ "contents": "[ Current Project ]\n[$(pencil)Configuration](command:wamride.targetConfig)\n[$(gear)Build](command:wamride.build)\n[$(run)Run](command:wamride.run)\n[$(debug-alt) Debug](command:wamride.debug)",
+ "enablement": "ext.isWasmProject"
+ }
+ ],
+ "menus": {
+ "explorer/context": [
+ {
+ "command": "wamride.build.toggleStateIncludePath",
+ "alt": "wamride.build.toggleStateIncludePath",
+ "group": "config",
+ "when": "explorerResourceIsFolder"
+ },
+ {
+ "command": "wamride.build.toggleStateExclude",
+ "alt": "wamride.build.toggleStateExclude",
+ "group": "config",
+ "when": "!explorerResourceIsFolder && resourceExtname in ext.supportedFileType"
+ }
+ ]
+ },
+ "debuggers": [
+ {
+ "type": "wamr-debug",
+ "label": "WAMR lldb debugger",
+ "enableBreakpointsFor": {
+ "languageIds": [
+ "ada",
+ "arm",
+ "asm",
+ "c",
+ "cpp",
+ "crystal",
+ "d",
+ "fortan",
+ "fortran-modern",
+ "nim",
+ "objective-c",
+ "objectpascal",
+ "pascal",
+ "rust",
+ "swift"
+ ]
+ },
+ "windows": {
+ "program": "./resource/debug/windows/bin/lldb-vscode.exe"
+ },
+ "osx": {
+ "program": "./resource/debug/darwin/bin/lldb-vscode"
+ },
+ "linux": {
+ "program": "./resource/debug/linux/bin/lldb-vscode"
+ },
+ "configurationAttributes": {
+ "attach": {
+ "properties": {
+ "sourcePath": {
+ "type": "string",
+ "description": "Specify a source path to remap \"./\" to allow full paths to be used when setting breakpoints in binaries that have relative source paths."
+ },
+ "sourceMap": {
+ "type": "array",
+ "description": "Specify an array of path remappings; each element must itself be a two element array containing a source and destination pathname. Overrides sourcePath.",
+ "default": []
+ },
+ "debuggerRoot": {
+ "type": "string",
+ "description": "Specify a working directory to set the debug adaptor to so relative object files can be located."
+ },
+ "attachCommands": {
+ "type": "array",
+ "description": "Custom commands that are executed instead of attaching to a process ID or to a process by name. These commands may optionally create a new target and must perform an attach. A valid process must exist after these commands complete or the \"attach\" will fail.",
+ "default": []
+ },
+ "initCommands": {
+ "type": "array",
+ "description": "Initialization commands executed upon debugger startup.",
+ "default": []
+ },
+ "preRunCommands": {
+ "type": "array",
+ "description": "Commands executed just before the program is attached to.",
+ "default": []
+ },
+ "stopCommands": {
+ "type": "array",
+ "description": "Commands executed each time the program stops.",
+ "default": []
+ },
+ "exitCommands": {
+ "type": "array",
+ "description": "Commands executed at the end of debugging session.",
+ "default": []
+ }
+ }
+ }
+ },
+ "initialConfigurations": [
+ {
+ "type": "wamr-debug",
+ "request": "attach",
+ "name": "Debug",
+ "stopOnEntry": true,
+ "attachCommands": [
+ "process connect -p wasm connect://127.0.0.1:1234"
+ ]
+ }
+ ],
+ "configurationSnippets": [
+ {
+ "label": "WAMR: Attach",
+ "description": "",
+ "body": {
+ "type": "wamr-debug",
+ "request": "attach",
+ "name": "${2:Attach}",
+ "stopOnEntry": true,
+ "attachCommands": [
+ "process connect -p wasm connect://${3:127.0.0.1}:${4:1234}"
+ ]
+ }
+ }
+ ]
+ }
+ ],
+ "configuration": [
+ {
+ "title": "WAMR-IDE",
+ "properties": {
+ "WAMR-IDE.configWorkspace": {
+ "type": "string",
+ "description": "Config the workspace for WebAssembly project."
+ }
+ }
+ }
+ ],
+ "taskDefinitions": [
+ {
+ "type": "wasm"
+ }
+ ]
+ },
+ "scripts": {
+ "vscode:prepublish": "npm run compile",
+ "compile": "tsc -p ./",
+ "watch": "tsc -watch -p ./",
+ "pretest": "npm run compile && npm run lint",
+ "lint": "eslint src --ext ts",
+ "lint-fix": "eslint --fix src --ext ts",
+ "test": "node ./out/test/runTest.js",
+ "prettier-format-check": "prettier --config .prettierrc.json 'src/**/*.ts' --check",
+ "prettier-format-apply": "prettier --config .prettierrc.json 'src/**/*.ts' --write"
+ },
+ "devDependencies": {
+ "@types/glob": "^7.1.3",
+ "@types/mocha": "^8.2.2",
+ "@types/node": "14.x",
+ "@types/request": "^2.48.8",
+ "@types/vscode": "^1.54.0",
+ "@types/yauzl": "^2.10.0",
+ "@typescript-eslint/eslint-plugin": "^4.26.0",
+ "@typescript-eslint/parser": "^4.26.0",
+ "eslint": "^7.32.0",
+ "glob": "^7.1.7",
+ "mocha": "^8.4.0",
+ "prettier": "2.5.1",
+ "typescript": "^4.3.2",
+ "vscode-test": "^1.5.2"
+ },
+ "dependencies": {
+ "@vscode/webview-ui-toolkit": "^0.8.4",
+ "request": "^2.88.2",
+ "yauzl": "^2.10.0"
+ }
+}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/debug/README.md b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/debug/README.md
new file mode 100644
index 000000000..403e35ae9
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/debug/README.md
@@ -0,0 +1,15 @@
+### 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
+
+```shell
+/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 {VS Code directory}/resource/debug/linux/bin/
+/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`.
+
+### Then you can start the extension and run the execute source debugging by clicking the `debug` button in the extension panel.
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/debug/darwin/.placeholder b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/debug/darwin/.placeholder
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/debug/darwin/.placeholder
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/debug/linux/.placeholder b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/debug/linux/.placeholder
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/debug/linux/.placeholder
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/debug/windows/.placeholder b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/debug/windows/.placeholder
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/debug/windows/.placeholder
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/CMakeLists.txt b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/CMakeLists.txt
new file mode 100644
index 000000000..81d998bc8
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/CMakeLists.txt
@@ -0,0 +1,32 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+cmake_minimum_required (VERSION 2.9)
+
+project(Main)
+
+include(${CMAKE_CURRENT_SOURCE_DIR}/project.cmake)
+
+set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wno-unused-command-line-argument " CACHE INTERNAL "")
+
+set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -z stack-size=${STACK_SIZE}")
+
+set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdebug-prefix-map=/mnt='$ENV{PROJ_PATH}'")
+
+set (CMAKE_EXE_LINKER_FLAGS
+ "${CMAKE_EXE_LINKER_FLAGS} -Wl,--initial-memory=${INIT_MEM_SIZE},--max-memory=${MAX_MEM_SIZE},")
+
+set (CMAKE_EXE_LINKER_FLAGS
+ "${CMAKE_EXE_LINKER_FLAGS} \
+ ${EXPORTED_SYMBOLS},")
+
+set (SRC_LIST
+ ${PROJECT_SRC_LIST})
+
+set (HEADER_LIST
+ ${CMAKE_CURRENT_SOURCE_DIR}/../include
+ ${PROJECT_INCLUDES})
+
+include_directories(${HEADER_LIST})
+
+add_executable (${OUTPUT_FILE_NAME} ${SRC_LIST}) \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/boot_debugger_server.bat b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/boot_debugger_server.bat
new file mode 100644
index 000000000..7fd1f024a
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/boot_debugger_server.bat
@@ -0,0 +1,10 @@
+@REM Copyright (C) 2019 Intel Corporation. All rights reserved.
+@REM SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+@echo off
+
+docker run --rm -it --name=wasm-debug-server-ctr ^
+ -v "%cd%":/mnt ^
+ -p 1234:1234 ^
+ wasm-debug-server:%2 ^
+ /bin/bash -c "./debug.sh %1"
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/boot_debugger_server.sh b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/boot_debugger_server.sh
new file mode 100755
index 000000000..169fb7e5f
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/boot_debugger_server.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+set -e
+
+docker run --rm -it --name=wasm-debug-server-ctr \
+ -v "$(pwd)":/mnt \
+ -p 1234:1234 \
+ wasm-debug-server:$2 \
+ /bin/bash -c "./debug.sh $1"
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/build.bat b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/build.bat
new file mode 100644
index 000000000..de415107a
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/build.bat
@@ -0,0 +1,11 @@
+@REM Copyright (C) 2019 Intel Corporation. All rights reserved.
+@REM SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+@echo off
+
+@REM start a container, mount current project path to container/mnt
+docker run --rm --name=wasm-toolchain-ctr ^
+ -it -v "%cd%":/mnt ^
+ --env=PROJ_PATH="%cd%" ^
+ wasm-toolchain:%2 ^
+ /bin/bash -c "./build_wasm.sh %1"
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/build.sh b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/build.sh
new file mode 100755
index 000000000..a8a42cc89
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/build.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+set -e
+
+docker run --rm --name=wasm-toolchain-ctr \
+ -it -v "$(pwd)":/mnt \
+ --env=PROJ_PATH="$(pwd)" \
+ wasm-toolchain:$2 \
+ /bin/bash -c "./build_wasm.sh $1"
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/destroy.bat b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/destroy.bat
new file mode 100644
index 000000000..faf316ab3
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/destroy.bat
@@ -0,0 +1,36 @@
+@REM Copyright (C) 2019 Intel Corporation. All rights reserved.
+@REM SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+@echo off
+
+call docker --version>nul 2>nul
+IF %ERRORLEVEL% GTR 0 (
+ echo "Docker is not installed, please install docker desktop firstly."
+ echo
+ exit /b 1
+)
+
+call docker images>nul 2>nul
+IF %ERRORLEVEL% GTR 0 (
+ echo "Docker is not ready, please lanuch docker desktop firstly."
+ echo
+ exit /b 2
+)
+
+echo "Prepare to clean up the docker containers..."
+
+call docker inspect wasm-toolchain-ctr>nul 2>nul
+IF %ERRORLEVEL% EQU 0 (
+ echo "Stopping and removing wasm-toolchain-ctr container..."
+ docker rm -f wasm-toolchain-ctr>nul 2>nul
+ echo "Done."
+)
+
+call docker inspect wasm-debug-server-ctr>nul 2>nul
+IF %ERRORLEVEL% EQU 0 (
+ echo "Stopping and removing wasm-debug-server-ctr container..."
+ docker rm -f wasm-debug-server-ctr>nul 2>nul
+ echo "Done."
+)
+
+echo "Clean up docker containers successfully."
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/destroy.sh b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/destroy.sh
new file mode 100755
index 000000000..41faf3eaf
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/destroy.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+set -e
+
+docker -v>/dev/null
+if [ $? -ne 0 ]; then
+ echo "\nDocker is not installed, please install docker firstly.\n"
+ exit 1
+fi
+
+docker images>/dev/null
+if [ $? -ne 0 ]; then
+ echo "\nDocker service is not running, please start your docker service firstly.\n"
+ exit 2
+fi
+
+echo "Prepare to clean up the docker containers..."
+
+if test ! -z "$(docker ps -a | grep wasm-toolchain-ctr)"; then
+ echo "Stopping and removing wasm-toolchain-ctr container..."
+ docker rm -f wasm-toolchain-ctr>/dev/null
+ echo "Done."
+fi
+
+if test ! -z "$(docker ps -a | grep wasm-debug-server-ctr)"; then
+ echo "Stopping and removing wasm-debug-server-ctr container..."
+ docker rm -f wasm-debug-server-ctr>/dev/null
+ echo "Done."
+fi
+
+echo "Clean up docker containers successfully."
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/project.cmake b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/project.cmake
new file mode 100644
index 000000000..20b080e0c
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/project.cmake
@@ -0,0 +1,17 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+set (OUTPUT_FILE_NAME)
+
+set (INIT_MEM_SIZE)
+
+set (MAX_MEM_SIZE)
+
+set (STACK_SIZE)
+
+set (EXPORTED_SYMBOLS)
+
+set (PROJECT_SRC_LIST)
+
+set (PROJECT_INCLUDES)
+
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/run.bat b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/run.bat
new file mode 100644
index 000000000..af47f35ba
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/run.bat
@@ -0,0 +1,9 @@
+@REM Copyright (C) 2019 Intel Corporation. All rights reserved.
+@REM SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+@echo off
+
+docker run --rm -it --name=wasm-debug-server-ctr ^
+ -v "%cd%":/mnt ^
+ wasm-debug-server:%2 ^
+ /bin/bash -c "./run.sh %1"
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/run.sh b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/run.sh
new file mode 100755
index 000000000..670e57c1e
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/scripts/run.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+set -e
+
+docker run --rm -it --name=wasm-debug-server-ctr \
+ -v "$(pwd)":/mnt \
+ wasm-debug-server:$2 \
+ /bin/bash -c "./run.sh $1"
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/assert.h b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/assert.h
new file mode 100644
index 000000000..86fdefe61
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/assert.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+#ifndef _WAMR_LIBC_ASSERT_H
+#define _WAMR_LIBC_ASSERT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/ctype.h b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/ctype.h
new file mode 100644
index 000000000..846e7c8f6
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/ctype.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+#ifndef _WAMR_LIBC_CTYPE_H
+#define _WAMR_LIBC_CTYPE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int
+isupper(int c);
+int
+isalpha(int c);
+int
+isspace(int c);
+int
+isgraph(int c);
+int
+isprint(int c);
+int
+isdigit(int c);
+int
+isxdigit(int c);
+int
+tolower(int c);
+int
+toupper(int c);
+int
+isalnum(int c);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/errno.h b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/errno.h
new file mode 100644
index 000000000..8883bf806
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/errno.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+#ifndef _WAMR_LIBC_ERRNO_H
+#define _WAMR_LIBC_ERRNO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/fcntl.h b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/fcntl.h
new file mode 100644
index 000000000..b7e292f22
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/fcntl.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+#ifndef _WAMR_LIBC_FCNTL_H
+#define _WAMR_LIBC_FCNTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/inttypes.h b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/inttypes.h
new file mode 100644
index 000000000..2e59ca38d
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/inttypes.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+#ifndef _WAMR_LIBC_INTTYPES_H
+#define _WAMR_LIBC_INTTYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/limits.h b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/limits.h
new file mode 100644
index 000000000..3859b050b
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/limits.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+#ifndef _WAMR_LIBC_LIMITS_H
+#define _WAMR_LIBC_LIMITS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CHAR_BIT 8
+#define SCHAR_MIN -128
+#define SCHAR_MAX 127
+#define UCHAR_MAX 255
+#define CHAR_MIN 0
+#define CHAR_MAX 127
+#define MB_LEN_MAX 1
+#define SHRT_MIN -32768
+#define SHRT_MAX +32767
+#define USHRT_MAX 65535
+#define INT_MIN -32768
+#define INT_MAX +32767
+#define UINT_MAX 65535
+#define LONG_MIN -2147483648
+#define LONG_MAX +2147483647
+#define ULONG_MAX 4294967295
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/pthread.h b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/pthread.h
new file mode 100644
index 000000000..10b3978e9
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/pthread.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+#ifndef _WAMR_LIB_PTHREAD_H
+#define _WAMR_LIB_PTHREAD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+/* Data type define of pthread, mutex, cond and key */
+typedef unsigned int pthread_t;
+typedef unsigned int pthread_mutex_t;
+typedef unsigned int pthread_cond_t;
+typedef unsigned int pthread_key_t;
+
+/* Thread APIs */
+int
+pthread_create(pthread_t *thread, const void *attr,
+ void *(*start_routine)(void *), void *arg);
+
+int
+pthread_join(pthread_t thread, void **retval);
+
+int
+pthread_detach(pthread_t thread);
+
+int
+pthread_cancel(pthread_t thread);
+
+pthread_t
+pthread_self(void);
+
+void
+pthread_exit(void *retval);
+
+/* Mutex APIs */
+int
+pthread_mutex_init(pthread_mutex_t *mutex, const void *attr);
+
+int
+pthread_mutex_lock(pthread_mutex_t *mutex);
+
+int
+pthread_mutex_unlock(pthread_mutex_t *mutex);
+
+int
+pthread_mutex_destroy(pthread_mutex_t *mutex);
+
+/* Cond APIs */
+int
+pthread_cond_init(pthread_cond_t *cond, const void *attr);
+
+int
+pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
+
+int
+pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
+ uint64_t useconds);
+
+int
+pthread_cond_signal(pthread_cond_t *cond);
+
+int
+pthread_cond_broadcast(pthread_cond_t *cond);
+
+int
+pthread_cond_destroy(pthread_cond_t *cond);
+
+/* Pthread key APIs */
+int
+pthread_key_create(pthread_key_t *key, void (*destructor)(void *));
+
+int
+pthread_setspecific(pthread_key_t key, const void *value);
+
+void *
+pthread_getspecific(pthread_key_t key);
+
+int
+pthread_key_delete(pthread_key_t key);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* end of _WAMR_LIB_PTHREAD_H */
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/stdarg.h b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/stdarg.h
new file mode 100644
index 000000000..509595734
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/stdarg.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+#ifndef _WAMR_LIBC_STDARG_H
+#define _WAMR_LIBC_STDARG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _VA_LIST
+typedef __builtin_va_list va_list;
+#define _VA_LIST
+#endif
+#define va_start(ap, param) __builtin_va_start(ap, param)
+#define va_end(ap) __builtin_va_end(ap)
+#define va_arg(ap, type) __builtin_va_arg(ap, type)
+
+#define __va_copy(d, s) __builtin_va_copy(d, s)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* end of _WAMR_LIBC_STDARG_H */
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/stdbool.h b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/stdbool.h
new file mode 100644
index 000000000..2d1f8cd76
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/stdbool.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+#ifndef _WAMR_LIBC_STDBOOL_H
+#define _WAMR_LIBC_STDBOOL_H
+
+#define __bool_true_false_are_defined 1
+
+#ifndef __cplusplus
+
+#define bool _Bool
+#define false 0
+#define true 1
+
+#endif /* __cplusplus */
+
+#endif \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/stdint.h b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/stdint.h
new file mode 100644
index 000000000..8c55bff50
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/stdint.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+#ifndef _WAMR_LIBC_STDINT_H
+#define _WAMR_LIBC_STDINT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* clang-format off */
+typedef char int8_t;
+typedef short int int16_t;
+typedef int int32_t;
+typedef long long int int64_t;
+
+/* Unsigned. */
+typedef unsigned char uint8_t;
+typedef unsigned short int uint16_t;
+typedef unsigned int uint32_t;
+typedef unsigned long long int uint64_t;
+
+typedef __INTPTR_TYPE__ intptr_t;
+typedef __UINTPTR_TYPE__ uintptr_t;
+
+/* Minimum of signed integral types. */
+# define INT8_MIN (-128)
+# define INT16_MIN (-32767-1)
+# define INT32_MIN (-2147483647-1)
+# define INT64_MIN (-__INT64_C(9223372036854775807)-1)
+/* Maximum of signed integral types. */
+# define INT8_MAX (127)
+# define INT16_MAX (32767)
+# define INT32_MAX (2147483647)
+# define INT64_MAX (__INT64_C(9223372036854775807))
+
+/* Maximum of unsigned integral types. */
+# define UINT8_MAX (255)
+# define UINT16_MAX (65535)
+# define UINT32_MAX (4294967295U)
+# define UINT64_MAX (__UINT64_C(18446744073709551615))
+/* clang-format on */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/stdio.h b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/stdio.h
new file mode 100644
index 000000000..f9f03660f
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/stdio.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+#ifndef _WAMR_LIBC_STDIO_H
+#define _WAMR_LIBC_STDIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef NULL
+#define NULL ((void *)0)
+#endif
+
+typedef unsigned long size_t;
+
+int
+printf(const char *format, ...);
+int
+putchar(int c);
+int
+snprintf(char *str, size_t size, const char *format, ...);
+int
+sprintf(char *str, const char *format, ...);
+int
+puts(char *string);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/stdlib.h b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/stdlib.h
new file mode 100644
index 000000000..302c896c4
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/stdlib.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+#ifndef _WAMR_LIBC_STDLIB_H
+#define _WAMR_LIBC_STDLIB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef unsigned long size_t;
+
+int
+atoi(const char *s);
+void
+exit(int status);
+long
+strtol(const char *nptr, char **endptr, register int base);
+unsigned long
+strtoul(const char *nptr, char **endptr, register int base);
+void *
+malloc(size_t size);
+void *
+calloc(size_t n, size_t size);
+void
+free(void *ptr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/string.h b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/string.h
new file mode 100644
index 000000000..7a1a93dc4
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/string.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+#ifndef _WAMR_LIBC_STRING_H
+#define _WAMR_LIBC_STRING_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef unsigned long size_t;
+
+int
+memcmp(const void *s1, const void *s2, size_t n);
+void *
+memcpy(void *dest, const void *src, size_t n);
+void *
+memmove(void *dest, const void *src, size_t n);
+void *
+memset(void *s, int c, size_t n);
+void *
+memchr(const void *s, int c, size_t n);
+int
+strncasecmp(const char *s1, const char *s2, size_t n);
+size_t
+strspn(const char *s, const char *accept);
+size_t
+strcspn(const char *s, const char *reject);
+char *
+strstr(const char *s, const char *find);
+char *
+strchr(const char *s, int c);
+int
+strcmp(const char *s1, const char *s2);
+char *
+strcpy(char *dest, const char *src);
+size_t
+strlen(const char *s);
+int
+strncmp(const char *str1, const char *str2, size_t n);
+char *
+strncpy(char *dest, const char *src, unsigned long n);
+char *
+strdup(const char *s);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/strings.h b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/strings.h
new file mode 100644
index 000000000..3fe6ff63a
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/wamr-sdk/libc-builtin-sysroot/include/strings.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+#ifndef _WAMR_LIBC_STRINGS_H
+#define _WAMR_LIBC_STRINGS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/webview/css/style.css b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/webview/css/style.css
new file mode 100644
index 000000000..bff10e5b4
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/webview/css/style.css
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+.box_wrapper {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
+
+.form_heading {
+ text-align: left;
+}
+
+.form_heading vscode-divider,
+.config_form_heading vscode-divider,
+.form_bottom vscode-divider,
+.config_form_bottom vscode-divider {
+ padding-bottom: 0.5rem;
+}
+
+.form_body,
+.config_form_body {
+ display: grid;
+ grid-row-gap: 1rem;
+ padding-bottom: 0.5rem;
+}
+
+.config_form_body div,
+.config_submit_btn_wrapper {
+ display: grid;
+ grid-template-columns: 4fr 8fr;
+ grid-column-gap: 0.5rem;
+}
+
+.form_heading,
+.form_body,
+.form_bottom {
+ width: 400px;
+}
+
+.config_form_body,
+.config_form_heading,
+.config_form_bottom {
+ width: 550px;
+}
+
+#btn_submit {
+ border-radius: 5px;
+}
+
+#select_div,
+#text_filed_div,
+.proj_submit_btn_wrapper {
+ display: grid;
+ grid-template-columns: 3fr 9fr;
+ grid-column-gap: 0.5rem;
+}
+
+#ipt_projName,
+#select_dropdown,
+.config_form_body vscode-text-field,
+.config_form_body vscode-text-area {
+ width: 100%;
+}
+
+#btn {
+ text-align: center;
+}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/webview/js/configbuildtarget.js b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/webview/js/configbuildtarget.js
new file mode 100644
index 000000000..837f384bc
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/webview/js/configbuildtarget.js
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+const vscode = acquireVsCodeApi();
+
+document.getElementById('btn_submit').onclick = () => {
+ submitFunc();
+};
+
+function submitFunc() {
+ let outputFileName = document.getElementById('output_file_name').value;
+ let initMemSize = document.getElementById('initial_mem_size').value;
+ let maxMemSize = document.getElementById('max_mem_size').value;
+ let stackSize = document.getElementById('stack_size').value;
+ let exportedSymbols = document.getElementById('exported_symbols').value;
+
+ vscode.postMessage({
+ command: 'config_build_target',
+ outputFileName: outputFileName,
+ initMemSize: initMemSize,
+ maxMemSize: maxMemSize,
+ stackSize: stackSize,
+ exportedSymbols: exportedSymbols,
+ });
+}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/webview/js/newproj.js b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/webview/js/newproj.js
new file mode 100644
index 000000000..30e169788
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/webview/js/newproj.js
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+const vscode = acquireVsCodeApi();
+
+document.getElementById('btn_submit').onclick = () => {
+ submitFunc();
+};
+
+function submitFunc() {
+ let projectName = document.getElementById('ipt_projName').value;
+ let template = document.getElementById('select_dropdown').value;
+
+ vscode.postMessage({
+ command: 'create_new_project',
+ projectName: projectName,
+ template: template,
+ });
+
+ /* get msg from ext */
+ window.addEventListener('message', event => {
+ const message = event.data;
+ switch (message.command) {
+ /* send command to open the project */
+ case 'proj_creation_finish':
+ vscode.postMessage({
+ command: 'open_project',
+ projectName: message.prjName,
+ });
+ break;
+ default:
+ break;
+ }
+ });
+}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/webview/page/configBuildTarget.html b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/webview/page/configBuildTarget.html
new file mode 100644
index 000000000..b4c431511
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/webview/page/configBuildTarget.html
@@ -0,0 +1,63 @@
+<!--
+ -- Copyright (C) 2019 Intel Corporation. All rights reserved.
+ -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ -->
+
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <script type="module" src="${toolkitUri}"></script>
+ <script type="module" src="${mainUri}"></script>
+ <link rel="stylesheet" href="${styleUri}">
+ <title>New project</title>
+</head>
+
+<body>
+ <div class="box_wrapper">
+ <div class="config_form_heading">
+ <h2>Config building target</h2>
+ <vscode-divider></vscode-divider>
+ </div>
+ </div>
+
+ <div class="box_wrapper">
+ <div class="config_form_body">
+ <div>
+ <label><b>Output file name: </b></label>
+ <vscode-text-field id="output_file_name" value=${output_file_val}></vscode-text-field>
+ </div>
+ <div>
+ <label><b>Initial linear memory size: </b></label>
+ <vscode-text-field id="initial_mem_size" value=${initial_mem_size_val}></vscode-text-field>
+ </div>
+ <div>
+ <label><b>Max linear memory size: </b></label>
+ <vscode-text-field id="max_mem_size" value=${max_mem_size_val}></vscode-text-field>
+ </div>
+ <div>
+ <label><b>Stack size: </b></label>
+ <vscode-text-field id="stack_size" value=${stack_size_val}></vscode-text-field>
+ </div>
+ <div>
+ <label><b>Exported symbols: </b></label>
+ <vscode-text-area rows="3" id="exported_symbols" placeholder="Please split each symbol with comma. Like 'app_main,on_init'" value=${exported_symbols_val}></vscode-text-area>
+ </div>
+ </div>
+ </div>
+
+ <div class="box_wrapper">
+ <div class="config_form_bottom">
+ <vscode-divider></vscode-divider>
+ <div class="config_submit_btn_wrapper">
+ <div></div>
+ <div id="btn">
+ <vscode-button id="btn_submit"><b>Modify</b></vscode-buton>
+ </div>
+ </div>
+ </div>
+ </div>
+
+</body>
+</html>
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/webview/page/newProject.html b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/webview/page/newProject.html
new file mode 100644
index 000000000..71e67bd89
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/resource/webview/page/newProject.html
@@ -0,0 +1,55 @@
+<!--
+ -- Copyright (C) 2019 Intel Corporation. All rights reserved.
+ -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ -->
+
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <script type="module" src="${toolkitUri}"></script>
+ <script type="module" src="${mainUri}"></script>
+ <link rel="stylesheet" href="${styleUri}">
+ <title>Create project</title>
+</head>
+
+<body>
+ <div class="box_wrapper">
+ <div class="form_heading">
+ <h2>Create project</h2>
+ <vscode-divider class="divider_wrapper"></vscode-divider>
+ </div>
+ </div>
+
+ <div class="box_wrapper">
+ <div class="form_body">
+ <div id="text_filed_div">
+ <label><b>Project Name: </b></label>
+ <vscode-text-field id="ipt_projName"></vscode-text-field>
+ </div>
+
+ <div id="select_div">
+ <label><b>Template:</b></label>
+ <vscode-dropdown id="select_dropdown">
+ <vscode-option value="" selected:disabled style="display:none"></vscode-option>
+ <vscode-option value="default">default</vscode-option>
+ </vscode-dropdown>
+ </div>
+ </div>
+ </div>
+
+ <div class="box_wrapper">
+ <div class="form_bottom">
+ <vscode-divider></vscode-divider>
+ <div class="proj_submit_btn_wrapper">
+ <div></div>
+ <div id="btn">
+ <vscode-button id="btn_submit"><b>Create</b></vscode-buton>
+ </div>
+ </div>
+ </div>
+ </div>
+
+</body>
+</html>
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/constants.ts b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/constants.ts
new file mode 100644
index 000000000..cf8bb7103
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/constants.ts
@@ -0,0 +1,7 @@
+export const enum SelectionOfPrompt {
+ skip = 'skip',
+ setUp = 'setup',
+}
+export const enum Status {
+ done = 'done',
+}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/debugConfigurationProvider.ts b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/debugConfigurationProvider.ts
new file mode 100644
index 000000000..e7b42bf03
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/debugConfigurationProvider.ts
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+import * as vscode from 'vscode';
+import * as os from 'os';
+
+export class WasmDebugConfigurationProvider
+ implements vscode.DebugConfigurationProvider {
+ private wasmDebugConfig = {
+ type: 'wamr-debug',
+ name: 'Attach',
+ request: 'attach',
+ stopOnEntry: true,
+ initCommands: os.platform() === 'win32' || os.platform() === 'darwin' ?
+ /* linux and windows has different debug configuration */
+ ['platform select remote-linux'] :
+ undefined,
+ attachCommands: [
+ /* default port 1234 */
+ 'process connect -p wasm connect://127.0.0.1:1234',
+ ]
+ };
+
+ public resolveDebugConfiguration(
+ _: vscode.WorkspaceFolder | undefined,
+ debugConfiguration: vscode.DebugConfiguration,
+ ): vscode.ProviderResult<vscode.DebugConfiguration> {
+
+ this.wasmDebugConfig = {
+ ...this.wasmDebugConfig,
+ ...debugConfiguration
+ };
+
+ return this.wasmDebugConfig;
+ }
+
+ public getDebugConfig(): vscode.DebugConfiguration {
+ return this.wasmDebugConfig;
+ }
+}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/decorationProvider.ts b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/decorationProvider.ts
new file mode 100644
index 000000000..46efcc90c
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/decorationProvider.ts
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+import * as vscode from 'vscode';
+import { readFromFile } from './utilities/directoryUtilities';
+import * as path from 'path';
+import * as os from 'os';
+
+const DECORATION_INCLUDE_PATHS: vscode.FileDecoration =
+ new vscode.FileDecoration(
+ '✔',
+ 'Included',
+ new vscode.ThemeColor('list.highlightForeground')
+ );
+const DECORATION_EXCLUDE_FILES: vscode.FileDecoration =
+ new vscode.FileDecoration(
+ '✗',
+ 'Excluded',
+ new vscode.ThemeColor('list.errorForeground')
+ );
+
+export class DecorationProvider implements vscode.FileDecorationProvider {
+ private disposables: vscode.Disposable[] = [];
+ public onDidChangeFileDecorations: vscode.Event<
+ vscode.Uri | vscode.Uri[] | undefined
+ >;
+ private eventEmitter: vscode.EventEmitter<vscode.Uri | vscode.Uri[]>;
+
+ constructor() {
+ this.eventEmitter = new vscode.EventEmitter();
+ this.onDidChangeFileDecorations = this.eventEmitter.event;
+ this.disposables.push(
+ vscode.window.registerFileDecorationProvider(this)
+ );
+ }
+
+ public provideFileDecoration(
+ uri: vscode.Uri
+ ): vscode.ProviderResult<vscode.FileDecoration> {
+ const currentPrjDir =
+ os.platform() === 'win32'
+ ? (vscode.workspace.workspaceFolders?.[0].uri.fsPath as string)
+ : os.platform() === 'linux' || os.platform() === 'darwin'
+ ? (vscode.workspace.workspaceFolders?.[0].uri.path as string)
+ : '';
+
+ const pathRelative = (uri.fsPath ? uri.fsPath : uri.toString()).replace(
+ currentPrjDir,
+ '..'
+ );
+
+ const prjConfigDir = path.join(currentPrjDir, '.wamr');
+ const configFilePath = path.join(
+ prjConfigDir,
+ 'compilation_config.json'
+ );
+ if (readFromFile(configFilePath) !== '') {
+ const configData = JSON.parse(readFromFile(configFilePath));
+ const includePathArr = configData['includePaths'];
+ const excludeFileArr = configData['excludeFiles'];
+
+ if (includePathArr.indexOf(pathRelative) > -1) {
+ return DECORATION_INCLUDE_PATHS;
+ } else if (excludeFileArr.indexOf(pathRelative) > -1) {
+ return DECORATION_EXCLUDE_FILES;
+ }
+ }
+ }
+
+ public dispose(): void {
+ this.disposables.forEach(d => d.dispose());
+ }
+
+ public updateDecorationsForSource(uri: vscode.Uri): void {
+ this.eventEmitter.fire(uri);
+ }
+}
+
+export const decorationProvider: DecorationProvider = new DecorationProvider();
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/extension.ts b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/extension.ts
new file mode 100644
index 000000000..523b26b83
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/extension.ts
@@ -0,0 +1,1027 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+import * as fileSystem from 'fs';
+import * as os from 'os';
+import * as path from 'path';
+import * as vscode from 'vscode';
+
+import { WasmTaskProvider } from './taskProvider';
+import { TargetConfigPanel } from './view/TargetConfigPanel';
+import { NewProjectPanel } from './view/NewProjectPanel';
+import {
+ checkIfDirectoryExists,
+ writeIntoFile,
+ readFromFile,
+} from './utilities/directoryUtilities';
+import { decorationProvider } from './decorationProvider';
+import { WasmDebugConfigurationProvider } from './debugConfigurationProvider';
+import {
+ isLLDBInstalled,
+ promptInstallLLDB,
+ getWAMRExtensionVersion,
+} from './utilities/lldbUtilities';
+
+import {
+ checkIfDockerStarted,
+ checkIfDockerImagesExist,
+ promptSetupDockerImages,
+} from './utilities/dockerUtilities';
+import { SelectionOfPrompt } from './constants';
+
+let wasmTaskProvider: WasmTaskProvider;
+let wasmDebugConfigProvider: WasmDebugConfigurationProvider;
+let currentPrjDir = '';
+let isWasmProject = false;
+
+// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
+export async function activate(context: vscode.ExtensionContext) {
+ const extensionPath = context.extensionPath;
+ const osPlatform = os.platform();
+ const wamrVersion = getWAMRExtensionVersion(context);
+ const typeMap = new Map<string, string>();
+ const scriptMap = new Map<string, string>();
+ /* set relative path of build.bat|sh script */
+ const scriptPrefix = 'resource/scripts/';
+
+ let buildScript = '',
+ runScript = '',
+ debugScript = '',
+ destroyScript = '',
+ buildScriptFullPath = '',
+ runScriptFullPath = '',
+ debugScriptFullPath = '',
+ destroyScriptFullPath = '',
+ /* include paths array used for written into config file */
+ includePathArr = new Array<string>(),
+ /* exclude files array used for written into config file */
+ excludeFileArr = new Array<string>();
+
+ /**
+ * Provide Build & Run Task with Task Provider instead of "tasks.json"
+ */
+
+ if (osPlatform === 'win32') {
+ buildScript = scriptPrefix.concat('build.bat');
+ runScript = scriptPrefix.concat('run.bat');
+ debugScript = scriptPrefix.concat('boot_debugger_server.bat');
+ destroyScript = scriptPrefix.concat('destroy.bat');
+ } else if (osPlatform === 'linux' || osPlatform === 'darwin') {
+ buildScript = scriptPrefix.concat('build.sh');
+ runScript = scriptPrefix.concat('run.sh');
+ debugScript = scriptPrefix.concat('boot_debugger_server.sh');
+ destroyScript = scriptPrefix.concat('destroy.sh');
+ }
+
+ buildScriptFullPath = path.join(extensionPath, buildScript);
+ runScriptFullPath = path.join(extensionPath, runScript);
+ debugScriptFullPath = path.join(extensionPath, debugScript);
+ destroyScriptFullPath = path.join(extensionPath, destroyScript);
+
+ scriptMap.set('buildScript', buildScriptFullPath);
+ scriptMap.set('runScript', runScriptFullPath);
+ scriptMap.set('debugScript', debugScriptFullPath);
+ scriptMap.set('destroyScript', destroyScriptFullPath);
+
+ typeMap.set('Build', 'Build');
+ typeMap.set('Run', 'Run');
+ typeMap.set('Debug', 'Debug');
+ typeMap.set('Destroy', 'Destroy');
+
+ wasmTaskProvider = new WasmTaskProvider(typeMap, scriptMap, wamrVersion);
+
+ vscode.tasks.registerTaskProvider('wasm', wasmTaskProvider);
+
+ if (vscode.workspace.workspaceFolders?.[0]) {
+ if (osPlatform === 'win32') {
+ currentPrjDir = vscode.workspace.workspaceFolders?.[0].uri
+ .fsPath as string;
+ } else if (osPlatform === 'linux' || osPlatform === 'darwin') {
+ currentPrjDir = vscode.workspace.workspaceFolders?.[0].uri
+ .path as string;
+ }
+
+ /**
+ * check whether current project opened in vscode workspace is wasm project
+ * it not, `build`, `run` and `debug` will be disabled
+ */
+ if (currentPrjDir !== '') {
+ const wamrFolder = fileSystem
+ .readdirSync(currentPrjDir, {
+ withFileTypes: true,
+ })
+ .filter(
+ folder => folder.isDirectory() && folder.name === '.wamr'
+ );
+
+ if (wamrFolder.length !== 0) {
+ isWasmProject = true;
+ vscode.commands.executeCommand(
+ 'setContext',
+ 'ext.isWasmProject',
+ isWasmProject
+ );
+ if (
+ vscode.workspace
+ .getConfiguration()
+ .has('C_Cpp.default.systemIncludePath')
+ ) {
+ let newIncludeInCppArr: string[] | undefined | null;
+
+ newIncludeInCppArr = vscode.workspace
+ .getConfiguration()
+ .get('C_Cpp.default.systemIncludePath');
+
+ const libcBuiltinHeaderPath = path.join(
+ extensionPath,
+ 'resource/wamr-sdk/libc-builtin-sysroot/include'
+ );
+
+ if (newIncludeInCppArr !== undefined) {
+ /* in case the configuration has not been set up, push directly */
+ if (newIncludeInCppArr === null) {
+ newIncludeInCppArr = [];
+ newIncludeInCppArr.push(libcBuiltinHeaderPath);
+ } else {
+ /* if the configuration has been set up, check the condition */
+ if (
+ /* include libc-builtin-sysroot */
+ newIncludeInCppArr.indexOf(
+ libcBuiltinHeaderPath
+ ) < 0
+ ) {
+ newIncludeInCppArr.push(libcBuiltinHeaderPath);
+ }
+ }
+
+ vscode.workspace
+ .getConfiguration()
+ .update(
+ 'C_Cpp.default.systemIncludePath',
+ newIncludeInCppArr,
+ vscode.ConfigurationTarget.Workspace
+ );
+ }
+ }
+ }
+ }
+ }
+
+ /* register debug configuration */
+ wasmDebugConfigProvider = new WasmDebugConfigurationProvider();
+
+ vscode.debug.registerDebugConfigurationProvider(
+ 'wamr-debug',
+ wasmDebugConfigProvider
+ );
+
+ /* update ext.includePaths to show or hide 'Remove' button in menus */
+ vscode.commands.executeCommand('setContext', 'ext.supportedFileType', [
+ '.c',
+ '.cpp',
+ '.cxx',
+ ]);
+
+ if (readFromConfigFile() !== '') {
+ const configData = JSON.parse(readFromConfigFile());
+ includePathArr = configData['includePaths'];
+ excludeFileArr = configData['excludeFiles'];
+
+ if (Object.keys(configData['buildArgs']).length !== 0) {
+ TargetConfigPanel.buildArgs = configData['buildArgs'];
+ }
+ }
+
+ const disposableNewProj = vscode.commands.registerCommand(
+ 'wamride.newProject',
+ () => {
+ const okStr = 'Set up now';
+ const cancelStr = 'Maybe later';
+ const curWorkspace = vscode.workspace
+ .getConfiguration()
+ .get('WAMR-IDE.configWorkspace');
+
+ /* if user has not set up workspace yet, prompt to set up */
+ if (curWorkspace === '' || curWorkspace === undefined) {
+ vscode.window
+ .showWarningMessage(
+ 'Please setup your workspace firstly.',
+ okStr,
+ cancelStr
+ )
+ .then(item => {
+ if (item === okStr) {
+ vscode.commands.executeCommand(
+ 'wamride.changeWorkspace'
+ );
+ } else {
+ return;
+ }
+ });
+ } else if (!checkIfDirectoryExists(curWorkspace as string)) {
+ vscode.window
+ .showWarningMessage(
+ 'Invalid workspace:',
+ {
+ modal: true,
+ detail:
+ '' +
+ vscode.workspace
+ .getConfiguration()
+ .get('WAMR-IDE.configWorkspace') +
+ '',
+ },
+ okStr
+ )
+ .then(item => {
+ if (item === okStr) {
+ vscode.commands.executeCommand(
+ 'wamride.changeWorkspace'
+ );
+ } else {
+ return;
+ }
+ });
+ } else {
+ NewProjectPanel.render(context);
+ }
+ }
+ );
+
+ const disposableTargetConfig = vscode.commands.registerCommand(
+ 'wamride.targetConfig',
+ () => {
+ if (currentPrjDir !== '') {
+ TargetConfigPanel.render(context);
+ } else {
+ vscode.window.showWarningMessage(
+ 'Please create and open project firstly.',
+ 'OK'
+ );
+ }
+ }
+ );
+
+ const disposableChangeWorkspace = vscode.commands.registerCommand(
+ 'wamride.changeWorkspace',
+ async () => {
+ const options: vscode.OpenDialogOptions = {
+ canSelectFiles: false,
+ canSelectFolders: true,
+ openLabel: 'Select Workspace',
+ };
+
+ const workSpace = await vscode.window
+ .showOpenDialog(options)
+ .then(res => {
+ if (res) {
+ return res[0].fsPath as string;
+ } else {
+ return '';
+ }
+ });
+
+ /* update workspace value to vscode global settings */
+ if (workSpace !== '' && workSpace !== undefined) {
+ await vscode.workspace
+ .getConfiguration()
+ .update(
+ 'WAMR-IDE.configWorkspace',
+ workSpace.trim(),
+ vscode.ConfigurationTarget.Global
+ )
+ .then(
+ () => {
+ vscode.window.showInformationMessage(
+ 'Workspace has been set up successfully!'
+ );
+ },
+ () => {
+ vscode.window.showErrorMessage(
+ 'Set up Workspace failed!'
+ );
+ }
+ );
+ }
+ }
+ );
+
+ const disposableBuild = vscode.commands.registerCommand(
+ 'wamride.build',
+ async () => {
+ if (!isWasmProject) {
+ vscode.window.showErrorMessage('Build failed', {
+ modal: true,
+ detail: 'Current project is not wasm project, please open wasm project and try again.',
+ });
+ return;
+ }
+
+ try {
+ /* check if docker images are ready before building */
+ if (
+ (await checkIfDockerStarted()) &&
+ !(await checkIfDockerImagesExist(context))
+ ) {
+ /**NOTE - if users select to skip install,
+ * we should return rather than continue
+ * the execution
+ */
+ if (
+ (await promptSetupDockerImages(context)) ===
+ SelectionOfPrompt.skip
+ ) {
+ return;
+ }
+ }
+ } catch (e) {
+ vscode.window.showWarningMessage((e as Error).message);
+ return;
+ }
+
+ generateCMakeFile(includePathArr, excludeFileArr);
+ /* destroy the wasm-toolchain-ctr if it exists */
+ vscode.commands
+ .executeCommand(
+ 'workbench.action.tasks.runTask',
+ 'Destroy: Wasm-Container-Before-Build'
+ )
+ .then(() => {
+ const disposable = vscode.tasks.onDidEndTaskProcess(t => {
+ if (
+ t.execution.task.name ===
+ 'Wasm-Container-Before-Build'
+ ) {
+ if (t.exitCode !== 0) {
+ disposable.dispose();
+ return;
+ }
+
+ /* execute the build task */
+ vscode.commands
+ .executeCommand(
+ 'workbench.action.tasks.runTask',
+ 'Build: Wasm'
+ )
+ .then(() => {
+ /* destroy the wasm-toolchain-ctr after building */
+ const disposableAft =
+ vscode.tasks.onDidEndTask(a => {
+ if (
+ a.execution.task.name ===
+ 'Wasm' &&
+ a.execution.task.source ===
+ 'Build'
+ ) {
+ vscode.commands
+ .executeCommand(
+ 'workbench.action.tasks.runTask',
+ 'Destroy: Wasm-Container-After-Build'
+ )
+ .then(() => {
+ /* dispose the event after this building process
+ */
+ disposableAft.dispose();
+ });
+ }
+ });
+ });
+ /* dispose the event after this building process */
+ disposable.dispose();
+ }
+ });
+ });
+ }
+ );
+
+ const disposableDebug = vscode.commands.registerCommand(
+ 'wamride.debug',
+ async () => {
+ if (!isWasmProject) {
+ vscode.window.showErrorMessage('debug failed', {
+ modal: true,
+ detail: 'Current project is not wasm project, please open wasm project and try again.',
+ });
+ return;
+ }
+
+ /* we should check again whether the user installed lldb, as this can be skipped during activation */
+ try {
+ if (!isLLDBInstalled(context)) {
+ /**NOTE - if users select to skip install,
+ * we should return rather than continue
+ * the execution
+ */
+ if (
+ (await promptInstallLLDB(context)) ===
+ SelectionOfPrompt.skip
+ ) {
+ return;
+ }
+ }
+
+ if (
+ (await checkIfDockerStarted()) &&
+ !(await checkIfDockerImagesExist(context))
+ ) {
+ /**NOTE - save as above lldb, should return if
+ * users select to skip set up
+ */
+ if (
+ (await promptSetupDockerImages(context)) ===
+ SelectionOfPrompt.skip
+ ) {
+ return;
+ }
+ }
+ } catch (e) {
+ vscode.window.showWarningMessage((e as Error).message);
+ return;
+ }
+
+ /* refuse to debug if build process failed */
+ if (!checkIfBuildSuccess()) {
+ vscode.window.showErrorMessage('Debug failed', {
+ modal: true,
+ detail: 'Can not find WASM binary, please build WASM firstly.',
+ });
+ return;
+ }
+
+ /* show debug view */
+ vscode.commands.executeCommand('workbench.view.debug');
+
+ /* should destroy the wasm-debug-server-ctr before debugging */
+ vscode.commands
+ .executeCommand(
+ 'workbench.action.tasks.runTask',
+ 'Destroy: Wasm-Container-Before-Debug'
+ )
+ .then(() => {
+ /* execute the debug task when destroy task finish */
+ const disposableBfr = vscode.tasks.onDidEndTask(t => {
+ if (
+ t.execution.task.name ===
+ 'Wasm-Container-Before-Debug'
+ ) {
+ vscode.commands
+ .executeCommand(
+ 'workbench.action.tasks.runTask',
+ 'Debug: Wasm'
+ )
+ .then(() => {
+ vscode.debug
+ .startDebugging(
+ undefined,
+ wasmDebugConfigProvider.getDebugConfig()
+ )
+ .then(() => {
+ /* register to listen debug session finish event */
+ const disposableAft =
+ vscode.debug.onDidTerminateDebugSession(
+ s => {
+ if (
+ s.type !==
+ 'wamr-debug'
+ ) {
+ return;
+ }
+
+ /* execute the task to destroy
+ * wasm-debug-server-ctr */
+ vscode.commands.executeCommand(
+ 'workbench.action.tasks.runTask',
+ 'Destroy: Wasm-Container-After-Debug'
+ );
+
+ /* execute the task to kill the terminal */
+ vscode.commands.executeCommand(
+ 'workbench.action.terminal.kill',
+ 'Debug: Wasm'
+ );
+
+ disposableAft.dispose();
+ }
+ );
+ });
+ });
+ }
+ disposableBfr.dispose();
+ });
+ });
+ }
+ );
+
+ const disposableRun = vscode.commands.registerCommand(
+ 'wamride.run',
+ async () => {
+ if (!isWasmProject) {
+ vscode.window.showErrorMessage('run failed', {
+ modal: true,
+ detail: 'Current project is not wasm project, please open wasm project and try again.',
+ });
+ return;
+ }
+
+ try {
+ /* check if docker images are set up before building */
+ if (
+ (await checkIfDockerStarted()) &&
+ !(await checkIfDockerImagesExist(context))
+ ) {
+ await promptSetupDockerImages(context);
+ }
+ } catch (e) {
+ vscode.window.showWarningMessage((e as Error).message);
+ return;
+ }
+
+ /* refuse to debug if build process failed */
+ if (!checkIfBuildSuccess()) {
+ vscode.window.showErrorMessage('Debug failed', {
+ modal: true,
+ detail: 'Can not find WASM binary, please build WASM firstly.',
+ });
+ return;
+ }
+
+ vscode.commands
+ .executeCommand(
+ 'workbench.action.tasks.runTask',
+ 'Destroy: Wasm-Container-Before-Run'
+ )
+ .then(() => {
+ const disposableAft = vscode.tasks.onDidEndTaskProcess(
+ e => {
+ if (
+ e.execution.task.name ===
+ 'Wasm-Container-Before-Run'
+ ) {
+ /* make sure that run wasm task will be executed when destroy task finish */
+ vscode.commands
+ .executeCommand(
+ 'workbench.action.tasks.runTask',
+ 'Run: Wasm'
+ )
+ .then(() => {
+ if (e.exitCode !== 0) {
+ disposableAft.dispose();
+ return;
+ }
+ });
+ disposableAft.dispose();
+ }
+ }
+ );
+ });
+ }
+ );
+
+ const disposableToggleIncludePath = vscode.commands.registerCommand(
+ 'wamride.build.toggleStateIncludePath',
+ fileUri => {
+ const path =
+ fileUri._fsPath !== null && fileUri._fsPath !== undefined
+ ? fileUri._fsPath
+ : vscode.Uri.parse(fileUri.path as string).fsPath;
+ const pathRelative = path.replace(currentPrjDir, '..');
+
+ if (includePathArr.indexOf(pathRelative) > -1) {
+ /* this folder has been added to include path, remove it */
+ includePathArr = includePathArr.filter(value => {
+ return value !== pathRelative;
+ });
+ } else {
+ includePathArr.push(pathRelative);
+ }
+
+ writeIntoConfigFile(
+ includePathArr,
+ excludeFileArr,
+ TargetConfigPanel.buildArgs
+ );
+
+ decorationProvider.updateDecorationsForSource(fileUri);
+ }
+ );
+
+ const disposableToggleExcludeFile = vscode.commands.registerCommand(
+ 'wamride.build.toggleStateExclude',
+ fileUri => {
+ const path =
+ fileUri._fsPath !== null && fileUri._fsPath !== undefined
+ ? fileUri._fsPath
+ : vscode.Uri.parse(fileUri.path as string).fsPath;
+
+ /* replace the current project absolute path with .. to change to relative path */
+ const pathRelative = path.replace(currentPrjDir, '..');
+
+ if (excludeFileArr.indexOf(pathRelative) > -1) {
+ excludeFileArr = excludeFileArr.filter(val => {
+ return val !== pathRelative;
+ });
+ } else {
+ excludeFileArr.push(pathRelative);
+ }
+
+ writeIntoConfigFile(
+ includePathArr,
+ excludeFileArr,
+ TargetConfigPanel.buildArgs
+ );
+
+ /* update decoration for this source file */
+ decorationProvider.updateDecorationsForSource(fileUri);
+ }
+ );
+
+ const disposableOpenFolder = vscode.commands.registerCommand(
+ 'wamride.openFolder',
+ () => {
+ /* get projects list under current workspace */
+ const okStr = 'Set up now';
+ const cancelStr = 'Maybe later';
+ const createStr = 'Create now';
+ const curWorkspace = vscode.workspace
+ .getConfiguration()
+ .get('WAMR-IDE.configWorkspace') as string;
+
+ /* if user has not set up workspace yet, prompt to set up */
+ if (curWorkspace === '' || curWorkspace === undefined) {
+ vscode.window
+ .showWarningMessage(
+ 'Please setup your workspace firstly.',
+ okStr,
+ cancelStr
+ )
+ .then(item => {
+ if (item === okStr) {
+ vscode.commands.executeCommand(
+ 'wamride.changeWorkspace'
+ );
+ } else {
+ return;
+ }
+ });
+ } else if (!checkIfDirectoryExists(curWorkspace as string)) {
+ vscode.window
+ .showWarningMessage(
+ 'Invalid workspace:',
+ {
+ modal: true,
+ detail:
+ '' +
+ vscode.workspace
+ .getConfiguration()
+ .get('WAMR-IDE.configWorkspace') +
+ '',
+ },
+ okStr
+ )
+ .then(item => {
+ if (item === okStr) {
+ vscode.commands.executeCommand(
+ 'wamride.changeWorkspace'
+ );
+ } else {
+ return;
+ }
+ });
+ } else {
+ /* get all directories within directory, ignore files */
+ let directoryArrDirent, directoryArr;
+ try {
+ directoryArrDirent = fileSystem.readdirSync(curWorkspace, {
+ withFileTypes: true,
+ });
+ } catch (err) {
+ vscode.window.showErrorMessage(
+ 'Read projects from current workspace failed.'
+ );
+ }
+
+ if (directoryArrDirent !== undefined) {
+ directoryArr = directoryArrDirent
+ .filter(dirent => dirent.isDirectory())
+ .map(dirent => dirent.name);
+
+ const projFilesArr = directoryArr.filter(obj => {
+ if (checkIfWasmProj(path.join(curWorkspace, obj))) {
+ return true;
+ }
+ });
+
+ if (projFilesArr.length === 0) {
+ vscode.window
+ .showWarningMessage(
+ 'Current workspace is empty, please create your project firstly.',
+ createStr,
+ cancelStr
+ )
+ .then(item => {
+ if (item === createStr) {
+ vscode.commands.executeCommand(
+ 'wamride.newProject'
+ );
+ } else {
+ return;
+ }
+ });
+ } else {
+ vscode.window
+ .showQuickPick(projFilesArr, {
+ title: 'Select project',
+ placeHolder: 'Please select project',
+ })
+ .then(option => {
+ if (!option) {
+ return;
+ }
+
+ const path = curWorkspace.concat(
+ osPlatform === 'win32'
+ ? '\\'
+ : osPlatform === 'linux' ||
+ osPlatform === 'darwin'
+ ? '/'
+ : '',
+ option
+ );
+
+ /* open the selected wasm project */
+ openWindowWithSituation(vscode.Uri.file(path));
+ });
+ }
+ }
+ }
+ }
+ );
+
+ context.subscriptions.push(
+ disposableNewProj,
+ disposableTargetConfig,
+ disposableChangeWorkspace,
+ disposableBuild,
+ disposableRun,
+ disposableToggleIncludePath,
+ disposableOpenFolder,
+ disposableToggleExcludeFile,
+ disposableDebug
+ );
+
+ try {
+ if (!isLLDBInstalled(context)) {
+ await promptInstallLLDB(context);
+ }
+
+ if (
+ (await checkIfDockerStarted()) &&
+ !(await checkIfDockerImagesExist(context))
+ ) {
+ await promptSetupDockerImages(context);
+ }
+ } catch (e) {
+ vscode.window.showWarningMessage((e as Error).message);
+ }
+}
+
+function openWindowWithSituation(uri: vscode.Uri) {
+ /**
+ * check if the workspace folder is empty,
+ * if yes, open new window, else open in current window
+ */
+ const isWorkspaceEmpty = !vscode.workspace.workspaceFolders?.[0]
+ ? true
+ : false;
+
+ isWorkspaceEmpty === false
+ ? vscode.commands.executeCommand('vscode.openFolder', uri, {
+ forceNewWindow: true,
+ })
+ : vscode.commands.executeCommand('vscode.openFolder', uri);
+
+ return;
+}
+
+interface BuildArgs {
+ outputFileName: string;
+ initMemorySize: string;
+ maxMemorySize: string;
+ stackSize: string;
+ exportedSymbols: string;
+}
+
+/**
+ * @param: includePathArr
+ * @param: excludeFileArr
+ * Get current includePathArr and excludeFileArr from the json string that
+ * will be written into compilation_config.json
+ */
+export function writeIntoConfigFile(
+ includePathArr: string[],
+ excludeFileArr: string[],
+ buildArgs?: BuildArgs
+): void {
+ const jsonStr = JSON.stringify(
+ {
+ includePaths: includePathArr,
+ excludeFiles: excludeFileArr,
+ buildArgs: buildArgs ? buildArgs : '{}',
+ },
+ null,
+ '\t'
+ );
+
+ const prjConfigDir = path.join(currentPrjDir, '.wamr');
+ const configFilePath = path.join(prjConfigDir, 'compilation_config.json');
+ writeIntoFile(configFilePath, jsonStr);
+}
+
+export function readFromConfigFile(): string {
+ const prjConfigDir = path.join(currentPrjDir, '.wamr');
+ const configFilePath = path.join(prjConfigDir, 'compilation_config.json');
+ return readFromFile(configFilePath);
+}
+
+/**
+ * will be triggered when the user clicking `build` button
+ */
+function generateCMakeFile(
+ includePathArr: string[],
+ excludeFileArr: string[]
+): void {
+ // -Wl,--export=${EXPORT_SYMBOLS}
+ const srcFilePath = path.join(currentPrjDir, 'src');
+ const prjConfigDir = path.join(currentPrjDir, '.wamr');
+ const cmakeFilePath = path.join(prjConfigDir, 'project.cmake');
+
+ let strIncludeList = 'set (PROJECT_INCLUDES';
+ let strSrcList = 'set (PROJECT_SRC_LIST';
+
+ let strOutputFileName = 'set (OUTPUT_FILE_NAME';
+ let strInitMemSize = 'set (INIT_MEM_SIZE';
+ let strMaxMemSize = 'set (MAX_MEM_SIZE';
+ let strStackSize = 'set (STACK_SIZE';
+ let strExportedSymbols = 'set (EXPORTED_SYMBOLS';
+
+ let fullStr = '';
+ let i, s, e: number;
+
+ /* change the absolute path into relative path */
+ const _re = currentPrjDir;
+ const _substr = '${CMAKE_CURRENT_SOURCE_DIR}/..';
+
+ /**
+ * set PROJECT_SRC_LIST
+ * default ADD every c OR c++ OR cpp under the src/ path
+ * except the files saved in the excludeFiles array
+ */
+
+ const srcPathArr = getAllSrcFiles(srcFilePath);
+
+ if (srcPathArr === undefined) {
+ return;
+ }
+
+ for (s = 0; s < srcPathArr.length; s++) {
+ if (
+ excludeFileArr.indexOf(
+ srcPathArr[s].path.replace(currentPrjDir, '..')
+ ) === -1
+ ) {
+ /* replace currentPrjDir with ${CMAKE_CURRENT_SOURCE_DIR} */
+ const newStr = srcPathArr[s].path
+ .replace(_re, _substr)
+ .replace(/\\/g, '/');
+
+ strSrcList = strSrcList.concat(' ', newStr);
+ }
+ }
+ strSrcList = strSrcList.concat(' )');
+
+ for (i = 0; i < includePathArr.length; i++) {
+ const newStr = includePathArr[i]
+ .replace(/../, _substr)
+ .replace(/\\/g, '/');
+ strIncludeList = strIncludeList.concat(' ', newStr);
+ }
+ strIncludeList = strIncludeList.concat(' )');
+
+ /* set up user customized input in configBuildArgs webview */
+ strOutputFileName = strOutputFileName.concat(
+ ' ',
+ TargetConfigPanel.buildArgs.outputFileName + ')'
+ );
+
+ strInitMemSize = strInitMemSize.concat(
+ ' ',
+ TargetConfigPanel.buildArgs.initMemorySize + ')'
+ );
+
+ strMaxMemSize = strMaxMemSize.concat(
+ ' ',
+ TargetConfigPanel.buildArgs.maxMemorySize + ')'
+ );
+
+ strStackSize = strStackSize.concat(
+ ' ',
+ TargetConfigPanel.buildArgs.stackSize + ')'
+ );
+
+ const exportedSymbolArr =
+ TargetConfigPanel.buildArgs.exportedSymbols.split(',');
+
+ strExportedSymbols = strExportedSymbols.concat(' "');
+
+ for (e = 0; e < exportedSymbolArr.length; e++) {
+ strExportedSymbols = strExportedSymbols.concat(
+ ' -Wl,',
+ '--export=',
+ exportedSymbolArr[e]
+ );
+ }
+
+ strExportedSymbols = strExportedSymbols.concat('")');
+
+ fullStr = strOutputFileName
+ .concat('\n', strInitMemSize)
+ .concat('\n', strMaxMemSize)
+ .concat('\n', strStackSize)
+ .concat('\n', strExportedSymbols)
+ .concat('\n', strSrcList)
+ .concat('\n', strIncludeList);
+
+ writeIntoFile(cmakeFilePath, fullStr);
+}
+
+function getAllSrcFiles(_path: string) {
+ try {
+ const entries = fileSystem.readdirSync(_path, {
+ withFileTypes: true,
+ });
+
+ const files = entries
+ .filter(
+ /* filter files mismatch .c |.cpp |.cxx */
+ file =>
+ !file.isDirectory() && file.name.match('(.c|.cpp|.cxx)$')
+ )
+ .map(file => ({
+ path: path.join(_path, file.name),
+ }));
+
+ const folders = entries.filter(folder => folder.isDirectory());
+
+ for (const folder of folders) {
+ const fileArr = getAllSrcFiles(path.join(_path, folder.name));
+ fileArr ? files.push(...fileArr) : '';
+ }
+
+ return files;
+ } catch (error) {
+ vscode.window.showErrorMessage(error as string);
+ }
+}
+
+function checkIfBuildSuccess(): boolean {
+ try {
+ let wasmExist = false;
+ const entries = fileSystem.readdirSync(
+ path.join(currentPrjDir, 'build'),
+ {
+ withFileTypes: true,
+ }
+ );
+
+ entries.map(e => {
+ if (e.name.match('(.wasm)$')) {
+ wasmExist = true;
+ }
+ });
+
+ return wasmExist;
+ } catch {
+ return false;
+ }
+}
+
+function checkIfWasmProj(path: string): boolean {
+ try {
+ let isWasmProj = false;
+ const entries = fileSystem.readdirSync(path, {
+ withFileTypes: true,
+ });
+
+ entries.map(e => {
+ if (e.isDirectory() && e.name === '.wamr') {
+ isWasmProj = true;
+ }
+ });
+
+ return isWasmProj;
+ } catch {
+ return false;
+ }
+}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/taskProvider.ts b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/taskProvider.ts
new file mode 100644
index 000000000..9b9b75f9a
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/taskProvider.ts
@@ -0,0 +1,228 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+import * as vscode from 'vscode';
+import * as os from 'os';
+import { TargetConfigPanel } from './view/TargetConfigPanel';
+
+export interface OwnShellOption {
+ cmd: string;
+ options: vscode.ShellExecutionOptions;
+}
+
+export class WasmTaskProvider implements vscode.TaskProvider {
+ constructor(
+ public _type: Map<string, string>,
+ public _script: Map<string, string>,
+ public _wamrVersion: string
+ ) {}
+
+ buildShellOption: OwnShellOption | undefined;
+ runShellOption: OwnShellOption | undefined;
+ debugShellOption: OwnShellOption | undefined;
+ destroyShellOption: OwnShellOption | undefined;
+
+ private wasmPromise: Thenable<vscode.Task[]> | undefined = undefined;
+
+ public provideTasks(): Thenable<vscode.Task[]> | undefined {
+ if (!this.wasmPromise) {
+ /* target name is used for generated aot target */
+ const targetName =
+ TargetConfigPanel.buildArgs.outputFileName.split('.')[0];
+
+ if (
+ os.platform() === 'linux' ||
+ os.platform() === 'darwin' ||
+ os.platform() === 'win32'
+ ) {
+ /* build */
+ this.buildShellOption = {
+ cmd:
+ os.platform() === 'linux' || os.platform() === 'darwin'
+ ? 'bash'
+ : (this._script.get('buildScript') as string),
+ options: {
+ executable: this._script.get('buildScript'),
+ shellArgs: [targetName, this._wamrVersion],
+ },
+ };
+
+ /* debug */
+ this.debugShellOption = {
+ cmd:
+ os.platform() === 'linux' || os.platform() === 'darwin'
+ ? 'bash'
+ : (this._script.get('debugScript') as string),
+ options: {
+ executable: this._script.get('debugScript'),
+ shellArgs: [targetName, this._wamrVersion],
+ },
+ };
+
+ /* run */
+ this.runShellOption = {
+ cmd:
+ os.platform() === 'linux' || os.platform() === 'darwin'
+ ? 'bash'
+ : (this._script.get('runScript') as string),
+ options: {
+ executable: this._script.get('runScript'),
+ shellArgs: [targetName, this._wamrVersion],
+ },
+ };
+
+ /* destroy */
+ /* run */
+ this.destroyShellOption = {
+ cmd:
+ os.platform() === 'linux' || os.platform() === 'darwin'
+ ? 'bash'
+ : (this._script.get('destroyScript') as string),
+ options: {
+ executable: this._script.get('destroyScript'),
+ shellArgs: [targetName],
+ },
+ };
+ } else {
+ this.buildShellOption = {
+ cmd: "echo 'os platform is not supported yet'",
+ options: {},
+ };
+
+ this.debugShellOption = {
+ cmd: "echo 'os platform is not supported yet'",
+ options: {},
+ };
+
+ this.runShellOption = {
+ cmd: "echo 'os platform is not supported yet'",
+ options: {},
+ };
+
+ this.destroyShellOption = {
+ cmd: "echo 'os platform is not supported yet'",
+ options: {},
+ };
+ }
+
+ this.wasmPromise = Promise.resolve([
+ new vscode.Task(
+ { type: 'wasm' },
+ vscode.TaskScope.Workspace,
+ 'Wasm',
+ this._type.get('Build') as string,
+ new vscode.ShellExecution(
+ this.buildShellOption.cmd,
+ this.buildShellOption.options
+ )
+ ),
+
+ new vscode.Task(
+ { type: 'wasm' },
+ vscode.TaskScope.Workspace,
+ 'Wasm',
+ this._type.get('Run') as string,
+ new vscode.ShellExecution(
+ this.runShellOption.cmd,
+ this.runShellOption.options
+ )
+ ),
+
+ new vscode.Task(
+ { type: 'wasm' },
+ vscode.TaskScope.Workspace,
+ 'Wasm',
+ this._type.get('Debug') as string,
+ new vscode.ShellExecution(
+ this.debugShellOption.cmd,
+ this.debugShellOption.options
+ )
+ ),
+
+ new vscode.Task(
+ { type: 'wasm' },
+ vscode.TaskScope.Workspace,
+ 'Wasm-Container-Before-Build',
+ this._type.get('Destroy') as string,
+ new vscode.ShellExecution(
+ this.destroyShellOption.cmd,
+ this.destroyShellOption.options
+ )
+ ),
+
+ new vscode.Task(
+ { type: 'wasm' },
+ vscode.TaskScope.Workspace,
+ 'Wasm-Container-Before-Debug',
+ this._type.get('Destroy') as string,
+ new vscode.ShellExecution(
+ this.destroyShellOption.cmd,
+ this.destroyShellOption.options
+ )
+ ),
+
+ new vscode.Task(
+ { type: 'wasm' },
+ vscode.TaskScope.Workspace,
+ 'Wasm-Container-Before-Run',
+ this._type.get('Destroy') as string,
+ new vscode.ShellExecution(
+ this.destroyShellOption.cmd,
+ this.destroyShellOption.options
+ )
+ ),
+
+ new vscode.Task(
+ { type: 'wasm' },
+ vscode.TaskScope.Workspace,
+ 'Wasm-Container-After-Build',
+ this._type.get('Destroy') as string,
+ new vscode.ShellExecution(
+ this.destroyShellOption.cmd,
+ this.destroyShellOption.options
+ )
+ ),
+
+ new vscode.Task(
+ { type: 'wasm' },
+ vscode.TaskScope.Workspace,
+ 'Wasm-Container-After-Debug',
+ this._type.get('Destroy') as string,
+ new vscode.ShellExecution(
+ this.destroyShellOption.cmd,
+ this.destroyShellOption.options
+ )
+ ),
+
+ new vscode.Task(
+ { type: 'wasm' },
+ vscode.TaskScope.Workspace,
+ 'Wasm-Container-After-Run',
+ this._type.get('Destroy') as string,
+ new vscode.ShellExecution(
+ this.destroyShellOption.cmd,
+ this.destroyShellOption.options
+ )
+ ),
+ ]);
+ }
+
+ return this.wasmPromise;
+ }
+
+ /**
+ * if the task or task in tasks.json does not set command, `
+ * resolveTask` will be invoked,
+ * otherwise, `provideTasks` will be invoked
+ * @param _task
+ * @returns
+ */
+ public resolveTask(task: vscode.Task): vscode.Task | undefined {
+ if (task) {
+ return task;
+ }
+ return undefined;
+ }
+}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/utilities/directoryUtilities.ts b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/utilities/directoryUtilities.ts
new file mode 100644
index 000000000..0efbea5d9
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/utilities/directoryUtilities.ts
@@ -0,0 +1,211 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+import fileSystem = require('fs');
+import vscode = require('vscode');
+import path = require('path');
+import os = require('os');
+import request = require('request');
+import yauzl = require('yauzl');
+
+/**
+ *
+ * @param path destination path
+ */
+export function createDirectory(
+ dest: string,
+ mode: string | number | null | undefined = undefined
+): boolean {
+ try {
+ if (fileSystem.existsSync(dest)) {
+ if (fileSystem.lstatSync(dest).isDirectory()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ if (!path) {
+ return false;
+ }
+
+ const parent = path.dirname(dest);
+ if (!createDirectory(parent, mode)) {
+ return false;
+ }
+
+ fileSystem.mkdirSync(dest, mode);
+ return true;
+ } catch (error) {
+ vscode.window.showErrorMessage(error as string);
+ return false;
+ }
+}
+
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
+export function copyFiles(src: string, dest: string, flags?: number): boolean {
+ try {
+ fileSystem.copyFileSync(src, dest);
+ return true;
+ } catch (error) {
+ vscode.window.showErrorMessage(error as string);
+ return false;
+ }
+}
+
+export function writeIntoFile(path: string, data: string): void {
+ try {
+ fileSystem.writeFileSync(path, data, null);
+ } catch (err) {
+ vscode.window.showErrorMessage(err as string);
+ }
+}
+
+export function readFromFile(path: string): string {
+ try {
+ const data = fileSystem.readFileSync(path, { encoding: 'utf-8' });
+ return data as string;
+ } catch (err) {
+ vscode.window.showErrorMessage(err as string);
+ return '';
+ }
+}
+
+export function writeIntoFileAsync(
+ path: string,
+ data: string,
+ callback: fileSystem.NoParamCallback
+): void {
+ try {
+ fileSystem.writeFile(path, data, callback);
+ } catch (err) {
+ vscode.window.showErrorMessage(err as string);
+ return;
+ }
+}
+
+export function checkIfPathExists(path: string): boolean {
+ try {
+ if (fileSystem.existsSync(path)) {
+ return true;
+ } else {
+ return false;
+ }
+ } catch (err) {
+ vscode.window.showErrorMessage(err as string);
+ return false;
+ }
+}
+
+export function checkIfDirectoryExists(path: string): boolean {
+ const doesPathExist = checkIfPathExists(path);
+ if (doesPathExist) {
+ return fileSystem.lstatSync(path).isDirectory();
+ }
+ return false;
+}
+
+export function checkIfFileExists(path: string): boolean {
+ const doesPathExist = checkIfPathExists(path);
+ if (doesPathExist) {
+ return fileSystem.lstatSync(path).isFile();
+ }
+ return false;
+}
+
+export function checkFolderName(folderName: string): boolean {
+ let invalidCharacterArr: string[] = [];
+ let valid = true;
+
+ if (folderName.length > 255) {
+ valid = false;
+ }
+
+ if (os.platform() === 'win32') {
+ invalidCharacterArr = ['\\', '/', ':', '?', '*', '"', '|', '<', '>'];
+ } else if (os.platform() === 'linux' || os.platform() === 'darwin') {
+ invalidCharacterArr = ['/'];
+ }
+
+ invalidCharacterArr.forEach(function (c) {
+ if (folderName.indexOf(c) !== -1) {
+ valid = false;
+ }
+ });
+
+ return valid;
+}
+
+export function downloadFile(
+ url: string,
+ destinationPath: string
+): Promise<void> {
+ return new Promise((resolve, reject) => {
+ const file = fileSystem.createWriteStream(destinationPath);
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const stream = request(url, undefined, (error, response, body) => {
+ if (response.statusCode !== 200) {
+ reject(
+ new Error(
+ `Download from ${url} failed with ${response.statusMessage}`
+ )
+ );
+ }
+ }).pipe(file);
+ stream.on('close', resolve);
+ stream.on('error', reject);
+ });
+}
+
+export function unzipFile(
+ sourcePath: string,
+ getDestinationFileName: (entryName: string) => string
+): Promise<string[]> {
+ return new Promise((resolve, reject) => {
+ const unzippedFilePaths: string[] = [];
+ yauzl.open(
+ sourcePath,
+ { lazyEntries: true },
+ function (error, zipfile) {
+ if (error) {
+ reject(error);
+ return;
+ }
+ zipfile.readEntry();
+ zipfile.on('entry', function (entry) {
+ // This entry is a directory so skip it
+ if (/\/$/.test(entry.fileName)) {
+ zipfile.readEntry();
+ return;
+ }
+
+ zipfile.openReadStream(entry, function (error, readStream) {
+ if (error) {
+ reject(error);
+ return;
+ }
+ readStream.on('end', () => zipfile.readEntry());
+ const destinationFileName = getDestinationFileName(
+ entry.fileName
+ );
+ fileSystem.mkdirSync(
+ path.dirname(destinationFileName),
+ { recursive: true }
+ );
+
+ const file =
+ fileSystem.createWriteStream(destinationFileName);
+ readStream.pipe(file).on('error', reject);
+ unzippedFilePaths.push(destinationFileName);
+ });
+ });
+ zipfile.on('end', function () {
+ zipfile.close();
+ resolve(unzippedFilePaths);
+ });
+ }
+ );
+ });
+}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/utilities/dockerUtilities.ts b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/utilities/dockerUtilities.ts
new file mode 100644
index 000000000..0a749ba19
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/utilities/dockerUtilities.ts
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+import * as vscode from 'vscode';
+import * as cp from 'child_process';
+import * as path from 'path';
+import * as fs from 'fs';
+import { getWAMRExtensionVersion } from './lldbUtilities';
+import { downloadFile, unzipFile } from './directoryUtilities';
+import { SelectionOfPrompt, Status } from '../constants';
+
+const DOCKER_IMAGES_TEM_FOLDER_NAME = 'docker-resource';
+
+type SelectionStatus = SelectionOfPrompt | Status;
+
+const execShell = (cmd: string) =>
+ new Promise<string>((resolve, reject) => {
+ cp.exec(cmd, (error, result) => {
+ if (error) {
+ return reject(error);
+ }
+ return resolve(result);
+ });
+ });
+
+export async function promptSetupDockerImages(
+ context: vscode.ExtensionContext
+): Promise<SelectionStatus> {
+ const extensionPath = context.extensionPath;
+ const response = await vscode.window.showWarningMessage(
+ 'Necessary docker images are not found. Setup now?',
+ SelectionOfPrompt.setUp,
+ SelectionOfPrompt.skip
+ );
+
+ if (response === SelectionOfPrompt.skip) {
+ return response;
+ }
+
+ const downloadUrlArray = getDockerImagesDownloadUrl(context);
+
+ const destinationFolder = path.resolve(
+ extensionPath,
+ 'resource',
+ DOCKER_IMAGES_TEM_FOLDER_NAME
+ );
+
+ if (!fs.existsSync(destinationFolder)) {
+ fs.mkdirSync(destinationFolder);
+ }
+
+ vscode.window.showInformationMessage(`Downloading Docker Images...`);
+
+ for (const url of downloadUrlArray) {
+ const imageZipName = path.basename(url);
+ const imageStorePath = path.join(destinationFolder, imageZipName);
+ await downloadFile(url, imageStorePath);
+
+ /**
+ * extract docker image tar package to
+ * '${destinationFolder}'
+ */
+ const dockerImageFile = await unzipFile(imageStorePath, filename =>
+ path.join(destinationFolder, filename)
+ );
+ /* give access before loading */
+ dockerImageFile.forEach(file => fs.chmodSync(file, '0775'));
+
+ /**NOTE - load docker image tar package to host
+ * right now there are just one file
+ * `docker-image-name.tar` inside so we can
+ * directly use files[0] here, should be modified
+ * if the package's files change
+ */
+ await execShell(`docker load -i ${dockerImageFile[0]}`);
+ }
+
+ /* remove the DOCKER_IMAGES_TEM_FOLDER */
+ fs.rmSync(destinationFolder, { recursive: true, force: true });
+
+ vscode.window.showInformationMessage(
+ `Docker images are ready, please run '$docker images' to check.`
+ );
+
+ return Status.done;
+}
+
+export async function checkIfDockerStarted(): Promise<boolean> {
+ try {
+ await execShell('docker images');
+ return true;
+ } catch (e) {
+ vscode.window.showWarningMessage((e as Error).message);
+ return false;
+ }
+}
+
+export async function checkIfDockerImagesExist(
+ context: vscode.ExtensionContext
+): Promise<boolean> {
+ try {
+ /* the tag of images is equal to extension's version */
+ const imageTag = getWAMRExtensionVersion(context);
+ await execShell(
+ `docker image inspect wasm-debug-server:${imageTag} wasm-toolchain:${imageTag}`
+ );
+ return true;
+ } catch (e) {
+ return false;
+ }
+}
+
+function getDockerImagesDownloadUrl(
+ context: vscode.ExtensionContext
+): string[] {
+ const wamrVersion = getWAMRExtensionVersion(context);
+ const wamrReleaseUrl = `https://github.com/bytecodealliance/wasm-micro-runtime/releases/download/WAMR`;
+
+ return [
+ `${wamrReleaseUrl}-${wamrVersion}/wasm-debug-server-${wamrVersion}.zip`,
+ `${wamrReleaseUrl}-${wamrVersion}/wasm-toolchain-${wamrVersion}.zip`,
+ ];
+}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/utilities/getUri.ts b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/utilities/getUri.ts
new file mode 100644
index 000000000..93a7eef30
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/utilities/getUri.ts
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+import { Uri, Webview } from 'vscode';
+
+export function getUri(
+ webview: Webview,
+ extensionUri: Uri,
+ pathList: string[]
+): Uri {
+ return webview.asWebviewUri(Uri.joinPath(extensionUri, ...pathList));
+}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/utilities/lldbUtilities.ts b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/utilities/lldbUtilities.ts
new file mode 100644
index 000000000..9170a75d3
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/utilities/lldbUtilities.ts
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2022 Amazon.com Inc. or its affiliates. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+import * as vscode from 'vscode';
+import * as os from 'os';
+import * as path from 'path';
+import * as fs from 'fs';
+import {
+ checkIfFileExists,
+ downloadFile,
+ unzipFile,
+} from './directoryUtilities';
+import { SelectionOfPrompt } from '../constants';
+
+const LLDB_RESOURCE_DIR = 'resource/debug';
+const LLDB_OS_DOWNLOAD_URL_SUFFIX_MAP: Partial<
+ Record<NodeJS.Platform, string>
+> = {
+ linux: 'x86_64-ubuntu-20.04',
+ darwin: 'universal-macos-latest',
+};
+
+const WAMR_LLDB_NOT_SUPPORTED_ERROR = new Error(
+ 'WAMR LLDB is not supported on this platform'
+);
+
+function getLLDBUnzipFilePath(destinationFolder: string, filename: string) {
+ const dirs = filename.split('/');
+ if (dirs[0] === 'wamr-lldb') {
+ dirs.shift();
+ }
+
+ return path.join(destinationFolder, ...dirs);
+}
+
+export function getWAMRExtensionVersion(
+ context: vscode.ExtensionContext
+): string {
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
+ return require(path.join(context.extensionPath, 'package.json')).version;
+}
+
+function getLLDBDownloadUrl(context: vscode.ExtensionContext): string {
+ const wamrVersion = getWAMRExtensionVersion(context);
+ const lldbOsUrlSuffix = LLDB_OS_DOWNLOAD_URL_SUFFIX_MAP[os.platform()];
+
+ if (!lldbOsUrlSuffix) {
+ throw WAMR_LLDB_NOT_SUPPORTED_ERROR;
+ }
+
+ return `https://github.com/bytecodealliance/wasm-micro-runtime/releases/download/WAMR-${wamrVersion}/wamr-lldb-${wamrVersion}-${lldbOsUrlSuffix}.zip`;
+}
+
+export function isLLDBInstalled(context: vscode.ExtensionContext): boolean {
+ const extensionPath = context.extensionPath;
+ const lldbOSDir = os.platform();
+ const lldbBinaryPath = path.join(
+ extensionPath,
+ LLDB_RESOURCE_DIR,
+ lldbOSDir,
+ 'bin',
+ 'lldb'
+ );
+ return checkIfFileExists(lldbBinaryPath);
+}
+
+export async function promptInstallLLDB(
+ context: vscode.ExtensionContext
+): Promise<SelectionOfPrompt> {
+ const extensionPath = context.extensionPath;
+
+ const response = await vscode.window.showWarningMessage(
+ 'No LLDB instance found. Setup now?',
+ SelectionOfPrompt.setUp,
+ SelectionOfPrompt.skip
+ );
+
+ if (response === SelectionOfPrompt.skip) {
+ return response;
+ }
+
+ const downloadUrl = getLLDBDownloadUrl(context);
+ const destinationDir = os.platform();
+
+ if (!downloadUrl) {
+ throw WAMR_LLDB_NOT_SUPPORTED_ERROR;
+ }
+
+ const lldbDestinationFolder = path.join(
+ extensionPath,
+ LLDB_RESOURCE_DIR,
+ destinationDir
+ );
+ const lldbZipPath = path.join(lldbDestinationFolder, 'bundle.zip');
+
+ vscode.window.showInformationMessage(`Downloading LLDB...`);
+
+ await downloadFile(downloadUrl, lldbZipPath);
+
+ vscode.window.showInformationMessage(
+ `LLDB downloaded to ${lldbZipPath}. Installing...`
+ );
+
+ const lldbFiles = await unzipFile(lldbZipPath, filename =>
+ getLLDBUnzipFilePath(lldbDestinationFolder, filename)
+ );
+ // Allow execution of lldb
+ lldbFiles.forEach(file => fs.chmodSync(file, '0775'));
+
+ vscode.window.showInformationMessage(
+ `LLDB installed at ${lldbDestinationFolder}`
+ );
+
+ // Remove the bundle.zip
+ fs.unlinkSync(lldbZipPath);
+ return SelectionOfPrompt.setUp;
+}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/view/NewProjectPanel.ts b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/view/NewProjectPanel.ts
new file mode 100644
index 000000000..79671f68c
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/view/NewProjectPanel.ts
@@ -0,0 +1,260 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+import * as vscode from 'vscode';
+import * as path from 'path';
+import * as fs from 'fs';
+import * as os from 'os';
+import {
+ createDirectory,
+ copyFiles,
+ checkFolderName,
+} from '../utilities/directoryUtilities';
+import { getUri } from '../utilities/getUri';
+
+export class NewProjectPanel {
+ public static userSetWorkSpace: string;
+ public static currentPanel: NewProjectPanel | undefined;
+ private readonly viewPanel: vscode.WebviewPanel;
+ private disposableArr: vscode.Disposable[] = [];
+
+ private static readonly executionSuccess = 0;
+ private static readonly dirExistedError = -1;
+ private static readonly userInputError = -2;
+ private static readonly dirPathInvalidError = -3;
+
+ constructor(extensionUri: vscode.Uri, panel: vscode.WebviewPanel) {
+ this.viewPanel = panel;
+ this.viewPanel.webview.html = this.getHtmlForWebview(
+ this.viewPanel.webview,
+ extensionUri,
+ 'resource/webview/page/newProject.html'
+ );
+ this._setWebviewMessageListener(this.viewPanel.webview, extensionUri);
+ this.viewPanel.onDidDispose(this.dispose, null, this.disposableArr);
+ }
+
+ public static render(context: vscode.ExtensionContext): void {
+ NewProjectPanel.userSetWorkSpace = vscode.workspace
+ .getConfiguration()
+ .get('WAMR-IDE.configWorkspace') as string;
+
+ /* check if current panel is initialized */
+ if (NewProjectPanel.currentPanel) {
+ NewProjectPanel.currentPanel.viewPanel.reveal(
+ vscode.ViewColumn.One
+ );
+ } else {
+ const panel = vscode.window.createWebviewPanel(
+ 'newProject',
+ 'Create project',
+ vscode.ViewColumn.One,
+ {
+ enableScripts: true,
+ retainContextWhenHidden: true,
+ }
+ );
+
+ NewProjectPanel.currentPanel = new NewProjectPanel(
+ context.extensionUri,
+ panel
+ );
+ }
+ }
+
+ private createNewProject(
+ projName: string,
+ template: string,
+ extensionUri: vscode.Uri
+ ): number {
+ if (projName === '' || template === '') {
+ return NewProjectPanel.userInputError;
+ }
+
+ if (!checkFolderName(projName)) {
+ return NewProjectPanel.dirPathInvalidError;
+ }
+
+ const ROOT_PATH = path.join(NewProjectPanel.userSetWorkSpace, projName);
+ const EXT_PATH = extensionUri.fsPath;
+
+ if (fs.existsSync(ROOT_PATH)) {
+ if (fs.lstatSync(ROOT_PATH).isDirectory()) {
+ return NewProjectPanel.dirExistedError;
+ }
+ }
+
+ createDirectory(path.join(ROOT_PATH, '.wamr'));
+ createDirectory(path.join(ROOT_PATH, 'include'));
+ createDirectory(path.join(ROOT_PATH, 'src'));
+
+ copyFiles(
+ path.join(EXT_PATH, 'resource/scripts/CMakeLists.txt'),
+ path.join(ROOT_PATH, '.wamr/CMakeLists.txt')
+ );
+
+ copyFiles(
+ path.join(EXT_PATH, 'resource/scripts/project.cmake'),
+ path.join(ROOT_PATH, '.wamr/project.cmake')
+ );
+
+ return NewProjectPanel.executionSuccess;
+ }
+
+ public getHtmlForWebview(
+ webview: vscode.Webview,
+ extensionUri: vscode.Uri,
+ templatePath: string
+ ): string {
+ const toolkitUri = getUri(webview, extensionUri, [
+ 'node_modules',
+ '@vscode',
+ 'webview-ui-toolkit',
+ 'dist',
+ 'toolkit.js',
+ ]);
+
+ const styleUri = getUri(webview, extensionUri, [
+ 'resource',
+ 'webview',
+ 'css',
+ 'style.css',
+ ]);
+
+ const mainUri = getUri(webview, extensionUri, [
+ 'resource',
+ 'webview',
+ 'js',
+ 'newproj.js',
+ ]);
+
+ const resourcePath = path.join(extensionUri.fsPath, templatePath);
+ let html = fs.readFileSync(resourcePath, 'utf-8');
+ html = html
+ .replace(/(\${toolkitUri})/, toolkitUri.toString())
+ .replace(/(\${mainUri})/, mainUri.toString())
+ .replace(/(\${styleUri})/, styleUri.toString());
+
+ return html;
+ }
+
+ private _setWebviewMessageListener(
+ webview: vscode.Webview,
+ extensionUri: vscode.Uri
+ ) {
+ webview.onDidReceiveMessage(
+ message => {
+ switch (message.command) {
+ case 'create_new_project':
+ const createNewProjectStatus = this.createNewProject(
+ message.projectName,
+ message.template,
+ extensionUri
+ );
+ if (
+ createNewProjectStatus ===
+ NewProjectPanel.executionSuccess
+ ) {
+ webview.postMessage({
+ command: 'proj_creation_finish',
+ prjName: message.projectName,
+ });
+ } else if (
+ createNewProjectStatus ===
+ NewProjectPanel.dirExistedError
+ ) {
+ vscode.window.showErrorMessage(
+ 'Project : ' +
+ message.projectName +
+ ' exists in your current root path, please change project name or root path!'
+ );
+ return;
+ } else if (
+ createNewProjectStatus ===
+ NewProjectPanel.userInputError
+ ) {
+ vscode.window.showErrorMessage(
+ 'Please fill chart before your submit!'
+ );
+ return;
+ } else if (
+ createNewProjectStatus ===
+ NewProjectPanel.dirPathInvalidError
+ ) {
+ if (os.platform() === 'win32') {
+ vscode.window.showErrorMessage(
+ "A file name can't contain any of the following characters: ' / \\ : * ? < > | ' and the length should be less than 255"
+ );
+ } else if (
+ os.platform() === 'linux' ||
+ os.platform() === 'darwin'
+ ) {
+ vscode.window.showErrorMessage(
+ "A file name can't contain following characters: '/' and the length should be less than 255"
+ );
+ }
+ return;
+ }
+ return;
+
+ case 'open_project':
+ vscode.window.showInformationMessage(
+ 'Project : ' +
+ message.projectName +
+ ' will be opened!'
+ );
+
+ const projPath = path.join(
+ NewProjectPanel.userSetWorkSpace,
+ message.projectName
+ );
+ const uri = vscode.Uri.file(projPath);
+
+ /**
+ * check if the vscode workspace folder is empty,
+ * if yes, open new window, else open in current window
+ */
+ const isWorkspaceEmpty = !vscode.workspace
+ .workspaceFolders?.[0]
+ ? true
+ : false;
+ isWorkspaceEmpty === false
+ ? vscode.commands.executeCommand(
+ 'vscode.openFolder',
+ uri,
+ {
+ forceNewWindow: true,
+ }
+ )
+ : vscode.commands.executeCommand(
+ 'vscode.openFolder',
+ uri
+ );
+
+ case 'close_webview':
+ this.viewPanel.dispose();
+ return;
+
+ default:
+ break;
+ }
+ },
+ undefined,
+ this.disposableArr
+ );
+ }
+
+ private dispose() {
+ NewProjectPanel.currentPanel = undefined;
+ this.viewPanel.dispose();
+
+ while (this.disposableArr.length) {
+ const disposable = this.disposableArr.pop();
+ if (disposable) {
+ disposable.dispose();
+ }
+ }
+ }
+}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/view/TargetConfigPanel.ts b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/view/TargetConfigPanel.ts
new file mode 100644
index 000000000..f2e1343a5
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/src/view/TargetConfigPanel.ts
@@ -0,0 +1,238 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+import * as vscode from 'vscode';
+import * as path from 'path';
+import * as fs from 'fs';
+import { readFromConfigFile, writeIntoConfigFile } from '../extension';
+import { getUri } from '../utilities/getUri';
+
+export class TargetConfigPanel {
+ public static currentPanel: TargetConfigPanel | undefined;
+ private readonly viewPanel: vscode.WebviewPanel;
+
+ private _disposables: vscode.Disposable[] = [];
+ public static buildArgs = {
+ outputFileName: 'main.wasm',
+ initMemorySize: '131072',
+ maxMemorySize: '131072',
+ stackSize: '4096',
+ exportedSymbols: 'main',
+ };
+
+ private static readonly userInputError: number = -2;
+ private static readonly executionSuccess: number = 0;
+
+ /**
+ *
+ * @param context extension context from extension.ts active func
+ * @param panelName
+ */
+ constructor(panel: vscode.WebviewPanel, extensionUri: vscode.Uri) {
+ this.viewPanel = panel;
+ this.viewPanel.webview.html = this._getHtmlForWebview(
+ this.viewPanel.webview,
+ extensionUri,
+ 'resource/webview/page/configBuildTarget.html'
+ );
+ this.viewPanel.onDidDispose(this.dispose, null, this._disposables);
+ this._setWebviewMessageListener(this.viewPanel.webview);
+ }
+
+ /**
+ *
+ * @param context
+ */
+ public static render(context: vscode.ExtensionContext): void {
+ /* check if current panel is initialized */
+ if (TargetConfigPanel.currentPanel) {
+ TargetConfigPanel.currentPanel.viewPanel.reveal(
+ vscode.ViewColumn.One
+ );
+ } else {
+ const panel = vscode.window.createWebviewPanel(
+ 'targetConfig',
+ 'Config building target',
+ vscode.ViewColumn.One,
+ {
+ enableScripts: true,
+ retainContextWhenHidden: true,
+ }
+ );
+
+ TargetConfigPanel.currentPanel = new TargetConfigPanel(
+ panel,
+ context.extensionUri
+ );
+ }
+ }
+
+ private configBuildArgs(
+ outputFileName: string,
+ initMemSize: string,
+ maxMemSize: string,
+ stackSize: string,
+ exportedSymbols: string
+ ): number {
+ if (
+ outputFileName === '' ||
+ initMemSize === '' ||
+ maxMemSize === '' ||
+ stackSize === '' ||
+ exportedSymbols === ''
+ ) {
+ return TargetConfigPanel.userInputError;
+ }
+
+ let includePathArr = [];
+ let excludeFileArr = [];
+
+ const configObj = {
+ outputFileName: outputFileName,
+ initMemorySize: initMemSize,
+ maxMemorySize: maxMemSize,
+ stackSize: stackSize,
+ exportedSymbols: exportedSymbols,
+ };
+ const configStr = readFromConfigFile();
+
+ TargetConfigPanel.buildArgs = configObj;
+
+ if (configStr !== '' && configStr !== undefined) {
+ const configJson = JSON.parse(configStr);
+ includePathArr =
+ configJson['includePaths'] === undefined
+ ? []
+ : configJson['includePaths'];
+ excludeFileArr =
+ configJson['excludeFiles'] === undefined
+ ? []
+ : configJson['excludeFiles'];
+ }
+
+ writeIntoConfigFile(
+ includePathArr,
+ excludeFileArr,
+ TargetConfigPanel.buildArgs
+ );
+
+ return TargetConfigPanel.executionSuccess;
+ }
+
+ private _getHtmlForWebview(
+ webview: vscode.Webview,
+ extensionUri: vscode.Uri,
+ templatePath: string
+ ) {
+ /* get toolkit uri */
+ const toolkitUri = getUri(webview, extensionUri, [
+ 'node_modules',
+ '@vscode',
+ 'webview-ui-toolkit',
+ 'dist',
+ 'toolkit.js',
+ ]);
+
+ const styleUri = getUri(webview, extensionUri, [
+ 'resource',
+ 'webview',
+ 'css',
+ 'style.css',
+ ]);
+
+ const mainUri = getUri(webview, extensionUri, [
+ 'resource',
+ 'webview',
+ 'js',
+ 'configbuildtarget.js',
+ ]);
+
+ const resourcePath = path.join(extensionUri.fsPath, templatePath);
+ let html = fs.readFileSync(resourcePath, 'utf-8');
+ html = html
+ .replace(/(\${toolkitUri})/, toolkitUri.toString())
+ .replace(/(\${mainUri})/, mainUri.toString())
+ .replace(/(\${styleUri})/, styleUri.toString())
+ .replace(
+ /(\${output_file_val})/,
+ TargetConfigPanel.buildArgs.outputFileName
+ )
+ .replace(
+ /(\${initial_mem_size_val})/,
+ TargetConfigPanel.buildArgs.initMemorySize
+ )
+ .replace(
+ /(\${max_mem_size_val})/,
+ TargetConfigPanel.buildArgs.maxMemorySize
+ )
+ .replace(
+ /(\${stack_size_val})/,
+ TargetConfigPanel.buildArgs.stackSize
+ )
+ .replace(
+ /(\${exported_symbols_val})/,
+ TargetConfigPanel.buildArgs.exportedSymbols
+ );
+
+ return html;
+ }
+
+ private _setWebviewMessageListener(webview: vscode.Webview) {
+ webview.onDidReceiveMessage(
+ message => {
+ switch (message.command) {
+ case 'config_build_target':
+ if (
+ message.outputFileName === '' ||
+ message.initMemSize === '' ||
+ message.maxMemSize === '' ||
+ message.stackSize === '' ||
+ message.exportedSymbols === ''
+ ) {
+ vscode.window.showErrorMessage(
+ 'Please fill chart before your submit!'
+ );
+ return;
+ } else if (
+ this.configBuildArgs(
+ message.outputFileName,
+ message.initMemSize,
+ message.maxMemSize,
+ message.stackSize,
+ message.exportedSymbols
+ ) === TargetConfigPanel.executionSuccess
+ ) {
+ vscode.window
+ .showInformationMessage(
+ 'Configurations have been saved!',
+ 'OK'
+ )
+ .then(() => {
+ this.viewPanel.dispose();
+ return;
+ });
+ }
+
+ default:
+ break;
+ }
+ },
+ undefined,
+ this._disposables
+ );
+ }
+
+ private dispose() {
+ TargetConfigPanel.currentPanel = undefined;
+ this.viewPanel.dispose();
+
+ while (this._disposables.length) {
+ const disposable = this._disposables.pop();
+ if (disposable) {
+ disposable.dispose();
+ }
+ }
+ }
+}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/tsconfig.json b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/tsconfig.json
new file mode 100644
index 000000000..c75039eee
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/VSCode-Extension/tsconfig.json
@@ -0,0 +1,16 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "outDir": "out",
+ "lib": ["es6"],
+ "sourceMap": true,
+ "rootDir": "src",
+ "strict": true /* enable all strict type-checking options */
+ /* Additional Checks */
+ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
+ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
+ // "noUnusedParameters": true, /* Report errors on unused parameters. */
+ },
+ "exclude": ["node_modules", ".vscode-test"]
+}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/Dockerfile b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/Dockerfile
new file mode 100644
index 000000000..8165bd5f5
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/Dockerfile
@@ -0,0 +1,30 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+FROM gcc:12.2.0 AS BASE
+
+## set work directory
+WORKDIR /root/
+COPY resource /root/
+
+# hadolint ignore=DL3008
+RUN apt-get update \
+ && apt-get -y install make cmake --no-install-recommends
+
+## -clone wamr-repo and build iwasm
+RUN git clone -b main --depth=1 https://github.com/bytecodealliance/wasm-micro-runtime.git \
+ && mkdir -p /root/wasm-micro-runtime/product-mini/platforms/linux/build
+
+WORKDIR /root/wasm-micro-runtime/product-mini/platforms/linux/build
+RUN cmake .. -DWAMR_BUILD_DEBUG_INTERP=1 \
+ && make \
+ && cp /root/wasm-micro-runtime/product-mini/platforms/linux/build/iwasm /root/iwasm \
+ && rm -fr /root/wasm-micro-runtime
+
+FROM ubuntu:22.04
+# COPY files from BASE image
+COPY --from=BASE /root/iwasm /root
+COPY --from=BASE /root/debug.sh /root
+COPY --from=BASE /root/run.sh /root
+
+WORKDIR /root/ \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/README.md b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/README.md
new file mode 100644
index 000000000..b4738e867
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/README.md
@@ -0,0 +1,20 @@
+### Build Docker Image
+
+- Linux
+
+ ```shell
+ ./build_docker_image.sh
+ ```
+
+- Windows
+
+ ```shell
+ ./build_docker_image.bat
+ ```
+
+
+### Resource Details
+
+- `Dockerflie` is the source file to build `wasm-debug-server` docker image
+- `resource/debug.sh` is the script to execute the wasm app in debug mod, will start up the debugger server inside of the `iwasm` and hold to wait for connecting.
+- `resource/run.sh` is the script to execute the wasm app directly.
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/build_docker_image.bat b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/build_docker_image.bat
new file mode 100644
index 000000000..2861105bd
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/build_docker_image.bat
@@ -0,0 +1,8 @@
+@REM Copyright (C) 2019 Intel Corporation. All rights reserved.
+@REM SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+@echo off
+docker build -t wasm-debug-server:1.0 .
+
+@REM delete intermediate docker image
+docker image prune -f \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/build_docker_image.sh b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/build_docker_image.sh
new file mode 100755
index 000000000..6beedd6df
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/build_docker_image.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+docker build -t wasm-debug-server:1.0 .
+
+# delete intermediate docker image
+docker image prune -f
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/resource/debug.sh b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/resource/debug.sh
new file mode 100755
index 000000000..48458870f
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/resource/debug.sh
@@ -0,0 +1,6 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+#!/bin/bash
+TARGET=$1
+./iwasm -g=0.0.0.0:1234 /mnt/build/${TARGET}.wasm \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/resource/run.sh b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/resource/run.sh
new file mode 100755
index 000000000..4e3acecba
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Debug-Server/Docker/resource/run.sh
@@ -0,0 +1,6 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+#!/bin/bash
+TARGET=$1
+./iwasm /mnt/build/${TARGET}.wasm \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/.dockerignore b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/.dockerignore
new file mode 100644
index 000000000..920e09905
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/.dockerignore
@@ -0,0 +1,4 @@
+# remove unnecessary files here to save build time cost and image size
+*.md
+*.sh
+*.bat \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/Dockerfile b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/Dockerfile
new file mode 100644
index 000000000..cd8da38d9
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/Dockerfile
@@ -0,0 +1,71 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+## Build docker image that consists of gcc, cmake, wasi-sdk & zephyr sdk
+FROM gcc:12.2.0 AS BASE
+
+## set work directory
+WORKDIR /root/
+
+COPY resource /root/
+
+# - download cmake with wget and set up
+# hadolint ignore=DL3008
+RUN apt-get update \
+ && apt-get -y install ccache ninja-build make cmake python3-pip --no-install-recommends
+
+# set compilation environment for wamrc
+# - wamr repo
+# - cmake
+# - wasi-sdk
+# - wamr-sdk
+
+# - download wasi-sdk with wget and set up to /opt/wasi-sdk
+RUN wget --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-linux.tar.gz \
+ && tar -zxf wasi-sdk-*-linux.tar.gz \
+ && mv wasi-sdk-19.0 /opt/wasi-sdk/ \
+ && rm -f wasi-sdk-*-linux.tar.gz
+
+## - clone wamr repo
+RUN git clone -b main --depth=1 https://github.com/bytecodealliance/wasm-micro-runtime.git
+
+WORKDIR /root/wasm-micro-runtime/build-scripts
+RUN pip3 install --no-cache-dir --user -r requirements.txt
+
+WORKDIR /root/wasm-micro-runtime/wamr-compiler
+RUN ./build_llvm.sh \
+ && mkdir build
+
+WORKDIR /root/wasm-micro-runtime/wamr-compiler/build
+RUN cmake .. \
+ && make \
+ # - copy the wamrc to /root
+ && cp /root/wasm-micro-runtime/wamr-compiler/build/wamrc /root/wamrc \
+ && mkdir -p /opt/wamr-sdk \
+ && cp -r /root/wasm-micro-runtime/wamr-sdk/app /opt/wamr-sdk/ \
+ && mv /root/wamr_toolchain.cmake /opt/wamr-sdk/app \
+ # - remove the wamr repo to save the size
+ && rm -fr /root/wasm-micro-runtime
+
+# ## STAGE 2
+FROM ubuntu:22.04
+ENV HOME_DIR=/home/wasm-toolchain
+
+RUN mkdir -p /opt/wasi-sdk \
+ && mkdir -p /opt/wamr-sdk/app \
+ && mkdir -p /home/wasm-toolchain
+
+# COPY files from BASE image
+COPY --from=BASE /opt/wamr-sdk/app/ /opt/wamr-sdk/app/
+COPY --from=BASE /opt/wasi-sdk /opt/wasi-sdk/
+COPY --from=BASE /root/wamrc ${HOME_DIR}
+COPY --from=BASE /root/build_wasm.sh ${HOME_DIR}
+
+RUN ln -s ${HOME_DIR}/wamrc /usr/bin/wamrc
+
+# hadolint ignore=DL3008
+RUN apt-get update && apt-get install -y cmake make --no-install-recommends \
+ && apt-get clean -y \
+ && rm -rf /var/lib/apt/lists/*
+
+WORKDIR ${HOME_DIR}
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/README.md b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/README.md
new file mode 100644
index 000000000..f5ecb957e
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/README.md
@@ -0,0 +1,18 @@
+### Build Docker Image
+
+- Linux
+
+ ```shell
+ ./build_docker_image.sh
+ ```
+
+- Windows
+
+ ```shell
+ ./build_docker_image.bat
+ ```
+
+### Resource Details
+
+- `Dockerflie` is the source file to build `wasm-debug-server` docker image.
+- `resource/build_wasm.sh` is the script to compile the wasm app with `wasi-sdk`.
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/build_docker_image.bat b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/build_docker_image.bat
new file mode 100644
index 000000000..96fb02879
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/build_docker_image.bat
@@ -0,0 +1,9 @@
+@REM Copyright (C) 2019 Intel Corporation. All rights reserved.
+@REM SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+@echo off
+
+docker build -t wasm-toolchain:1.0 .
+
+@REM delete intermediate docker image
+docker image prune -f
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/build_docker_image.sh b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/build_docker_image.sh
new file mode 100755
index 000000000..aa1e2f5e4
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/build_docker_image.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+docker build -t wasm-toolchain:1.0 .
+
+# delete intermediate docker image
+docker image prune -f
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/resource/build_wasm.sh b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/resource/build_wasm.sh
new file mode 100755
index 000000000..3d8c06c4d
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/resource/build_wasm.sh
@@ -0,0 +1,25 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+#!/bin/bash
+export CC=/opt/wasi-sdk/bin/clang
+export CXX=/opt/wasi-sdk/bin/clang++
+
+cd /mnt
+if [ -d build ];then
+ rm -fr build
+fi
+
+mkdir -p build && cd build
+echo "========> compile wasm with wasi-sdk"
+cmake -DWASI_SDK_DIR=/opt/wasi-sdk -DCMAKE_TOOLCHAIN_FILE=/opt/wamr-sdk/app/wamr_toolchain.cmake ../.wamr && make
+
+if [ $? -eq 0 ]; then
+ echo "========> compile wasm to AoT with wamrc"
+ # target name will be provided:
+ # - user input the target name in IDE
+ # - generated wasm binary name will be set as user's input target name
+ # - aot binary name should be the same as wasm binary name
+ # - target name will be provided through 1st parameter
+ wamrc -o $1.aot $1.wasm
+fi \ No newline at end of file
diff --git a/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/resource/wamr_toolchain.cmake b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/resource/wamr_toolchain.cmake
new file mode 100755
index 000000000..97b82cc90
--- /dev/null
+++ b/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/test-tools/wamr-ide/WASM-Toolchain/Docker/resource/wamr_toolchain.cmake
@@ -0,0 +1,33 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+SET (CMAKE_SYSTEM_NAME Linux)
+SET (CMAKE_SYSTEM_PROCESSOR wasm32)
+SET (CMAKE_SYSROOT ${CMAKE_CURRENT_LIST_DIR}/libc-builtin-sysroot)
+
+IF (NOT (DEFINED WASI_SDK_DIR OR DEFINED CACHE{WASI_SDK_DIR}))
+ SET (WASI_SDK_DIR "/opt/wasi-sdk")
+ELSE ()
+ MESSAGE (STATUS "WASI_SDK_DIR=${WASI_SDK_DIR}")
+ LIST (APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES "WASI_SDK_DIR")
+ENDIF ()
+
+
+SET (CMAKE_C_FLAGS "-nostdlib" CACHE INTERNAL "")
+SET (CMAKE_C_COMPILER_TARGET "wasm32")
+SET (CMAKE_C_COMPILER "${WASI_SDK_DIR}/bin/clang")
+
+SET (CMAKE_CXX_FLAGS "-nostdlib" CACHE INTERNAL "")
+SET (CMAKE_CXX_COMPILER_TARGET "wasm32")
+SET (CMAKE_CXX_COMPILER "${WASI_SDK_DIR}/bin/clang++")
+
+SET (CMAKE_EXE_LINKER_FLAGS
+ "-Wl,--no-entry,--fatal-warnings" CACHE INTERNAL "")
+
+SET (CMAKE_LINKER "${WASI_SDK_DIR}/bin/wasm-ld" CACHE INTERNAL "")
+SET (CMAKE_AR "${WASI_SDK_DIR}/bin/llvm-ar" CACHE INTERNAL "")
+SET (CMAKE_NM "${WASI_SDK_DIR}/bin/llvm-nm" CACHE INTERNAL "")
+SET (CMAKE_OBJDUMP "${WASI_SDK_DIR}/bin/llvm-dwarfdump" CACHE INTERNAL "")
+SET (CMAKE_RANLIB "${WASI_SDK_DIR}/bin/llvm-ranlib" CACHE INTERNAL "")
+SET (CMAKE_EXE_LINKER_FLAGS
+ "${CMAKE_EXE_LINKER_FLAGS},--allow-undefined-file=${CMAKE_SYSROOT}/share/defined-symbols.txt" CACHE INTERNAL "") \ No newline at end of file