You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by wy...@apache.org on 2026/10/19 08:48:29 UTC

(maka) branch rust-preview updated: fix(cli): resolve debug product assets from the current crate

This is an automated email from the ASF dual-hosted git repository.

M4n5ter pushed a commit to branch rust-preview
in repository https://gitbox.apache.org/repos/asf/maka.git


The following commit(s) were added to refs/heads/rust-preview by this push:
     new cd3953f42f fix(cli): resolve debug product assets from the current crate
cd3953f42f is described below

commit cd3953f42f2fb2b787738f08d4faeb2b72386d51
Author: M4n5ter <m4...@gmail.com>
AuthorDate: Mon Oct 19 16:47:42 2026 +0800

    fix(cli): resolve debug product assets from the current crate
    
    Resolve the development bundle at CLI compilation using
    CARGO_MANIFEST_DIR instead of retaining a build-script-generated
    absolute path. A target directory shared by worktrees can otherwise
    leave the debug CLI reading assets from the old checkout even after
    just run builds the current bundle.
    
    Keep embedded release assets and explicit bundle overrides unchanged.
    
    Validated with a debug build, strict CLI clippy, just run --help, and
    real PTY first-install/reopen without MAKA_PRODUCT_BUNDLE from another
    working directory with Node unavailable.
---
 products/maka/cli/build/product.rs           | 10 +---------
 products/maka/cli/src/application/product.rs |  3 +++
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/products/maka/cli/build/product.rs b/products/maka/cli/build/product.rs
index 18a5714909..c456f4cf7d 100644
--- a/products/maka/cli/build/product.rs
+++ b/products/maka/cli/build/product.rs
@@ -51,18 +51,10 @@ pub fn bundle() {
     println!("cargo:rerun-if-changed=build.rs");
     println!("cargo:rerun-if-changed=build/product.rs");
     println!("cargo:rustc-check-cfg=cfg(maka_embedded_product)");
-    let output = std::path::PathBuf::from(env::var_os("OUT_DIR").unwrap());
     if env::var("PROFILE").as_deref() != Ok("release") {
-        fs::write(
-            output.join("product-assets.rs"),
-            format!(
-                "const DEVELOPMENT_BUNDLE: &str = {:?};\n",
-                repo.join("products/maka/bundle/dist").to_str().unwrap()
-            ),
-        )
-        .unwrap();
         return;
     }
+    let output = std::path::PathBuf::from(env::var_os("OUT_DIR").unwrap());
     println!("cargo:rustc-cfg=maka_embedded_product");
     println!("cargo:rerun-if-env-changed=MAKA_JS_DEPS");
     let dependencies = env::var_os("MAKA_JS_DEPS")
diff --git a/products/maka/cli/src/application/product.rs b/products/maka/cli/src/application/product.rs
index 97f8212db3..d9652c9d8a 100644
--- a/products/maka/cli/src/application/product.rs
+++ b/products/maka/cli/src/application/product.rs
@@ -51,7 +51,10 @@ struct Bundled {
     name: &'static str,
     files: &'static [(&'static str, &'static [u8])],
 }
+#[cfg(maka_embedded_product)]
 include!(concat!(env!("OUT_DIR"), "/product-assets.rs"));
+#[cfg(not(maka_embedded_product))]
+const DEVELOPMENT_BUNDLE: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/../bundle/dist");
 
 #[derive(Clone, Copy, ValueEnum, Serialize, Deserialize)]
 #[serde(rename_all = "snake_case")]


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org