From e082082c32a3d9ea8afcf1d3bfc5085777715137 Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Sun, 17 May 2020 09:25:44 -0700 Subject: [PATCH] try again to bundle importer in release for oneshot. disable gdal. [rebuild] --- .github/workflows/main.yml | 18 ++++++++++++------ import.sh | 2 +- importer/Cargo.toml | 6 +++++- importer/src/main.rs | 3 +++ importer/src/seattle.rs | 1 + release/build.sh | 7 +++++-- release/finalize.sh | 2 ++ 7 files changed, 29 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4182f6fcdc..3e0fdd63ea 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,10 +9,12 @@ jobs: - uses: hecrj/setup-rust-action@v1 with: rust-version: 1.43.0 - - name: Run build + - name: Build game run: cargo build --release --bin game + - name: Build importer + run: cargo build --release --bin importer - name: Package release - run: ./release/build.sh abst_windows play_abstreet.bat target/release/game.exe + run: ./release/build.sh abst_windows play_abstreet.bat target/release/game.exe target/release/importer.exe - name: Upload binary uses: actions/upload-artifact@v1 with: @@ -26,10 +28,12 @@ jobs: - uses: hecrj/setup-rust-action@v1 with: rust-version: 1.43.0 - - name: Run build + - name: Build game run: cargo build --release --bin game + - name: Build importer + run: cargo build --release --bin importer - name: Package release - run: ./release/build.sh abst_mac play_abstreet.sh target/release/game + run: ./release/build.sh abst_mac play_abstreet.sh target/release/game target/release/importer - name: Upload release uses: actions/upload-artifact@v1 with: @@ -43,10 +47,12 @@ jobs: - uses: hecrj/setup-rust-action@v1 with: rust-version: 1.43.0 - - name: Run build + - name: Build game run: cargo build --release --bin game + - name: Build importer + run: cargo build --release --bin importer - name: Package release - run: ./release/build.sh abst_linux play_abstreet.sh target/release/game + run: ./release/build.sh abst_linux play_abstreet.sh target/release/game target/release/importer - name: Upload release uses: actions/upload-artifact@v1 with: diff --git a/import.sh b/import.sh index 1ff1c33f18..8acbc93363 100755 --- a/import.sh +++ b/import.sh @@ -1,5 +1,5 @@ #!/bin/bash cd importer; -RUST_BACKTRACE=1 cargo run --release -- $@; +RUST_BACKTRACE=1 cargo run --release --features scenarios -- $@; cd ..; diff --git a/importer/Cargo.toml b/importer/Cargo.toml index 97cc852fd3..b78421f94f 100644 --- a/importer/Cargo.toml +++ b/importer/Cargo.toml @@ -4,12 +4,16 @@ version = "0.1.0" authors = ["Dustin Carlino "] edition = "2018" +[features] +default = [] +scenarios = ["gdal"] + [dependencies] abstutil = { path = "../abstutil" } convert_osm = { path = "../convert_osm" } csv = "1.0.1" geom = { path = "../geom" } -gdal = "0.6.0" +gdal = { version = "0.6.0", optional = true } kml = { path = "../kml" } map_model = { path = "../map_model" } serde = "1.0.98" diff --git a/importer/src/main.rs b/importer/src/main.rs index 58c1a9e612..4f5beea3c7 100644 --- a/importer/src/main.rs +++ b/importer/src/main.rs @@ -1,5 +1,6 @@ mod austin; mod seattle; +#[cfg(feature = "scenarios")] mod soundcast; mod utils; @@ -97,6 +98,7 @@ fn main() { } } + #[cfg(feature = "scenarios")] if job.scenario { assert_eq!(job.city, "seattle"); seattle::ensure_popdat_exists(); @@ -106,6 +108,7 @@ fn main() { soundcast::make_weekday_scenario(&map, &mut timer).save(); } + #[cfg(feature = "scenarios")] if job.scenario_everyone { assert_eq!(job.city, "seattle"); seattle::ensure_popdat_exists(); diff --git a/importer/src/seattle.rs b/importer/src/seattle.rs index 86f34f54d9..63501568be 100644 --- a/importer/src/seattle.rs +++ b/importer/src/seattle.rs @@ -70,6 +70,7 @@ pub fn osm_to_raw(name: &str) { } // Download and pre-process data needed to generate Seattle scenarios. +#[cfg(feature = "scenarios")] pub fn ensure_popdat_exists() { if abstutil::file_exists(abstutil::path_popdat()) { println!("- {} exists, not regenerating it", abstutil::path_popdat()); diff --git a/release/build.sh b/release/build.sh index 2f2820339b..2d53d8d91f 100755 --- a/release/build.sh +++ b/release/build.sh @@ -5,7 +5,8 @@ set -e output=$1; runner=$2; -binary=$3; +game_binary=$3; +importer_binary=$4; cargo run --bin updater @@ -14,7 +15,9 @@ mkdir $output cp docs/INSTRUCTIONS.md $output cp release/$runner $output mkdir $output/game -cp $binary $output/game +cp $game_binary $output/game +mkdir $output/importer +cp $importer_binary $output/importer mkdir $output/data cp -Rv data/system $output/data/system diff --git a/release/finalize.sh b/release/finalize.sh index 3f89588723..201f5baaf9 100755 --- a/release/finalize.sh +++ b/release/finalize.sh @@ -27,6 +27,8 @@ cd game rm -f game unzip ~/Downloads/game_exe.zip rm -f ~/Downloads/game_exe.zip +rm -f ../importer/importer +mv importer.exe ../importer cd ../.. zip -r abstreet_linux_$VERSION abstreet_linux_$VERSION