-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Assume build.rs
in the same directory as Cargo.toml
is a build script (unless explicitly told not to)
#3361
Conversation
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
This change makes cargo assume `build = "build.rs"` if there is a `build.rs` file in the same directory as `Cargo.toml`. However, you can set `build = false` to prevent this.
9016053
to
73e0244
Compare
yessssssss i asked @alexcrichton about this a while back and he was 👍 at the time. I think this is great. |
@@ -540,7 +546,11 @@ impl TomlManifest { | |||
} | |||
|
|||
// processing the custom build script | |||
let new_build = project.build.as_ref().map(PathBuf::from); | |||
let manifest_file = util::important_paths::find_root_manifest_for_wd(None, &layout.root) |
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.
Looking this over again, I'm wondering if I actually have to do this, or if I can just assume base_dir == layout.root
?
@steveklabnik :) everyone who commented in #cargo seemed to support it, but it was a while ago, so I'm hoping the support is still there. |
Thanks for the PR! The implementation looks great to me as well. My only hesitation here is that we risk breaking projects when this lands. Projects can fix builds with I'd also want to think through the backcompat story here with all crates published on crates.io. It may be worth doing a survey there to see how many crates have a @pwoolcoc would you be willing to scrape crates.io and test for |
@alexcrichton sure, I can do that. Would it preferable to change it slightly to only print a deprecation warning when there is a build.rs that isn't a build script, and land the rest of the change after a couple releases? |
I haven't read the patch, but to be clear, the way in which this would
break is if someone had specially configured a `build.rs` at the top level
to be source, correct? I'd imagine this would be very, very tiny, given
almost all source files are in `src`, generally speaking.
…On Fri, Dec 2, 2016 at 7:42 PM, Paul Woolcock ***@***.***> wrote:
@alexcrichton <https://github.com/alexcrichton> sure, I can do that.
Would it preferable to change it slightly to only print a deprecation
warning when there is a build.rs that isn't a build script, and land the
rest of the change after a couple releases?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3361 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AABsik8uKsZgLWAKElRYJ8Opr2UGLQtcks5rELrYgaJpZM4LC5aC>
.
|
@steveklabnik yea, if someone has a crate with a |
If we have no existing
Indeed! I agree that it should be rare if ever, but I just want to make sure! |
@alexcrichton ok, I'm finishing up the few crates that my script couldn't automatically check, but here are the preliminary results. There are 12 crates that have a The 12 crates are:
|
@pwoolcoc thanks for the investigation! Looking at those thought I think that this change would break most of those crates unfortunately. Most of the build scripts have an Given that we may need to pursue a strategy like:
We probably need to let that bake for quite some time, and then after that's in we can enable the auto-detection. What do you think? |
@alexcrichton sounds good, I suspected as much, so I have a patch ready to go for this. So to be clear, the new behavior would be:
Does that sound right? I'll push my last commit so you can look it over, too. |
@pwoolcoc sounds exactly right to me! |
be5ef11
to
3846a15
Compare
9bf77ef
to
1b99491
Compare
@bors: r+ Thanks! |
📌 Commit 1b99491 has been approved by |
Assume `build.rs` in the same directory as `Cargo.toml` is a build script (unless explicitly told not to) So, in May I posted a question in the #cargo IRC room: https://botbot.me/mozilla/cargo/2016-05-26/?msg=66770068&page=1 This PR does what was discussed there. If `cargo` sees a `build.rs` in the same directory as the `Cargo.toml`, it will assume `build.rs` is a build script unless `package.build = false`. Just for completeness I also made `build = true` mean the same as `build = "build.rs"` but I'm not sure if that is okay or not.
☀️ Test successful - status-appveyor, status-travis |
@alexcrichton sorry to revive the old thread, just had a question about this. What is the procedure for going back to finish features like this a few releases down the line? Should I open a tracking issue for it? Or just put a reminder in my calendar for March and ping you again after a couple release cycles? |
@pwoolcoc oh we unfortunately don't have a super principled way of handling this in Cargo. For now though want to open a tracking issue here? |
So, in May I posted a question in the #cargo IRC room: https://botbot.me/mozilla/cargo/2016-05-26/?msg=66770068&page=1
This PR does what was discussed there. If
cargo
sees abuild.rs
in the same directory as theCargo.toml
, it will assumebuild.rs
is a build script unlesspackage.build = false
. Just for completeness I also madebuild = true
mean the same asbuild = "build.rs"
but I'm not sure if that is okay or not.