-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Working with cargo #47
Conversation
Currently defaulting to `stable_mir_json` which is this package that runs `main.rs`. But if flag `--bin cargo_stable_mir_json` is added it runs the `src/bin/cargo_stable_mir_json.rs`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments are a few nit-picks on details...
The approach as a whole seems reasonable for distribution - maybe there would be a more canonical way to place things inside $HOME/.cargo
but if this works we can go with this for now.
Can you add a usage example here, and a description in the README.md
?
Might be good to give users the option of a custom install path. |
Co-authored-by: Jost Berthold <jost.berthold@gmail.com>
…p_artefacts_from_profile`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I still have a few comments on details... and should we maybe add a smoke test in CI that runs this in docker and tries to use the resulting installation?
We can also merge this and refactor on a follow-up PR to make progress
src/bin/cargo_stable_mir_json.rs
Outdated
fn setup(repo_dir: PathBuf, maybe_user_provided_dir: Option<PathBuf>) -> Result<()> { | ||
let smir_json_dir = smir_json_dir(maybe_user_provided_dir)?; | ||
println!("Creating {} directory", smir_json_dir.display()); | ||
std::fs::create_dir(&smir_json_dir)?; // This errors is the directory already exists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This errors is the directory already exists
... not sure that's desirable. We can leave it that way for now, though...
Also, when I suggested the user-defined location I thought this would be the final destination, not that a directory would be created there.
Co-authored-by: Jost Berthold <jost.berthold@gmail.com>
Added the other issue here #48 |
This didn't end up looking anything like what I had imagined. But I was having a lot of trouble getting this working at all and I may have had my environment set up in a way that was self defeating as I feel I suddenly started having things work when trying the same thing. Not sure.
But right now this is creating a
.stable_mir_json
directory at a given directory or~/.stable_mir_json
directory (linux only right now) and that is populated with the binary forstable_mir_json
, a file containing theLD_LIBRARY_PATH
that was used to create the binary, and scripts to set the library path so that RUSTC can be overwritten when calling cargo.To test this out:
cargo build
andcargo build --release
cargo run --bin cargo_stable_mir_json -- $PWD [optional-dir-path]
from the root of the repo (this creates.stable_mir_json
)RUSTC=~/.stable_mir_json/debug.sh cargo build
(or the file that.stable_mir_json
was built in). Or for releaseRUSTC=~/.stable_mir_json/release.sh cargo build
Fixes #39