Stream: t-compiler/wg-rls-2.0

Topic: Packaging with rustup


matklad (Jun 01 2020 at 15:48, on Zulip):

Hey, @Pietro Albini, I think now that we've merged the RFC about transitioning to rust-analyzer, it makes sense to package it as a rustup component.

I have two questions:

matklad (Jun 01 2020 at 15:49, on Zulip):

Third question:

Pietro Albini (Jun 01 2020 at 16:04, on Zulip):

so, it depends how you want to ship it

Pietro Albini (Jun 01 2020 at 16:04, on Zulip):

the easiest way is to just have it as a component, shipping it with nightlies

Pietro Albini (Jun 01 2020 at 16:05, on Zulip):

the initial work needed is to add it as a submodule, and hook it up with the build system to build RA in dist builders and prepare a tarball for it

Pietro Albini (Jun 01 2020 at 16:05, on Zulip):

cc @simulacrum on that

simulacrum (Jun 01 2020 at 16:05, on Zulip):

yeah that seems like the right approach

simulacrum (Jun 01 2020 at 16:06, on Zulip):

how long does rust-analyzer take to build?

Pietro Albini (Jun 01 2020 at 16:06, on Zulip):

then the release process bits need to be updated to also ship RA only with nightly

Pietro Albini (Jun 01 2020 at 16:06, on Zulip):

and finally you need to coordinate with kinnison (on discord) to setup the bits on the rustup side

Pietro Albini (Jun 01 2020 at 16:07, on Zulip):

once the initial implementation is done, the only maintenance overhead is to send a PR bumping the submodule every time you want to update rustup

Pietro Albini (Jun 01 2020 at 16:08, on Zulip):

since RA is not really affected by rustc changes you can even r+ rollup the PRs updating RA, since they won't break the build anyway (granted they build beforehand)

Pietro Albini (Jun 01 2020 at 16:08, on Zulip):

I guess r? simulacrum on the build system bits, r? me or mark on the release process bits, and r? kinnison for the rustup bits

Pietro Albini (Jun 01 2020 at 16:09, on Zulip):

besides, I can't wait for RA to be available through rustup :heart:

simulacrum (Jun 01 2020 at 16:10, on Zulip):

yep, this sounds right. if it turns out that RA takes too long for our CI we can also explore taking binary artifacts and reuploading them, but I would rather not do that if at all possible to avoid.

bjorn3 (Jun 01 2020 at 16:12, on Zulip):

The last commit took ~5m30s to build and test the rust-analyzer executable and ~3m to just build it. Building and testing the vscode extension is less than 1min.

bjorn3 (Jun 01 2020 at 16:13, on Zulip):

https://github.com/rust-analyzer/rust-analyzer/runs/727874068

simulacrum (Jun 01 2020 at 17:13, on Zulip):

hm okay so seems probably well within fine

matklad (Jun 01 2020 at 17:48, on Zulip):

This might be the debug build though, the release build for me is

real 495.99s
user 3226.26s
sys  29.97s
rss  1087380k
matklad (Jun 03 2020 at 12:50, on Zulip):

@simulacrum

Could you give a link for "and hook it up with the build system" part?

I imagine I can try to look how this is done for cargo and rustup, but, if you can just point me to the relevant file, that would help

simulacrum (Jun 03 2020 at 12:50, on Zulip):

sure! well, kind of

simulacrum (Jun 03 2020 at 12:51, on Zulip):

I would start here: https://github.com/Mark-Simulacrum/rust/blob/5afb70a48564118b1e7f738110ce3e22e733dab8/src/bootstrap/tool.rs#L652-L669

simulacrum (Jun 03 2020 at 12:51, on Zulip):

and then once you've configured the tool there and in builder.rs (the comment lies, you want builder not build, if you could fix that while there that'd be great)

simulacrum (Jun 03 2020 at 12:52, on Zulip):

you will need to add some code to dist.rs in bootstrap, following something like what we do for miri probably (miri is also nightly-only)

simulacrum (Jun 03 2020 at 12:52, on Zulip):

presumably rust analyzer will always build so we won't need any toolstate shenanigans

simulacrum (Jun 03 2020 at 12:53, on Zulip):

once that's done you'll want to post a PR and we can merge that, and then I forget if we need some polish somewhere else

simulacrum (Jun 03 2020 at 12:54, on Zulip):

iirc there's a bit you need to add to the manifest generator but I can't recall right now where that lives

matklad (Jun 04 2020 at 12:32, on Zulip):

WIP PR: https://github.com/rust-lang/rust/pull/72978

matklad (Jun 04 2020 at 12:33, on Zulip):

@simulacrum the PR fails tidy check for code inside rust-analyze repository (we have test files with all kinds of weird shenanigans). Presumably, I should just exclude the whole submodule from tidy, right?

simulacrum (Jun 04 2020 at 12:34, on Zulip):

Yep! Look in src/tools/tidy, there should be at least one ignore list, maybe more

matklad (Jun 04 2020 at 12:36, on Zulip):

And the second question: how do I actually kick the dist locally? ./x.py dist I thik doesn't build tools?

matklad (Jun 04 2020 at 12:36, on Zulip):

./x.py dist rls fails with assert about extended

simulacrum (Jun 04 2020 at 12:56, on Zulip):

ah you may need to enable extended in config.toml

simulacrum (Jun 04 2020 at 12:56, on Zulip):

@matklad should be able to grep for it

matklad (Jun 04 2020 at 14:47, on Zulip):

@simulacrum can I force-push branches with review fixes, or would it break the try build?

simulacrum (Jun 04 2020 at 14:48, on Zulip):

should be fine

matklad (Jun 05 2020 at 19:06, on Zulip):

Seems like try succeded. How do I grab the artifacts?

simulacrum (Jun 05 2020 at 20:08, on Zulip):

rustup-toolchain-install-master, but I can take a stab at it

simulacrum (Jun 05 2020 at 20:10, on Zulip):

seems to work for me (haven't tried running but the binary is there and ldd and running it doesn't just break completely)

simulacrum (Jun 05 2020 at 20:10, on Zulip):

$ ~/.rustup/toolchains/8e490eadad848809668611e7ae2a4b6ce5118bc1/bin/rust-analyzer --version
rust-analyzer 9c52f52

simulacrum (Jun 05 2020 at 20:11, on Zulip):

@matklad I'd be happy to r+ the PR with commits squashed into one -- have we gotten FCP from the relevant teams yet? I think so via RFC but I'll leave that to you to decide and feel free to r=me on the PR if so once you squash things down.

matklad (Jun 06 2020 at 09:25, on Zulip):

Yeah, I think it's fine to r+ -- there was an RFC, and reverting should be easy

matklad (Jul 06 2020 at 07:51, on Zulip):

So, I see rust-analyzer at https://static.rust-lang.org/dist/rust-nightly-x86_64-unknown-linux-gnu.tar.gz !

matklad (Jul 06 2020 at 07:51, on Zulip):

Next stop -- adding rustup component

matthiaskrgr (Jul 09 2020 at 05:59, on Zulip):

rustup component add rust-analyzer-preview works now!
Is there anything I have to do/uninstall if I want to switch from cargo xtask install to the rustup-shipped version?

Laurențiu Nicola (Jul 09 2020 at 06:33, on Zulip):

Depending on your editor, you can set rust-analyzer.serverPath to point to it

Laurențiu Nicola (Jul 09 2020 at 06:33, on Zulip):

I don't think there's a rustup shim, so it might not be in PATH

matthiaskrgr (Jul 09 2020 at 09:12, on Zulip):

yeah, symlink works nicely, cool :)

Last update: Sep 27 2020 at 13:30UTC