diff options
| author | bors <bors@rust-lang.org> | 2022-09-19 02:13:54 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-09-19 02:13:54 +0000 |
| commit | c8e12cc8bf0de646234524924f39c85d9f3c7c37 (patch) | |
| tree | 8171778babc259edafa48ae8332e304b569f06c5 /src/bootstrap/flags.rs | |
| parent | a37499ae66ec5fc52a93d71493b78fb141c32f6b (diff) | |
| parent | 235dccef2b8012e7d9da87f4b6091912d802cff2 (diff) | |
| download | rust-c8e12cc8bf0de646234524924f39c85d9f3c7c37.tar.gz rust-c8e12cc8bf0de646234524924f39c85d9f3c7c37.zip | |
Auto merge of #101799 - LukeMathWalker:distribute-json-doc, r=jyn514
Distribute json doc # Overview We add a new component, `rust-json-docs`, to distribute the JSON version of rustdoc's output for public compiler crates (i.e. `std`, `alloc`, `proc_macro`, `core` and `test`). As discussed in #101383, we do not bundle this up as part of the existing `rust-docs` component since `rustdoc`'s JSON format is still unstable. # Open questions / Doubts I tried my best, but I never touched this codebase and I couldn't find much documentation on how `dist` works - I pattern-matched existing code, which might have led to some non-sensical choices in the eyes of people more familiar with the codebase. In particular, I am not sure if my choice of adding a new config flag is appropriate or if the decision to build/not build the JSON docs is more appropriately gated by one of the existing flags. Any suggestion is more than welcome. Closes #101383
Diffstat (limited to 'src/bootstrap/flags.rs')
| -rw-r--r-- | src/bootstrap/flags.rs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index 789da748100..802b49d748a 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -107,6 +107,7 @@ pub enum Subcommand { Doc { paths: Vec<PathBuf>, open: bool, + json: bool, }, Test { paths: Vec<PathBuf>, @@ -325,6 +326,11 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`", } Kind::Doc => { opts.optflag("", "open", "open the docs in a browser"); + opts.optflag( + "", + "json", + "render the documentation in JSON format in addition to the usual HTML format", + ); } Kind::Clean => { opts.optflag("", "all", "clean all build artifacts"); @@ -493,6 +499,7 @@ Arguments: ./x.py doc src/doc/book ./x.py doc src/doc/nomicon ./x.py doc src/doc/book library/std + ./x.py doc library/std --json ./x.py doc library/std --open If no arguments are passed then everything is documented: @@ -581,7 +588,11 @@ Arguments: }, }, Kind::Bench => Subcommand::Bench { paths, test_args: matches.opt_strs("test-args") }, - Kind::Doc => Subcommand::Doc { paths, open: matches.opt_present("open") }, + Kind::Doc => Subcommand::Doc { + paths, + open: matches.opt_present("open"), + json: matches.opt_present("json"), + }, Kind::Clean => { if !paths.is_empty() { println!("\nclean does not take a path argument\n"); @@ -787,6 +798,13 @@ impl Subcommand { _ => false, } } + + pub fn json(&self) -> bool { + match *self { + Subcommand::Doc { json, .. } => json, + _ => false, + } + } } fn split(s: &[String]) -> Vec<String> { |
