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

Feature request: Use response files for rustc build/doc. #7759

Closed
MaulingMonkey opened this issue Jan 1, 2020 · 2 comments
Closed

Feature request: Use response files for rustc build/doc. #7759

MaulingMonkey opened this issue Jan 1, 2020 · 2 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@MaulingMonkey
Copy link

MaulingMonkey commented Jan 1, 2020

(EDIT: rustc response files are not yet stabilized, but it looks like they will be in 1.41?)

Describe the problem you are trying to solve

Some crates have hundreds upon hundreds - if not thousands - of features to manage compile times. If writing wildcard features that include a significant subset of these features, it's easy to exceed command line length limits on Windows:

error: could not compile `jni-android-sys`.

Caused by:
  could not execute process `rustc --edition=2018 --crate-name ...
  ...thousands of --cfg "feature=\"x-y-z\"" flags...
  ... (never executed)

Caused by:
  The filename or extension is too long. (os error 206)

As an awkward workaround, you can have a feature simply not specify the features it depends on, and instead do them all in code. E.g. instead of:

#[cfg(feature = "java-lang-Object")]

I've been generating:

#[cfg(any(feature = "all", feature = "java", feature = "java-lang", feature = "java-lang-Object"))]

But this has to be done every time you want to check the existence of java::lang::Object, and this isn't even the worst version.

Describe the solution you'd like

rustc already supports @path arguments / response files... so we could just leverage those. The main annoyances are refactoring and figuring out what commands need to use response files ("all rustc invokes"?)

Notes

I'm taking a quick stab at seeing how easy this is to implement... by which I mean all the unit tests are failing and it's probably my fault...

@MaulingMonkey MaulingMonkey added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Jan 1, 2020
MaulingMonkey added a commit to MaulingMonkey/cargo that referenced this issue Jan 1, 2020
This would workaround windows command line length
limits when using lots and lots of features.

rust-lang#7759
@epage
Copy link
Contributor

epage commented Apr 20, 2022

This sounds like a duplicate of #1241 which I think was resolved in #10546.

@weihanglo does it look like we can close this?

@weihanglo
Copy link
Member

I believe it was resolved in #10546. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

3 participants