Skip to content

Commit efb4e4c

Browse files
authored
Cranelift: tweak the ISLE-source-dir build script functionality. (bytecodealliance#10466)
- Add a `cargo:rerun-if-env-changed` clause for the `ISLE_SOURCE_DIR` environment variable to properly rebuild if the config changes. - Update docs to point to the new env-var-based approach rather than the old Cargo feature. As per this Zulip conversation [1] and this GitHub comment [2]. [1]: https://bytecodealliance.zulipchat.com/#narrow/channel/217117-cranelift/topic/How.20to.20enable.20the.20isle-in-source-tree.20feature.3F/near/508028830 [2]: bytecodealliance#9633 (comment)
1 parent 4bb6783 commit efb4e4c

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

cranelift/codegen/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ fn main() {
6363
let crate_dir = cur_dir.as_path();
6464

6565
println!("cargo:rerun-if-changed=build.rs");
66+
println!("cargo:rerun-if-env-changed=ISLE_SOURCE_DIR");
6667

6768
let isle_dir = if let Ok(path) = std::env::var("ISLE_SOURCE_DIR") {
6869
// This will canonicalize any relative path in terms of the

cranelift/docs/isle-integration.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,15 @@ ISLE.
2424

2525
Sometimes, it's desirable to see what code is actually generated. By default,
2626
the generated code is placed in a Cargo-managed path in `target/`. If you want
27-
to see the source instead, invoke Cargo with the optional feature
28-
`isle-in-source-tree` as follows:
27+
to see the source instead, invoke Cargo with the environment variable
28+
`ISLE_SOURCE_DIR` set to another directory, as follows:
2929

3030
```shell
31-
$ cargo check -p cranelift-codegen --features isle-in-source-tree
31+
$ ISLE_SOURCE_DIR=`pwd`/isle-sources cargo check -p cranelift-codegen
3232
```
3333

34-
This will place the ISLE source in `cranelift/codegen/isle_generated_code/`,
35-
where you can inspect it, debug by setting breakpoints in it, etc. Note that if
36-
you later build without this feature, the build system will require you to
37-
delete the directory. This is to ensure that no out-of-date copies exist, which
38-
could cause significant confusion.
34+
This will place the ISLE source in `./isle-sources`, where you can inspect it,
35+
debug by setting breakpoints in it, etc.
3936

4037
If there are any errors during ISLE compilation (e.g., a type mismatch), you
4138
will see a basic error message with a file, line number, and one-line error. To

0 commit comments

Comments
 (0)