Got the build to a functional state
This commit is contained in:
parent
9791970856
commit
ec06f0e5e8
5 changed files with 34 additions and 18 deletions
Binary file not shown.
Binary file not shown.
|
|
@ -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
|
|
||||||
40
build.rs
40
build.rs
|
|
@ -35,21 +35,50 @@ fn main() {
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
let starting_dir = current_dir().unwrap();
|
let starting_dir = current_dir().unwrap();
|
||||||
|
let alt_target = manifest_dir.join("target/tiles");
|
||||||
for project in members {
|
for project in members {
|
||||||
let path = manifest_dir.join(project.as_str().unwrap());
|
let path = manifest_dir.join(project.as_str().unwrap());
|
||||||
set_current_dir(&path);
|
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" {
|
if var("PROFILE").unwrap() == "release" {
|
||||||
panic!("no");
|
Command::new("cargo".to_string())
|
||||||
Command::new("cargo").arg("build").arg("--release").status();
|
.arg("build")
|
||||||
|
.arg("--target-dir")
|
||||||
|
.arg(&alt_target.as_os_str())
|
||||||
|
.arg("--release")
|
||||||
|
.status()
|
||||||
|
.unwrap();
|
||||||
} else {
|
} 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);
|
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
|
// Generate Shell Completions
|
||||||
let mut clap_app = CliArgs::clap();
|
let mut clap_app = CliArgs::clap();
|
||||||
println!("cargo:rerun-if-changed=src/cli.rs");
|
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("plugins")).unwrap();
|
||||||
fs::create_dir_all(data_dir.join("layouts")).unwrap();
|
fs::create_dir_all(data_dir.join("layouts")).unwrap();
|
||||||
for asset in assets {
|
for asset in assets {
|
||||||
println!("cargo:rerun-if-changed=assets/{}", asset);
|
|
||||||
fs::copy(Path::new("assets/").join(asset), data_dir.join(asset))
|
fs::copy(Path::new("assets/").join(asset), data_dir.join(asset))
|
||||||
.expect("Failed to copy asset files");
|
.expect("Failed to copy asset files");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
|
||||||
Loading…
Add table
Reference in a new issue