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

Add a way to not build tier one targets by default #1145

Merged
merged 1 commit into from
Nov 22, 2020

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Oct 30, 2020

This is still opt-in and off by default. However, it's useful for local
development and custom registries.

This is all of #532 except for actually switching it on. It does turn it on for local development, so that builds will be faster.

r? @pietroalbini
cc @l4l

@jyn514 jyn514 added S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed A-builds Area: Building the documentation for a crate C-enhancement Category: This is a new feature labels Oct 30, 2020
Copy link
Contributor

@l4l l4l left a comment

Choose a reason for hiding this comment

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

Maybe it's better to specify DEFAULT_TARGETS instead? Then it's possible to specify a list of targets rather than limiting to the host one

crates/metadata/lib.rs Outdated Show resolved Hide resolved
@jyn514
Copy link
Member Author

jyn514 commented Oct 30, 2020

Maybe it's better to specify DEFAULT_TARGETS instead? Then it's possible to specify a list of targets rather than limiting to the host one

Do you need this flexibility? We certainly don't in docs.rs and it would make the implementation more complicated.

@l4l
Copy link
Contributor

l4l commented Oct 30, 2020

Well, that sounds like a fairly natural need. I'm not sure that I personally need this but I think it can be helpful.

@jyn514
Copy link
Member Author

jyn514 commented Oct 30, 2020

I think I prefer to hold off on implementing that, then. Ideally we wouldn't have this variable at all and you'd always have to specify your targets, but that would be a breaking change: https://internals.rust-lang.org/t/pre-rfc-build-only-one-target-by-default-on-docs-rs/12804. So I definitely don't want to expand this feature if I don't have to.

@pietroalbini
Copy link
Member

pietroalbini commented Nov 12, 2020

I would invert the variable, something like include_default_targets: true. Otherwise the idea looks fine.

@jyn514
Copy link
Member Author

jyn514 commented Nov 12, 2020

Ok, I updated it in the metadata library but not in docs.rs, since I'd like 'no variable set' to match false.

src/config.rs Outdated
@@ -87,6 +87,7 @@ impl Config {
local_docker_image: maybe_env("DOCS_RS_LOCAL_DOCKER_IMAGE")?,
toolchain: env("CRATESFYI_TOOLCHAIN", "nightly".to_string())?,
build_cpu_limit: maybe_env("DOCS_RS_BUILD_CPU_LIMIT")?,
only_build_default_target: env("DOCSRS_ONLY_BUILD_DEFAULT_TARGET", false)?,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
only_build_default_target: env("DOCSRS_ONLY_BUILD_DEFAULT_TARGET", false)?,
include_default_targets: env("DOCSRS_INCLUDE_DEFAULT_TARGETS", true)?,

And an example of DOCSRS_INCLUDE_DEFAULT_TARGETS=false in .env.sample seems like it'd support defaulting to on without the double-negative of !only_build_default_target.

Copy link
Member Author

Choose a reason for hiding this comment

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

@Nemo157 well this is what I mean by I want the env variable to default to false - otherwise it's confusing what the default is. If we change it to INCLUDE_DEFAULT_TARGETS the default will be true.

Copy link
Member

Choose a reason for hiding this comment

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

🤷 I don't find it that confusing when things default to on and you have to explicitly disable them in config, but I don't really care that much.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, I changed this to INCLUDE_DEFAULT_TARGETS, set it to be on by default in docs.rs, but off by default in env.sample.

This is still opt-in and off by default. However, it's useful for local
development and custom registries.
@jyn514 jyn514 force-pushed the no-default-targets branch from 7e1fda3 to 7a073c4 Compare November 22, 2020 19:25
@jyn514 jyn514 merged commit 31c864e into rust-lang:master Nov 22, 2020
@jyn514 jyn514 deleted the no-default-targets branch November 22, 2020 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-builds Area: Building the documentation for a crate C-enhancement Category: This is a new feature S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants