mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
Replace tools directory with cargo-make
This commit is contained in:
parent
66ff777e1e
commit
ff642df404
21
.github/workflows/rust.yml
vendored
21
.github/workflows/rust.yml
vendored
@ -79,12 +79,11 @@ jobs:
|
|||||||
~/.cargo/.crates*
|
~/.cargo/.crates*
|
||||||
target/
|
target/
|
||||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
- name: Prepare Rust Toolchain # This is required because we are recompiling the stdlib
|
- name: Install cargo-make
|
||||||
run: |
|
run: |
|
||||||
rustup install nightly-2022-04-04-x86_64-unknown-linux-gnu
|
cargo install cargo-make
|
||||||
rustup component add rust-src --toolchain nightly-2022-04-04-x86_64-unknown-linux-gnu
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: tools/build-android
|
run: cargo make --no-workspace build-apk
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: mapr.apk
|
name: mapr.apk
|
||||||
@ -110,14 +109,13 @@ jobs:
|
|||||||
~/.cargo/.crates*
|
~/.cargo/.crates*
|
||||||
target/
|
target/
|
||||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
- name: Prepare Rust Toolchain # This is required because we are recompiling the stdlib
|
- name: Install cargo-make
|
||||||
run: |
|
run: |
|
||||||
rustup install nightly-2022-04-04-x86_64-unknown-linux-gnu
|
cargo install cargo-make
|
||||||
rustup component add rust-src --toolchain nightly-2022-04-04-x86_64-unknown-linux-gnu
|
|
||||||
- name: NPM Install
|
- name: NPM Install
|
||||||
run: npm install
|
run: npm install
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run webgl-production-build
|
run: cargo make --cwd ../ --no-workspace build-webpack-webgl-production
|
||||||
- name: Deploy to maxammann.org
|
- name: Deploy to maxammann.org
|
||||||
env:
|
env:
|
||||||
SSH_KEY: ${{ secrets.SSH_KEY_MAXAMMANN_ORG }}
|
SSH_KEY: ${{ secrets.SSH_KEY_MAXAMMANN_ORG }}
|
||||||
@ -147,14 +145,13 @@ jobs:
|
|||||||
~/.cargo/.crates*
|
~/.cargo/.crates*
|
||||||
target/
|
target/
|
||||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
- name: Prepare Rust Toolchain # This is required because we are recompiling the stdlib
|
- name: Install cargo-make
|
||||||
run: |
|
run: |
|
||||||
rustup install nightly-2022-04-04-x86_64-unknown-linux-gnu
|
cargo install cargo-make
|
||||||
rustup component add rust-src --toolchain nightly-2022-04-04-x86_64-unknown-linux-gnu
|
|
||||||
- name: NPM Install
|
- name: NPM Install
|
||||||
run: npm install
|
run: npm install
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run production-build
|
run: cargo make --cwd ../ --no-workspace build-webpack-production
|
||||||
- name: Deploy to maxammann.org
|
- name: Deploy to maxammann.org
|
||||||
env:
|
env:
|
||||||
SSH_KEY: ${{ secrets.SSH_KEY_MAXAMMANN_ORG }}
|
SSH_KEY: ${{ secrets.SSH_KEY_MAXAMMANN_ORG }}
|
||||||
|
|||||||
12
Cargo.lock
generated
12
Cargo.lock
generated
@ -1777,7 +1777,6 @@ dependencies = [
|
|||||||
"reqwest-middleware-cache",
|
"reqwest-middleware-cache",
|
||||||
"rstar 0.9.2",
|
"rstar 0.9.2",
|
||||||
"style-spec",
|
"style-spec",
|
||||||
"test-env-log",
|
|
||||||
"tilejson-spec",
|
"tilejson-spec",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
@ -3040,17 +3039,6 @@ dependencies = [
|
|||||||
"winapi-util",
|
"winapi-util",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "test-env-log"
|
|
||||||
version = "0.2.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "877189d680101869f65ef94168105d6c188b3a143c13a2d42cf8a09c4c704f8a"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "textwrap"
|
name = "textwrap"
|
||||||
version = "0.11.0"
|
version = "0.11.0"
|
||||||
|
|||||||
@ -104,8 +104,6 @@ include_dir = "0.7.2"
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
criterion = "0.3"
|
criterion = "0.3"
|
||||||
# Support logging in tests
|
|
||||||
test-env-log = "0.2"
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
wgsl-validate = { path = "./libs/wgsl_validate" }
|
wgsl-validate = { path = "./libs/wgsl_validate" }
|
||||||
|
|||||||
113
Makefile.toml
Normal file
113
Makefile.toml
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
[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" ]
|
||||||
@ -1,31 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
run=false
|
|
||||||
|
|
||||||
TEMP=$(getopt --long -o "g" "$@")
|
|
||||||
eval set -- "$TEMP"
|
|
||||||
while true; do
|
|
||||||
case "$1" in
|
|
||||||
-g)
|
|
||||||
run=true
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "ANDROID_HOME: $ANDROID_HOME"
|
|
||||||
echo "ANDROID_SDK_ROOT: $ANDROID_SDK_ROOT"
|
|
||||||
echo "ANDROID_NDK_ROOT: $ANDROID_NDK_ROOT"
|
|
||||||
|
|
||||||
cargo install cargo-apk
|
|
||||||
|
|
||||||
if [ "$run" = true ] ; then
|
|
||||||
# -Zbuild-std is required for latest NDK: https://github.com/rust-windowing/android-ndk-rs/pull/189
|
|
||||||
cargo +nightly-2022-04-04 apk run --lib -Zbuild-std
|
|
||||||
else
|
|
||||||
cargo +nightly-2022-04-04 apk build --lib -Zbuild-std
|
|
||||||
fi
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
webgl_flag=""
|
|
||||||
|
|
||||||
TEMP=$(getopt --long -o "g" "$@")
|
|
||||||
eval set -- "$TEMP"
|
|
||||||
while true; do
|
|
||||||
case "$1" in
|
|
||||||
-g)
|
|
||||||
webgl_flag="web-webgl,"
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
export RUSTUP_TOOLCHAIN=nightly-2022-04-04-x86_64-unknown-linux-gnu
|
|
||||||
|
|
||||||
rustup component add rust-src --toolchain nightly-2022-04-04-x86_64-unknown-linux-gnu
|
|
||||||
|
|
||||||
function plain_build() {
|
|
||||||
cargo build --features "$webgl_flag" --target wasm32-unknown-unknown -Z build-std=std,panic_abort
|
|
||||||
# TODO: Untested: --reference-types
|
|
||||||
wasm-bindgen --target web --out-dir dist/mapr-pain-bindgen target/wasm32-unknown-unknown/debug/mapr.wasm
|
|
||||||
}
|
|
||||||
|
|
||||||
function wasm_pack_build() {
|
|
||||||
~/Downloads/wasm-pack-v0.10.1-x86_64-unknown-linux-musl/wasm-pack build . \
|
|
||||||
--release --target web --out-dir dist/mapr -- \
|
|
||||||
--features "$webgl_flag" -Z build-std=std,panic_abort
|
|
||||||
}
|
|
||||||
|
|
||||||
wasm_pack_build
|
|
||||||
|
|
||||||
#xdg-open "https://localhost:5555/web/mapr.html"
|
|
||||||
#python3 tools/tls-http-server.py
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
Loading…
x
Reference in New Issue
Block a user