From 94ccbd6190a296074b7c931d42bf97f0fb97b597 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sat, 13 Feb 2021 22:53:09 +0900 Subject: [PATCH] Move Rust flag for plume-front to .cargo/config.toml from env var --- .cargo/config.toml | 10 ++++++++++ .circleci/config.yml | 3 +-- script/plume-front.sh | 4 ++-- script/prebuild.sh | 2 +- snap/snapcraft.yaml | 4 ++-- 5 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..d8bb9aa4 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,10 @@ +[target.wasm32-unknown-unknown] +# required for clippy +rustflags = [ + "--cfg", "web_sys_unstable_apis", +] + +[target.x86_64-unknown-linux-gnu] +rustflags = [ + "--cfg", "web_sys_unstable_apis", +] diff --git a/.circleci/config.yml b/.circleci/config.yml index 4b2c40d4..cd7f2d06 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -22,7 +22,6 @@ executors: FEATURES: <<#parameters.postgres>>postgres<><<^parameters.postgres>>sqlite<> DATABASE_URL: <<#parameters.postgres>>postgres://postgres@localhost/plume<><<^parameters.postgres>>plume.sqlite<> ROCKET_SECRET_KEY: VN5xV1DN7XdpATadOCYcuGeR/dV0hHfgx9mx9TarLdM= - RUSTFLAGS: --cfg=web_sys_unstable_apis commands: @@ -73,7 +72,7 @@ commands: type: string steps: - run: | - export RUSTFLAGS="-Zprofile -Zfewer-names -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Clink-arg=-Xlinker -Clink-arg=--no-keep-memory -Clink-arg=-Xlinker -Clink-arg=--reduce-memory-overheads $RUSTFLAGS" + export RUSTFLAGS="-Zprofile -Zfewer-names -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Clink-arg=-Xlinker -Clink-arg=--no-keep-memory -Clink-arg=-Xlinker -Clink-arg=--reduce-memory-overheads" export CARGO_INCREMENTAL=0 << parameters.cmd >> diff --git a/script/plume-front.sh b/script/plume-front.sh index 92714b5e..63b2f5dd 100755 --- 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 --cfg=web_sys_unstable_apis" wasm-pack build --target web --release plume-front + RUSTFLAGS="-C linker=lld" wasm-pack build --target web --release plume-front else - RUSTFLAGS="--cfg=web_sys_unstable_apis" wasm-pack build --target web --release plume-front + wasm-pack build --target web --release plume-front fi diff --git a/script/prebuild.sh b/script/prebuild.sh index d1e56411..4e575809 100755 --- a/script/prebuild.sh +++ b/script/prebuild.sh @@ -9,7 +9,7 @@ pkg="$4" build () { features="$1" cargo clean - RUSTFLAGS="--cfg=web_sys_unstable_apis" wasm-pack build --target web --release plume-front + 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 53262116..d480fc0d 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -45,10 +45,10 @@ parts: # 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 --cfg=web_sys_unstable_apis" wasm-pack build --target web --release plume-front \ + RUSTFLAGS="-C linker=lld" wasm-pack build --target web --release plume-front \ ;; \ *) \ - RUSTFLAGS="--cfg=web_sys_unstable_apis" wasm-pack build --target web --release plume-front \ + wasm-pack build --target web --release plume-front \ ;; \ esac