Skip to content
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

Cargo integration #12

Merged
merged 8 commits into from
May 17, 2016
Merged

Cargo integration #12

merged 8 commits into from
May 17, 2016

Conversation

kernelmachine
Copy link
Collaborator

No description provided.

///
/// Returns `None` if no ancestor path contains a `Cargo.toml`, or if
/// the limit of MAX_ANCESTORS ancestors has been reached.
pub fn find_toml() -> Option<PathBuf> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to not use cargo read-manifest?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agh, was trying to find a command like that! thanks for pointing it out, makes my life easier.

i'll change the get_package_name/find_toml functions to go through cargo read-manifest. i think we'll still need the find_target, unless i'm wrong

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think searching for a target dir is 100% reliable, you'll need to account for things like: rust-lang/cargo#1657

I think using cargo as a library might be the most reliable way to ensure things work reliably, you could inspect how cargo read-manifest is written perhaps as a starting point (or another cargo-foo package?).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair point. i'll dig into this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to say this PR should be merged as it stands, so users can at least have all the improved ergonomics under default output conditions, which I'm sure covers most people's use cases. We can figure out how to deal with custom output directories as a separate issue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The NoTargetDirectory error will require the project to have a target/ directory containing the binary to use cargo-profiler w/o --bin. However, the user still has the option of explicitly providing the path to the binary, if they have a non-standard output directory.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you've made a pragmatic decision 👍

@kernelmachine kernelmachine merged commit 42d005f into master May 17, 2016
@svenstaro svenstaro deleted the cargo-integration branch October 16, 2019 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants