From affe24b9c669c12a247dd5f0f34b46fac42b9573 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Fri, 12 Feb 2021 03:37:37 +0900 Subject: [PATCH] Replace cargo-web with wasm-pack on build environment --- .circleci/config.yml | 4 ++-- .circleci/images/plume-buildenv/Dockerfile | 2 +- Dockerfile | 2 +- Dockerfile.dev | 2 +- script/plume-front.sh | 4 ++-- script/prebuild.sh | 2 +- snap/snapcraft.yaml | 6 +++--- 7 files changed, 11 insertions(+), 11 deletions(-) mode change 100644 => 100755 script/plume-front.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 87d2e802..77db838b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -168,7 +168,7 @@ jobs: steps: - restore_env: cache: <<#parameters.postgres>>postgres<><<^parameters.postgres>>sqlite<> - - run: cargo web deploy -p plume-front + - run: RUSTFLAGS="--cfg=web_sys_unstable_apis" wasm-pack build --target web --release plume-front - run_with_coverage: cmd: | cmd="cargo install --debug --no-default-features --features="${FEATURES}",test --force --path . -j" @@ -203,7 +203,7 @@ jobs: steps: - restore_env: cache: release-<<#parameters.postgres>>postgres<><<^parameters.postgres>>sqlite<> - - run: cargo web deploy -p plume-front --release + - run: RUSTFLAGS="--cfg=web_sys_unstable_apis" wasm-pack build --target web --release plume-front - build: package: plume release: true diff --git a/.circleci/images/plume-buildenv/Dockerfile b/.circleci/images/plume-buildenv/Dockerfile index a16a081d..98a3cc65 100644 --- a/.circleci/images/plume-buildenv/Dockerfile +++ b/.circleci/images/plume-buildenv/Dockerfile @@ -16,7 +16,7 @@ RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2021-0 rustup component add rust-std --target wasm32-unknown-unknown #compile some deps -RUN cargo install cargo-web &&\ +RUN cargo install wasm-pack &&\ cargo install grcov &&\ strip /root/.cargo/bin/* &&\ rm -fr ~/.cargo/registry diff --git a/Dockerfile b/Dockerfile index e0bc20df..f6196e73 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ RUN chmod a+x ./wasm-deps.sh && sleep 1 && ./wasm-deps.sh WORKDIR /app COPY Cargo.toml Cargo.lock rust-toolchain ./ -RUN cargo install cargo-web +RUN cargo install wasm-pack COPY . . diff --git a/Dockerfile.dev b/Dockerfile.dev index 2b67c186..89b9fe16 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -20,7 +20,7 @@ RUN chmod a+x ./wasm-deps.sh && sleep 1 && ./wasm-deps.sh WORKDIR /app COPY Cargo.toml Cargo.lock rust-toolchain ./ RUN cargo install diesel_cli --no-default-features --features postgres --version '=1.3.0' -RUN cargo install cargo-web +RUN cargo install wasm-pack COPY . . diff --git a/script/plume-front.sh b/script/plume-front.sh old mode 100644 new mode 100755 index 8568e076..92714b5e --- a/script/plume-front.sh +++ b/script/plume-front.sh @@ -21,7 +21,7 @@ EOF if [ $ARCH == "aarch64" -o $ARCH == "armv71" ] ; then export PATH=/opt/local/llvm/bin:${PATH} cd /app - RUSTFLAGS="-C linker=lld" cargo web deploy -p plume-front + RUSTFLAGS="-C linker=lld --cfg=web_sys_unstable_apis" wasm-pack build --target web --release plume-front else - cargo web deploy -p plume-front + RUSTFLAGS="--cfg=web_sys_unstable_apis" wasm-pack build --target web --release plume-front fi diff --git a/script/prebuild.sh b/script/prebuild.sh index 4b020d82..d1e56411 100755 --- a/script/prebuild.sh +++ b/script/prebuild.sh @@ -9,7 +9,7 @@ pkg="$4" build () { features="$1" cargo clean - cargo web deploy -p plume-front --release + RUSTFLAGS="--cfg=web_sys_unstable_apis" wasm-pack build --target web --release plume-front cargo build --release --no-default-features --features="${features}" --package=plume-cli cargo build --release --no-default-features --features="${features}" ./script/generate_artifact.sh diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index b36a97d2..53262116 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -38,17 +38,17 @@ parts: snapcraftctl set-version $(git describe --tags) export PATH=$PATH:$HOME/.cargo/bin rustup install stable - cargo +stable install --force cargo-web + cargo +stable install --force wasm-pack # Only Tier 1 Rust platforms get rust-lld # On the others (arm64, armhf, powerpc64, s390x) fall back to using # the system LLD we've installed earlier. case ${SNAPCRAFT_ARCH_TRIPLET} in \ aarch64-linux-gnu|arm-linux-gnueabihf|powerpc64-linux-gnu|s390x-linux-gnu) \ - RUSTFLAGS="-C linker=lld-8" cargo web deploy -p plume-front --release \ + RUSTFLAGS="-C linker=lld --cfg=web_sys_unstable_apis" wasm-pack build --target web --release plume-front \ ;; \ *) \ - cargo web deploy -p plume-front --release \ + RUSTFLAGS="--cfg=web_sys_unstable_apis" wasm-pack build --target web --release plume-front \ ;; \ esac