diff options
| author | Brooks J Rady <b.j.rady@gmail.com> | 2021-02-09 23:30:07 +0000 |
|---|---|---|
| committer | Brooks J Rady <b.j.rady@gmail.com> | 2021-02-09 23:30:07 +0000 |
| commit | ec06f0e5e8e1ae4660b6af5221100e58e084e9de (patch) | |
| tree | 1dabf1d34971d2c5df0295cb5fcd831cda7ecefc | |
| parent | Well, it turns out that I spent 4 hours on something impossible... (diff) | |
| download | sl0ppij-ec06f0e5e8e1ae4660b6af5221100e58e084e9de.tar.gz sl0ppij-ec06f0e5e8e1ae4660b6af5221100e58e084e9de.tar.xz sl0ppij-ec06f0e5e8e1ae4660b6af5221100e58e084e9de.zip | |
Got the build to a functional state
| -rw-r--r-- | assets/plugins/status-bar.wasm | bin | 509798 -> 441653 bytes | |||
| -rw-r--r-- | assets/plugins/strider.wasm | bin | 528778 -> 527278 bytes | |||
| -rwxr-xr-x | build-optimised.sh | 6 | ||||
| -rw-r--r-- | build.rs | 40 | ||||
| -rwxr-xr-x | default-tiles/strider/build-optimised.sh | 6 |
5 files changed, 34 insertions, 18 deletions
diff --git a/assets/plugins/status-bar.wasm b/assets/plugins/status-bar.wasm Binary files differindex 646ad3b5..fee109dd 100644 --- a/assets/plugins/status-bar.wasm +++ b/assets/plugins/status-bar.wasm diff --git a/assets/plugins/strider.wasm b/assets/plugins/strider.wasm Binary files differindex 77b07b01..a31d8e15 100644 --- a/assets/plugins/strider.wasm +++ b/assets/plugins/strider.wasm diff --git a/build-optimised.sh b/build-optimised.sh deleted file mode 100755 index 4e6cf764..00000000 --- a/build-optimised.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -# Build a release WASM from Rust with lto on -cargo build --release -# Further optimise for speed (and size) -wasm-opt -O target/wasm32-wasi/release/status-bar.wasm -o target/status-bar.wasm
\ No newline at end of file @@ -35,21 +35,50 @@ fn main() { "" }; let starting_dir = current_dir().unwrap(); + let alt_target = manifest_dir.join("target/tiles"); for project in members { let path = manifest_dir.join(project.as_str().unwrap()); set_current_dir(&path); + // FIXME: This is soul-crushingly terrible, but I can't keep the values alive long enough if var("PROFILE").unwrap() == "release" { - panic!("no"); - Command::new("cargo").arg("build").arg("--release").status(); + Command::new("cargo".to_string()) + .arg("build") + .arg("--target-dir") + .arg(&alt_target.as_os_str()) + .arg("--release") + .status() + .unwrap(); } else { - Command::new("cargo").arg("build").status(); + Command::new("cargo") + .arg("build") + .arg("--target-dir") + .arg(&alt_target.as_os_str()) + .status() + .unwrap(); } - - eprintln!("{:?}", &path); } set_current_dir(&starting_dir); + // FIXME: Deduplicate this with the initial walk all .rs pattern + for entry in fs::read_dir(alt_target.join("wasm32-wasi/release/")).unwrap() { + let entry = entry.unwrap().path(); + let ext = entry.extension(); + if ext.is_some() && ext.unwrap() == "wasm" { + dbg!(&entry); + Command::new("wasm-opt") + .arg("-O") + .arg(entry.as_os_str()) + .arg("-o") + .arg(format!( + "assets/plugins/{}", + entry.file_name().unwrap().to_string_lossy() + )) + .status() + .unwrap(); + } + } + // Generate Shell Completions let mut clap_app = CliArgs::clap(); println!("cargo:rerun-if-changed=src/cli.rs"); @@ -77,7 +106,6 @@ fn main() { fs::create_dir_all(data_dir.join("plugins")).unwrap(); fs::create_dir_all(data_dir.join("layouts")).unwrap(); for asset in assets { - println!("cargo:rerun-if-changed=assets/{}", asset); fs::copy(Path::new("assets/").join(asset), data_dir.join(asset)) .expect("Failed to copy asset files"); } diff --git a/default-tiles/strider/build-optimised.sh b/default-tiles/strider/build-optimised.sh deleted file mode 100755 index e0654d89..00000000 --- a/default-tiles/strider/build-optimised.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -# Build a release WASM from Rust with lto on -cargo build --release -# Further optimise for speed (and size) -wasm-opt -O target/wasm32-wasi/release/module.wasm -o target/strider.wasm
\ No newline at end of file |
