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

Unify tools building #41639

Merged
merged 5 commits into from
May 18, 2017
Merged

Unify tools building #41639

merged 5 commits into from
May 18, 2017

Conversation

ishitatsuyuki
Copy link
Contributor

@ishitatsuyuki ishitatsuyuki commented Apr 29, 2017

Close #41601

Time saving for up to 10 minutes. Cargo is now only compiled once.

Downsides:

  • Out of tree Cargo.lock maintenance
  • Cargo.toml [replace] version maintenance

@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@ishitatsuyuki
Copy link
Contributor Author

r? @alexcrichton

Currently the RLS dependencies are fucked up, and I have opened rust-lang/rls#285 to adapt the current state. I'm too lazy to hand-rewrite Cargo.lock, so this is blocked on that PR.

// so we don't set this variable during stage0 where llvm-config is
// missing
// We also only build the runtimes when --enable-sanitizers (or its
// config.toml equivalent) is used
Copy link
Member

Choose a reason for hiding this comment

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

What's with all these spacing changes and reformatting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used rustfmt, but seems it screwed up something else. Will remove.

@ishitatsuyuki
Copy link
Contributor Author

According to the build results, this saves up to 300 seconds. Not sure if this worth the out-of-tree lockfile maintenance cost.

@carols10cents carols10cents added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 1, 2017
@ishitatsuyuki
Copy link
Contributor Author

r? @alexcrichton

Review points:

  • Cargo.lock now diverges from upstream. It also needs to be updated on each submodule update. (A simple cargo update in the directory is enough)
  • The [replace] section also needs to be updated on version bump. This shouldn't be a big hit though.

@ishitatsuyuki ishitatsuyuki changed the title [WIP] Unify tools Unify tools building May 2, 2017
@ishitatsuyuki
Copy link
Contributor Author

By the way, this could be a little bit even faster by swapping the build order of rls and cargo. In that way, it should have more parallelism since rls includes the cargo build and more crates are built in one pass.

@alexcrichton
Copy link
Member

Thanks for the PR! I think this is the lowest hanging fruit of speeding up the dist builders right now and this is also an issue that must be resolved before the RLS hits stable.

The downsides here are unfortunate, namely disregarding the lock files in the rls/cargo repositories. Unfortunately though I don't see another way of doing this. I discussed this strategy with @brson and @nrc yesterday and we're comfortable having a separate lock file in-tree for the Cargo/RLS binaries that we ship.

Could this actually, though, move Cargo/RLS into the global rustc workspace? That way all their dependencies will get vendored as usual and should be buildable from source tarballs as well.

@ishitatsuyuki
Copy link
Contributor Author

I have no idea what will happen if we moved them into global workspace. The thing I most fear is that it mixes things up with the compiler build.

As an alternative approach, can we run cargo vendor separatedly for this directory?

@alexcrichton
Copy link
Member

The end goal is to have everything in one workspace, and I don't believe many issues will arise. Mind trying it out?

@ishitatsuyuki
Copy link
Contributor Author

Old branch backed up, let's see what will happen now.

@ishitatsuyuki
Copy link
Contributor Author

@alexcrichton the well known submodule delayed manifest problem is here, how should I deal with that?

@ishitatsuyuki
Copy link
Contributor Author

[01:09:29] error[E0523]: found two different crates with name `rustc_serialize` that are not distinguished by differing `-C metadata`. This will result in symbol conflicts between the two.
[01:09:29]   --> /checkout/src/tools/rls/src/build.rs:13:1
[01:09:29]    |
[01:09:29] 13 | extern crate rustc_driver;
[01:09:29]    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
[01:09:29] 
[01:09:29] error: Could not compile `rls`.

Something's wrong. No idea.

@Mark-Simulacrum
Copy link
Member

@alexcrichton Is there a chance you could help diagnose the failure above?

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 7, 2017
@ishitatsuyuki
Copy link
Contributor Author

ishitatsuyuki commented May 7, 2017

@alexcrichton I recommend to roll back to the original implementation (backed up as a branch, and can be merged with resolving Cargo.lock conflicts). Here are the points:

  • rustc_serialize is complexly reused/re-exported inside the compiler code, and it caused the linkage problem.
  • We shouldn't give stage2 tools the same workspace, since they're intended for compiling independently from rustc.
  • Putting submodules into workspace causes bootstrap failure (missing submodule = missing Cargo.toml).
  • Regarding your intense to vendor stage2 deps, I believe it can be just solved by running cargo-vendor twice.

@alexcrichton
Copy link
Member

It's worth being clear up front that rustbuild with respect to crates.io is pretty precarious right now, and builds like this are showing how it's really starting to stress many underlying assumptions. I'm basically just saying that this is not going to be an easy integration do "do right," and there's likely tons of little surprises along the way like this.

Unfortunately I don't know why that error is showing up. The only difference here is a change in workspace, but today we're already compiling rustc-serialize a bunch of times. For example the compiler currently links to rustc-serialize 0.3.23 and so does the rls, so why the linking error only shows up with this PR and not currently on master is confusing to me.

In general we want to make these all one workspace to have one location that we're managing dependencies, not a whole bunch. The linkage problem here sounds like either a bug in the compiler or a bug in the setup, I'm not sure which. These tools are intended to be compiled with rustc as well for a full distribution, so we want them in the same workspace. I had forgotten about the submodule problem, yes, but I think we'll just need to bite the bullet and move git submodule management into bootstrap.py from src/bootstrap/lib.rs. It's worth pointing out that cargo-vendor does not currently support being invoked twice, there's an open bug about that.

@bors
Copy link
Contributor

bors commented May 9, 2017

☔ The latest upstream changes (presumably #41846) made this pull request unmergeable. Please resolve the merge conflicts.

@ishitatsuyuki ishitatsuyuki force-pushed the unify-tools branch 2 times, most recently from 788f1c4 to 5ff5c48 Compare May 10, 2017 11:17
@ishitatsuyuki
Copy link
Contributor Author

Ready to roll.

@alexcrichton
Copy link
Member

@ishitatsuyuki did you want to update the git logic to be line-for-line equivalent to the current manifestation in rustbuild and update the logic later in a future PR? (discussion here)

@ishitatsuyuki
Copy link
Contributor Author

I don't want to do line-by-line translation personally (due to I having not so much time these days). I'm aware that this probably still has some flaw not found in review, but it's working for most of my local usecases and I consider it OK.

@alexcrichton
Copy link
Member

Ok I think I agree with @aidanhs that we don't want to land this until it's the same as before. The submodule logic has been careful crafted over a long time, so without a reason to change it I don't think we should. If you're busy though I can push up the relevant logic.

@ishitatsuyuki
Copy link
Contributor Author

I understand. I will create a line2line version tomorrow.

Basically just translate what's done on master in Rust to Python here.
@alexcrichton
Copy link
Member

@bors: r+

Ah no worries, I went ahead and did so

@bors
Copy link
Contributor

bors commented May 17, 2017

📌 Commit db69d89 has been approved by alexcrichton

@alexcrichton
Copy link
Member

@bors: p=1

(fixes breakage on master related to submodules)

@bors
Copy link
Contributor

bors commented May 17, 2017

⌛ Testing commit db69d89 with merge be1d1aa...

bors added a commit that referenced this pull request May 17, 2017
Unify tools building

Close #41601

Time saving for up to 10 minutes. Cargo is now only compiled once.

Downsides:

- Out of tree Cargo.lock maintenance
- Cargo.toml `[replace]` version maintenance
jwilm added a commit to jwilm/racer that referenced this pull request May 17, 2017
@jwilm
Copy link

jwilm commented May 17, 2017

I just published an update for Racer relaxing dependencies. 2.0.7 on crates.io

@bors
Copy link
Contributor

bors commented May 17, 2017

💔 Test failed - status-travis

@Mark-Simulacrum
Copy link
Member

I suspect this is a spurious failure since we timed out, so retrying.

@bors retry

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request May 17, 2017
…ichton

Unify tools building

Close rust-lang#41601

Time saving for up to 10 minutes. Cargo is now only compiled once.

Downsides:

- Out of tree Cargo.lock maintenance
- Cargo.toml `[replace]` version maintenance
@bors
Copy link
Contributor

bors commented May 18, 2017

⌛ Testing commit db69d89 with merge 31bfa96...

bors added a commit that referenced this pull request May 18, 2017
Unify tools building

Close #41601

Time saving for up to 10 minutes. Cargo is now only compiled once.

Downsides:

- Out of tree Cargo.lock maintenance
- Cargo.toml `[replace]` version maintenance
@bors
Copy link
Contributor

bors commented May 18, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 31bfa96 to master...

@bors bors merged commit db69d89 into rust-lang:master May 18, 2017
@alexcrichton
Copy link
Member

🎊

Thanks again for working on this @ishitatsuyuki!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants