Replace cargo-web with wasm-pack on build environment

This commit is contained in:
Kitaiti Makoto 2021-02-12 03:37:37 +09:00
parent 0bcf063b05
commit affe24b9c6
7 changed files with 11 additions and 11 deletions

View file

@ -168,7 +168,7 @@ jobs:
steps: steps:
- restore_env: - restore_env:
cache: <<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>> cache: <<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
- 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: - run_with_coverage:
cmd: | cmd: |
cmd="cargo install --debug --no-default-features --features="${FEATURES}",test --force --path . -j" cmd="cargo install --debug --no-default-features --features="${FEATURES}",test --force --path . -j"
@ -203,7 +203,7 @@ jobs:
steps: steps:
- restore_env: - restore_env:
cache: release-<<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>> cache: release-<<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
- run: cargo web deploy -p plume-front --release - run: RUSTFLAGS="--cfg=web_sys_unstable_apis" wasm-pack build --target web --release plume-front
- build: - build:
package: plume package: plume
release: true release: true

View file

@ -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 rustup component add rust-std --target wasm32-unknown-unknown
#compile some deps #compile some deps
RUN cargo install cargo-web &&\ RUN cargo install wasm-pack &&\
cargo install grcov &&\ cargo install grcov &&\
strip /root/.cargo/bin/* &&\ strip /root/.cargo/bin/* &&\
rm -fr ~/.cargo/registry rm -fr ~/.cargo/registry

View file

@ -19,7 +19,7 @@ RUN chmod a+x ./wasm-deps.sh && sleep 1 && ./wasm-deps.sh
WORKDIR /app WORKDIR /app
COPY Cargo.toml Cargo.lock rust-toolchain ./ COPY Cargo.toml Cargo.lock rust-toolchain ./
RUN cargo install cargo-web RUN cargo install wasm-pack
COPY . . COPY . .

View file

@ -20,7 +20,7 @@ RUN chmod a+x ./wasm-deps.sh && sleep 1 && ./wasm-deps.sh
WORKDIR /app WORKDIR /app
COPY Cargo.toml Cargo.lock rust-toolchain ./ COPY Cargo.toml Cargo.lock rust-toolchain ./
RUN cargo install diesel_cli --no-default-features --features postgres --version '=1.3.0' 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 . . COPY . .

4
script/plume-front.sh Normal file → Executable file
View file

@ -21,7 +21,7 @@ EOF
if [ $ARCH == "aarch64" -o $ARCH == "armv71" ] ; then if [ $ARCH == "aarch64" -o $ARCH == "armv71" ] ; then
export PATH=/opt/local/llvm/bin:${PATH} export PATH=/opt/local/llvm/bin:${PATH}
cd /app 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 else
cargo web deploy -p plume-front RUSTFLAGS="--cfg=web_sys_unstable_apis" wasm-pack build --target web --release plume-front
fi fi

View file

@ -9,7 +9,7 @@ pkg="$4"
build () { build () {
features="$1" features="$1"
cargo clean 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}" --package=plume-cli
cargo build --release --no-default-features --features="${features}" cargo build --release --no-default-features --features="${features}"
./script/generate_artifact.sh ./script/generate_artifact.sh

View file

@ -38,17 +38,17 @@ parts:
snapcraftctl set-version $(git describe --tags) snapcraftctl set-version $(git describe --tags)
export PATH=$PATH:$HOME/.cargo/bin export PATH=$PATH:$HOME/.cargo/bin
rustup install stable rustup install stable
cargo +stable install --force cargo-web cargo +stable install --force wasm-pack
# Only Tier 1 Rust platforms get rust-lld # Only Tier 1 Rust platforms get rust-lld
# On the others (arm64, armhf, powerpc64, s390x) fall back to using # On the others (arm64, armhf, powerpc64, s390x) fall back to using
# the system LLD we've installed earlier. # the system LLD we've installed earlier.
case ${SNAPCRAFT_ARCH_TRIPLET} in \ case ${SNAPCRAFT_ARCH_TRIPLET} in \
aarch64-linux-gnu|arm-linux-gnueabihf|powerpc64-linux-gnu|s390x-linux-gnu) \ 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 esac