summaryrefslogtreecommitdiffstats
path: root/xtask
diff options
context:
space:
mode:
authorm-lima <m-lima@users.noreply.github.com>2023-02-07 17:55:37 +0100
committerGitHub <noreply@github.com>2023-02-07 17:55:37 +0100
commit5b3e1ecacd31bf554b59885a01bf4701874b9063 (patch)
treed76a470e155f84183f5cdb5fcd7ca0c1153f924f /xtask
parente3981283a99e866faefa53cd7c06040ea99cac39 (diff)
chore(development): use singlepass in debug mode (#2134)
* Add new feature flags * Use singlepass in debug mode * Use Cow to avoid unnecessary copies - Instead of removing and reinserting into the memory cache, use Cow to model both owned an borrowed data - Log at debug-level the time to compile/load a wasm module - A little clippy drive-by on touched files * Satisfy the assumption from zellij-utils/src/consts.rs for target-dir * Allow forcing cranlift in debug mode * Remove deprecated comments * PR comment: typo * Remove extras
Diffstat (limited to 'xtask')
-rw-r--r--xtask/src/flags.rs4
-rw-r--r--xtask/src/pipelines.rs9
2 files changed, 11 insertions, 2 deletions
diff --git a/xtask/src/flags.rs b/xtask/src/flags.rs
index c3afe2df6..df785e546 100644
--- a/xtask/src/flags.rs
+++ b/xtask/src/flags.rs
@@ -63,6 +63,8 @@ xflags::xflags! {
cmd run {
/// Take plugins from here, skip building plugins. Passed to zellij verbatim
optional --data-dir path: PathBuf
+ /// Force the use of Cranelift for compiling WASM modules
+ optional --cranelift
/// Arguments to pass after `cargo run --`
repeated args: OsString
}
@@ -173,6 +175,8 @@ pub struct Run {
pub args: Vec<OsString>,
pub data_dir: Option<PathBuf>,
+
+ pub cranelift: bool,
}
#[derive(Debug)]
diff --git a/xtask/src/pipelines.rs b/xtask/src/pipelines.rs
index b2266a18f..69737c25c 100644
--- a/xtask/src/pipelines.rs
+++ b/xtask/src/pipelines.rs
@@ -94,6 +94,8 @@ pub fn install(sh: &Shell, flags: flags::Install) -> anyhow::Result<()> {
pub fn run(sh: &Shell, flags: flags::Run) -> anyhow::Result<()> {
let err_context = || format!("failed to run pipeline 'run' with args {flags:?}");
+ let cranelift = flags.cranelift.then_some(["--features", "force_cranelift"]);
+
if let Some(ref data_dir) = flags.data_dir {
let data_dir = sh.current_dir().join(data_dir);
@@ -103,6 +105,7 @@ pub fn run(sh: &Shell, flags: flags::Run) -> anyhow::Result<()> {
.args(["--package", "zellij"])
.arg("--no-default-features")
.args(["--features", "disable_automatic_asset_installation"])
+ .args(cranelift.iter().flatten())
.args(["--", "--data-dir", &format!("{}", data_dir.display())])
.args(&flags.args)
.run()
@@ -120,7 +123,9 @@ pub fn run(sh: &Shell, flags: flags::Run) -> anyhow::Result<()> {
)
.and_then(|_| crate::cargo())
.and_then(|cargo| {
- cmd!(sh, "{cargo} run --")
+ cmd!(sh, "{cargo} run")
+ .args(cranelift.iter().flatten())
+ .args(["--"])
.args(&flags.args)
.run()
.map_err(anyhow::Error::new)
@@ -134,7 +139,7 @@ pub fn run(sh: &Shell, flags: flags::Run) -> anyhow::Result<()> {
/// This includes the optimized zellij executable from the [`install`] pipeline, the man page, the
/// `.desktop` file and the application logo.
pub fn dist(sh: &Shell, _flags: flags::Dist) -> anyhow::Result<()> {
- let err_context = || format!("failed to run pipeline 'dist'");
+ let err_context = || "failed to run pipeline 'dist'";
sh.change_dir(crate::project_root());
if sh.path_exists("target/dist") {