Skip to content

Commit

Permalink
feat: added further target directory separation
Browse files Browse the repository at this point in the history
This adds `target_engine`, which allows using the Cranelift compiler
backend, which cuts even nightly build times in half!
  • Loading branch information
arctic-hen7 committed Jul 8, 2022
1 parent 70d425b commit b2d7e16
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ pkg/
.tribble/
.idea/

target_engine/
target_wasm/
dist/
1 change: 1 addition & 0 deletions examples/core/basic/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist/
target_engine/
target_wasm/
5 changes: 4 additions & 1 deletion packages/perseus-cli/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ pub fn build_internal(
&sg_dir,
&sg_spinner,
&sg_msg,
vec![("PERSEUS_ENGINE_OPERATION", "build")]
vec![
("PERSEUS_ENGINE_OPERATION", "build"),
("CARGO_TARGET_DIR", "target_engine")
]
)?);

Ok(0)
Expand Down
5 changes: 4 additions & 1 deletion packages/perseus-cli/src/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@ pub fn export_internal(
&ep_target,
&ep_spinner,
&ep_msg,
vec![("PERSEUS_ENGINE_OPERATION", "export")]
vec![
("PERSEUS_ENGINE_OPERATION", "export"),
("CARGO_TARGET_DIR", "target_engine")
]
)?);

Ok(0)
Expand Down
16 changes: 11 additions & 5 deletions packages/perseus-cli/src/snoop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ pub fn snoop_build(dir: PathBuf) -> Result<i32, ExecutionError> {
env::var("PERSEUS_CARGO_ARGS").unwrap_or_else(|_| String::new())
),
&dir,
vec![("PERSEUS_ENGINE_OPERATION", "build")],
vec![
("PERSEUS_ENGINE_OPERATION", "build"),
("CARGO_TARGET_DIR", "target_engine"),
],
)
}

Expand All @@ -34,7 +37,7 @@ pub fn snoop_wasm_build(dir: PathBuf, opts: SnoopWasmOpts) -> Result<i32, Execut
env::var("PERSEUS_WASM_PACK_ARGS").unwrap_or_else(|_| String::new())
),
&dir,
vec![],
vec![("CARGO_TARGET_DIR", "target_wasm")],
)
}

Expand All @@ -52,8 +55,11 @@ pub fn snoop_server(dir: PathBuf, opts: SnoopServeOpts) -> Result<i32, Execution
env::var("PERSEUS_CARGO_ARGS").unwrap_or_else(|_| String::new())
),
&dir,
vec![("PERSEUS_ENGINE_OPERATION", "serve")], /* Unlike the `serve` command, we're both
* building and running here, so we provide
* the operation */
vec![
("PERSEUS_ENGINE_OPERATION", "serve"),
("CARGO_TARGET_DIR", "target_engine"),
], /* Unlike the `serve` command, we're both
* building and running here, so we provide
* the operation */
)
}

0 comments on commit b2d7e16

Please sign in to comment.