Switch to just

This commit is contained in:
Maximilian Ammann 2022-04-18 20:57:56 +02:00
parent 332074bfad
commit 04aece9ebc
6 changed files with 96 additions and 151 deletions

View File

@ -79,11 +79,10 @@ jobs:
~/.cargo/.crates*
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install cargo-make
run: |
cargo install cargo-make
- name: Install just
run: cargo install just
- name: Build
run: cargo make --no-workspace build-apk
run: just build-apk
- uses: actions/upload-artifact@v2
with:
name: mapr.apk
@ -109,13 +108,10 @@ jobs:
~/.cargo/.crates*
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install cargo-make
run: |
cargo install cargo-make
- name: NPM Install
run: npm install
- name: Install just
run: cargo install just
- name: Build
run: cargo make --cwd ../ --no-workspace build-webpack-webgl-production
run: just build-webpack-webgl-production
- name: Deploy to maxammann.org
env:
SSH_KEY: ${{ secrets.SSH_KEY_MAXAMMANN_ORG }}
@ -145,13 +141,10 @@ jobs:
~/.cargo/.crates*
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install cargo-make
run: |
cargo install cargo-make
- name: NPM Install
run: npm install
- name: Install just
run: cargo install just
- name: Build
run: cargo make --cwd ../ --no-workspace build-webpack-production
run: just build-webpack-production
- name: Deploy to maxammann.org
env:
SSH_KEY: ${{ secrets.SSH_KEY_MAXAMMANN_ORG }}

View File

@ -1,17 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Pack WASM (WebGL) (Release)" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="$PROJECT_DIR$/tools/build-web" />
<option name="SCRIPT_OPTIONS" value="-g" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="/bin/zsh" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<option name="EXECUTE_SCRIPT_FILE" value="true" />
<envs />
<method v="2" />
</configuration>
</component>

View File

@ -2,13 +2,13 @@
<configuration default="false" name="Pack WASM (WebGPU) (Release)" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="$PROJECT_DIR$/tools/build-web" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="SCRIPT_PATH" value="$PROJECT_DIR$/justfile" />
<option name="SCRIPT_OPTIONS" value="build-wasm-bindgen" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="/bin/zsh" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="INTERPRETER_PATH" value="/usr/bin/env" />
<option name="INTERPRETER_OPTIONS" value="just --justfile" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<option name="EXECUTE_SCRIPT_FILE" value="true" />
<envs />

1
.idea/vcs.xml generated
View File

@ -2,6 +2,5 @@
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/libs/vector_tile/spec" vcs="Git" />
</component>
</project>

View File

@ -1,113 +0,0 @@
[config]
skip_core_tasks = true
[tasks.format]
install_crate = "rustfmt"
command = "cargo"
args = ["fmt", "--all", "--"]
[tasks.clippy]
command = "cargo"
args = ["clippy", "--all-targets", "--all-features"]
[tasks.build-webpack-webgl-production]
cwd = "./web"
toolchain = "nightly-2022-04-04"
install_crate = { rustup_component_name = "rust-src" }
command = "npm"
args = ["run", "webgl-production-build"]
[tasks.build-webpack-production]
cwd = "./web"
toolchain = "nightly-2022-04-04"
install_crate = { rustup_component_name = "rust-src" }
command = "npm"
args = ["run", "production-build"]
[tasks.wasm-pack-webgl]
script_runner = "bash"
# language=bash
script = '''
./wasm-pack-v0.10.1-x86_64-unknown-linux-musl/wasm-pack build . \
--release --target web --out-dir dist/mapr -- \
--features "web-webgl" -Z build-std=std,panic_abort
'''
[tasks.wasm-pack]
script_runner = "bash"
# language=bash
script = '''
./wasm-pack-v0.10.1-x86_64-unknown-linux-musl/wasm-pack build . \
--release --target web --out-dir dist/mapr -- \
-Z build-std=std,panic_abort
'''
[tasks.build-web-webgl]
toolchain = "nightly-2022-04-04"
install_crate = { rustup_component_name = "rust-src" }
command = "cargo"
# -Zbuild-std is required for shared memory/atomics support
args = ["build", "--features", "web-webgl", "--target", "wasm32-unknown-unknown", "-Z", "build-std=std,panic_abort"]
run_task = "wasm-bindgen"
[tasks.build-web]
toolchain = "nightly-2022-04-04"
install_crate = { rustup_component_name = "rust-src" }
command = "cargo"
# -Zbuild-std is required for shared memory/atomics support
args = ["build", "--target", "wasm32-unknown-unknown", "-Z", "build-std=std,panic_abort"]
run_task = "wasm-bindgen"
[tasks.wasm-bindgen]
script_runner = "bash"
# language=bash
script = '''
# TODO: Untested: --reference-types
wasm-bindgen --target web --out-dir dist/mapr-pain-bindgen target/wasm32-unknown-unknown/debug/mapr.wasm
'''
[tasks.extract-tiles]
script_runner = "bash"
# language=bash
script = '''
if ! command -v tilelive-copy &> /dev/null
then
echo "tilelive-copy could not be found. Install it with 'yarn global add @mapbox/tilelive @mapbox/mbtiles'"
exit 1
fi
# Bounds copied from https://boundingbox.klokantech.com/
tilelive-copy \
--minzoom=12 --maxzoom=12 \
--bounds="11.395769,48.083436,11.618242,48.220866" \
test-data/europe_germany-2020-02-13-openmaptiles-v3.12.1.mbtiles test-data/munich-12.mbtiles
tilelive-copy \
--minzoom=15 --maxzoom=15 \
--bounds="11.395769,48.083436,11.618242,48.220866" \
test-data/europe_germany-2020-02-13-openmaptiles-v3.12.1.mbtiles test-data/munich-15.mbtiles
'''
[tasks.print-android-env]
script_runner = "bash"
# language=bash
script = '''
echo "ANDROID_HOME: $ANDROID_HOME"
echo "ANDROID_SDK_ROOT: $ANDROID_SDK_ROOT"
echo "ANDROID_NDK_ROOT: $ANDROID_NDK_ROOT"
'''
[tasks.build-apk]
toolchain = "nightly-2022-04-04"
install_crate = { rustup_component_name = "rust-src" }
command = "cargo"
# -Zbuild-std is required for latest NDK: https://github.com/rust-windowing/android-ndk-rs/pull/189
args = ["apk", "run", "--lib", "-Zbuild-std"]
dependencies = [ "print-android-env" ]
[tasks.run-apk]
toolchain = "nightly-2022-04-04"
install_crate = { rustup_component_name = "rust-src" }
command = "cargo"
args = ["apk", "build", "--lib", "-Zbuild-std"]
dependencies = [ "print-android-env" ]

83
justfile Normal file
View File

@ -0,0 +1,83 @@
#!/usr/bin/env just --justfile
# ^ A shebang isn't required, but allows a justfile to be executed
# like a script, with `./justfile test`, for example.
export RUSTUP_TOOLCHAIN := "nightly-2022-04-04-x86_64-unknown-linux-gnu"
test:
cargo test
clippy:
cargo clippy --all-targets --all-features
fmt:
cargo fmt --all --
nightly-toolchain:
rustup install $RUSTUP_TOOLCHAIN
rustup component add rust-src --toolchain $RUSTUP_TOOLCHAIN
webpack-webgl-production: nightly-toolchain
cd web && npm install && npm run webgl-production-build
webpack-production: nightly-toolchain
cd web && npm install && npm run production-build
wasm-pack-webgl: nightly-toolchain
./wasm-pack-v0.10.1-x86_64-unknown-linux-musl/wasm-pack build . \
--release --target web --out-dir dist/mapr -- \
--features "web-webgl" -Z build-std=std,panic_abort
wasm-pack: nightly-toolchain
./wasm-pack-v0.10.1-x86_64-unknown-linux-musl/wasm-pack build . \
--release --target web --out-dir dist/mapr -- \
-Z build-std=std,panic_abort
build-web-webgl: nightly-toolchain
cargo build --features web-webgl --target wasm32-unknown-unknown -Z build-std=std,panic_abort
build-web: nightly-toolchain
cargo build --features "" --target wasm32-unknown-unknown -Z build-std=std,panic_abort
wasm-bindgen:
cargo install wasm-bindgen-cli
# TODO: Untested: --reference-types
wasm-bindgen --target web --out-dir dist/mapr-pain-bindgen target/wasm32-unknown-unknown/debug/mapr.wasm
build-wasm-bindgen: build-web wasm-bindgen
build-wasm-bindgen-webgpu: build-web wasm-bindgen
install-cargo-apk:
cargo install cargo-apk
run-apk: nightly-toolchain install-cargo-apk
cargo apk run --lib -Zbuild-std
build-apk: nightly-toolchain install-cargo-apk
cargo apk build --lib -Zbuild-std
# language=bash
print-android-env:
echo "ANDROID_HOME: $ANDROID_HOME"
echo "ANDROID_SDK_ROOT: $ANDROID_SDK_ROOT"
echo "ANDROID_NDK_ROOT: $ANDROID_NDK_ROOT"
# language=bash
extract-tiles:
#!/usr/bin/env bash
set -euxo pipefail
if ! command -v tilelive-copy &> /dev/null
then
echo "tilelive-copy could not be found. Install it with 'yarn global add @mapbox/tilelive @mapbox/mbtiles'"
exit 1
fi
# Bounds copied from https://boundingbox.klokantech.com/
tilelive-copy \
--minzoom=12 --maxzoom=12 \
--bounds="11.395769,48.083436,11.618242,48.220866" \
test-data/europe_germany-2020-02-13-openmaptiles-v3.12.1.mbtiles test-data/munich-12.mbtiles
tilelive-copy \
--minzoom=15 --maxzoom=15 \
--bounds="11.395769,48.083436,11.618242,48.220866" \
test-data/europe_germany-2020-02-13-openmaptiles-v3.12.1.mbtiles test-data/munich-15.mbtiles