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

bootstrap: Support -- as an alternative to --args and --test-args #107375

Closed
jyn514 opened this issue Jan 27, 2023 · 5 comments · Fixed by #107905
Closed

bootstrap: Support -- as an alternative to --args and --test-args #107375

jyn514 opened this issue Jan 27, 2023 · 5 comments · Fixed by #107905
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@jyn514
Copy link
Member

jyn514 commented Jan 27, 2023

Right now, x.py is pretty inconsistent with cargo's CLI. To pass arguments to compiletest, you use --test-args; to pass arguments to expand-yaml-anchors you use --args; to pass arguments to cargo you use CARGOFLAGS. I would like to unify these with the same syntax as cargo:

  • x test ui -- --force-rerun --ignored would behave the same as x test ui --test-args --force-rerun --test-args --ignored today
  • x run miri -- run --print=sysroot would behave the same as x run miri --args run --args --print=sysroot
  • x fix -- --fix-broken would behave the same as CARGOFLAGS=--fix-broken x fix today, except that it would only pass it to cargo commands invoked by bootstrap, not when building bootstrap itself (avoiding the "argument --fix-broken not expected" error you'd get today).
@jyn514 jyn514 added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself labels Jan 27, 2023
@Teapot4195
Copy link
Contributor

@rustbot claim

@Teapot4195
Copy link
Contributor

Looking at the current setup for argument parsing, it appears that getopts::Options struct doesn't have a state engine based parser, so it wont be able to parse -- as a state changing flag. I'm thinking probably parse and translate the args in python then just pass it on to the bootstrap executable, (unless someone here has a better idea).

@jyn514
Copy link
Member Author

jyn514 commented Jan 29, 2023

@Teapot4195 let's not put any logic in python if we can help it, it's going away soon: #94829. I think it would be ok to switch to clap or another arg parser if it makes things easier.

@Teapot4195
Copy link
Contributor

Ah, I was thinking something like getting rid of the python script was going to happen someday.
clap will probably do for the functionality we will need from it.

@Teapot4195
Copy link
Contributor

I'm out of town for the rest of the week so if anyone would like to take this issue while I'm away, go for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants