Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

feat: made it possible to add component #5

Closed
wants to merge 2 commits into from
Closed

feat: made it possible to add component #5

wants to merge 2 commits into from

Conversation

hencrice
Copy link

Added a new component field so that it's possible to add additional component for a given Rust toolchain.

Unit test updated, e2e verification can be viewed at: https://github.com/hencrice/leetcode-rust/commit/faf8a68c0097160684de1386dc1caf22fb730f02/checks

@garyttierney
Copy link

It'd be nice if this field accepted multiple components as some sort of delimited list. I'm using separate run steps for this at the moment: https://github.com/garyttierney/secsp/blob/chore/rowan-0.6/.github/workflows/ci.yml#L43-L51

@hencrice
Copy link
Author

hencrice commented Sep 21, 2019

It'd be nice if this field accepted multiple components as some sort of delimited list. I'm using separate run steps for this at the moment: https://github.com/garyttierney/secsp/blob/chore/rowan-0.6/.github/workflows/ci.yml#L43-L51

Agreed. I thought about it for a little bit and decided to hold it off for now mainly because
some of the specified components might not be available for a given nightly toolchain. For example, clippy has not been available since 09/13 while rustfmt has link

@garyttierney
Copy link

Ah, good point. We'd need support in components-nightlyto search for a release containing all the required components first.

@svartalf
Copy link
Member

I like an idea with multiple components! And @hencrice is right, allowing that will randomly break nightly toolchains :(

It is possible to fetch JSON data for each component separately and find the intersection, but that data is available for one week only (see this also), which leaves us the edge case when we will not be able to find the most recent toolchain with all components requested.

There is another option exist: fortunately for all of us, components-nightly Action will be obsolete as soon as this rustup issue will be resolved, allowing us to accept multiple values for components input no matter on what toolchain is used. We could postpone this PR till the better times.

@udoprog
Copy link

udoprog commented Oct 15, 2019

rustup can now delay updating nightly unless all specified components are available, making this feasible again:
https://blog.rust-lang.org/2019/10/15/Rustup-1.20.0.html#installing-the-latest-compatible-nightly

@svartalf
Copy link
Member

@udoprog note that right now it can used only if we have some nightly version installed already and we want to update it:

if a component you previously installed is missing in the latest nightly, rustup update will walk backwards in time to find the most recent release with all the components you need.

Since there probably no nightly pre-installed already, this option is not very useful so far in this case.
On the other hand, it can be used for stable toolchains, for example, with profile: minimal and component: clippy you will get the rustc, rust-std, cargo and clippy, excluding the rust-docs and rustfmt.

What can be done for now:

  1. Input should be renamed into components
  2. It will accept a comma-separated list of components
  3. If it is not empty, this list will be passed into the rustup
  4. There probably should be an additional check that will throw an error if components input will be used for nightly toolchain.

@hencrice, do you want to continue to work on that?

@udoprog
Copy link

udoprog commented Oct 15, 2019

@svartalf

@udoprog note that right now it can used only if we have some nightly version installed already and we want to update it:

if a component you previously installed is missing in the latest nightly, rustup update will walk backwards in time to find the most recent release with all the components you need.

That is one mode of operation, further down in the article there is:

Along with this change, rustup 1.20.0 introduces the --component/-c and --target/-t flags to the rustup toolchain install command, allowing you to add components and targets as the toolchain is installed. These flags will also search past nightlies if the current one does not feature all the requested components.

I.e, this should work even though you don't have a nightly installed already (I picked rustc-dev since it's missing today):

PS D:\Repo\OxidizeBot> rustup toolchain install nightly -c rustfmt -c clippy -c rustc-dev 
info: syncing channel updates for 'nightly-x86_64-pc-windows-msvc'
info: latest update on 2019-10-15, rust version 1.40.0-nightly (e413dc36a 2019-10-14)
info: skipping nightly which is missing installed component 'rustc-dev'
info: syncing channel updates for 'nightly-2019-10-14-x86_64-pc-windows-msvc'
info: latest update on 2019-10-14, rust version 1.40.0-nightly (c27f7568b 2019-10-13)

@udoprog
Copy link

udoprog commented Oct 15, 2019

Note, the --component/-c switches are also available for rustup-init:

PS D:\Repo\OxidizeBot> E:\temp\rustup-init.exe -h
rustup-init 1.20.0 (a7f257941 2019-10-14)
The installer for rustup

USAGE:
    rustup-init.exe [FLAGS] [OPTIONS]

FLAGS:
    -v, --verbose           Enable verbose output
    -q, --quiet             Disable progress output
    -y                      Disable confirmation prompt.
        --no-modify-path    Don't configure the PATH environment variable
    -h, --help              Prints help information
    -V, --version           Prints version information

OPTIONS:
        --default-host <default-host>              Choose a default host triple
        --default-toolchain <default-toolchain>    Choose a default toolchain to install  
        --profile <profile>                         [default: default]  [possible values: 
minimal, default, complete]
    -c, --component <components>...                Component name to also install
    -t, --target <targets>...                      Target name to also install

@svartalf
Copy link
Member

@udoprog, huh, yes, you are right and this is amazing, because we can deprecate the actions-rs/components-nightly at all (finally!) and leave all the work for the toolchain Action

@hencrice
Copy link
Author

Closing because profile support is coming!

@hencrice hencrice closed this Oct 18, 2019
lionel-faber pushed a commit to lionel-faber/toolchain that referenced this pull request Jan 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants