zellij/Makefile.toml
2021-03-30 12:49:42 +01:00

58 lines
1.5 KiB
TOML

# Global Settings
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
SKIP_TEST = false
# Patching the default flows to skip testing of wasm32-wasi targets
[tasks.pre-test]
condition = { env = { "CARGO_MAKE_CRATE_TARGET_TRIPLE" = "wasm32-wasi" } }
env = { "SKIP_TEST" = true }
[tasks.test]
condition = { env_false = ["SKIP_TEST"] }
dependencies = ["pre-test"]
[tasks.post-test]
env = { "SKIP_TEST" = false }
[tasks.run]
workspace = false
dependencies = ["build"]
run_task = { name = ["patch-layouts", "run-zellij"] }
## Need to walk the layout YAML and patch the plugin fields!
[tasks.patch-layouts]
script_runner = "@rust"
script = '''
//! ```cargo
//! [dependencies]
//! yaml-rust = "0.4"
//! ```
use std::{fs, env, error::Error, path::Path};
use yaml_rust::{YamlLoader, YamlEmitter};
fn main() -> Result<(), Box<dyn Error>> {
let root = env::var("CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY")?;
let layout_path = Path::new(&root).join("assets/layouts");
for layout in fs::read_dir(layout_path)? {
let yaml = fs::read_to_string(layout?.path())?;
let yaml = YamlLoader::load_from_str(&yaml)?[0];
}
Ok(())
}
'''
[tasks.run-zellij]
# Running Zellij
# Change the build to always use the assets, but not delete them by default
# Instead, just run with a patched layout file that points to a local plugin copy
# Have a publish flow that triggers wasm-opt and updates the assets
# Have an install flow that deletes the zellij data directory (using a rust script)
# Add a clippy flow that uses the nightly options