From 93fb574ef7d68b3afda0939346a17fb4a063d367 Mon Sep 17 00:00:00 2001 From: James Sturtevant Date: Thu, 6 Jun 2024 15:18:56 -0700 Subject: [PATCH] Remove the emscripten compiler and rely on wasi-sdk Signed-off-by: James Sturtevant --- .github/actions/install-wasi-sdk/action.yml | 2 +- .github/workflows/main.yml | 14 +------------- crates/csharp/README.txt | 21 +++++++++++---------- crates/csharp/src/csproj.rs | 8 +++++--- 4 files changed, 18 insertions(+), 27 deletions(-) diff --git a/.github/actions/install-wasi-sdk/action.yml b/.github/actions/install-wasi-sdk/action.yml index 9c55fda52..48c4be0a3 100644 --- a/.github/actions/install-wasi-sdk/action.yml +++ b/.github/actions/install-wasi-sdk/action.yml @@ -15,7 +15,7 @@ runs: if: runner.os == 'macOS' shell: bash - run: | - curl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/wasi-sdk-22.0.m-mingw.tar.gz -L | tar xzvf - + curl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/wasi-sdk-22.0.m-mingw64.tar.gz -L | tar xzvf - echo "WASI_SDK_PATH=`pwd`/wasi-sdk-22.0+m" >> $GITHUB_ENV if: runner.os == 'Windows' shell: bash diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fa77b3849..6d7c3d85c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -80,12 +80,6 @@ jobs: echo $LOCALAPPDATA'\Microsoft\dotnet' >> $GITHUB_PATH echo $LOCALAPPDATA'\Microsoft\dotnet\tools' >> $GITHUB_PATH $LOCALAPPDATA/Microsoft/dotnet/dotnet --info - echo nativeaot-llvm requires emscripten for its version of clang as wasi-sdk 20 does not work see https://github.com/WebAssembly/wasi-sdk/issues/326 - curl.exe -OL https://github.com/emscripten-core/emsdk/archive/refs/heads/main.zip - unzip main.zip - cd emsdk-main - ./emsdk.bat install 3.1.47 - ./emsdk.bat activate 3.1.47 if : matrix.os == 'windows-latest' - run: ci/download-teavm.sh @@ -103,14 +97,8 @@ jobs: - uses: acifani/setup-tinygo@v2 with: tinygo-version: 0.31.0 - - name: All but Windows, cargo test --workspace - if : matrix.os != 'windows-latest' + - name: cargo test --workspace run: cargo test --workspace - - name: Windows, set EMSDK and run cargo test - if : matrix.os == 'windows-latest' - run: | - source ./emsdk-main/emsdk_env.sh - cargo test --workspace check: name: Check diff --git a/crates/csharp/README.txt b/crates/csharp/README.txt index 1f04c809c..49eb7f886 100644 --- a/crates/csharp/README.txt +++ b/crates/csharp/README.txt @@ -1,15 +1,16 @@ -// generate the c# and the component meta module +## generate the c# and the component module -cargo run c-sharp --string-encoding utf8 --out-dir testing-csharp tests/codegen/floats.wit +The following will generate the c# code given a wit file: -// to run the runtime tests with Native AOT, you need some additional set up +```bash +cargo run c-sharp --string-encoding utf8 --out-dir testing-csharp tests/codegen/floats.wit +``` -// install emscripten -curl.exe -OL https://github.com/emscripten-core/emsdk/archive/refs/heads/main.zip -unzip main.zip -cd .\emsdk-main\main\emsdk-main -.\emsdk_env.ps1 activate 3.1.23 --permanant +## Setup +To run the runtime tests with Native AOT, you need some additional set up +```bash // install wasi-sdk and set env -curl.exe -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/wasi-sdk-22.0.m-mingw.tar.gz | tar xzvf - -$env:WASI_SDK_PATH="c:\users\jstur\wasi-sdk-22.0+m\" \ No newline at end of file +curl.exe -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/wasi-sdk-22.0.m-mingw64.tar.gz | tar xzvf - +$env:WASI_SDK_PATH="c:\users\jstur\wasi-sdk-22.0+m\" +``` \ No newline at end of file diff --git a/crates/csharp/src/csproj.rs b/crates/csharp/src/csproj.rs index df7bf438e..e6f62e10d 100644 --- a/crates/csharp/src/csproj.rs +++ b/crates/csharp/src/csproj.rs @@ -104,8 +104,10 @@ impl CSProjectLLVMBuilder { - + + "#, ); @@ -115,7 +117,7 @@ impl CSProjectLLVMBuilder { Inputs=\"$(MSBuildProjectDirectory)/{camel}_cabi_realloc.c\" Outputs=\"$(MSBuildProjectDirectory)/{camel}_cabi_realloc.o\" > - + " ));