File tree Expand file tree Collapse file tree 8 files changed +49
-40
lines changed
rustdoc-scrape-examples-multiple
rustdoc-scrape-examples-ordering
rustdoc-scrape-examples-remap Expand file tree Collapse file tree 8 files changed +49
-40
lines changed Original file line number Diff line number Diff line change 1- -include ../../run-make-fulldeps/tools.mk
1+ deps := ex ex2
22
3- OUTPUT_DIR := " $( TMPDIR ) /rustdoc"
3+ -include ./scrape.mk
44
5- all : $(TMPDIR ) /ex.calls $(TMPDIR ) /ex2.calls
6- $(RUSTDOC ) src/lib.rs --crate-name foobar --crate-type lib --output $(OUTPUT_DIR ) \
7- -Z unstable-options \
8- --with-examples $(TMPDIR ) /ex.calls \
9- --with-examples $(TMPDIR ) /ex2.calls
10-
11- $(HTMLDOCCK) $(OUTPUT_DIR) src/lib.rs
12-
13- $(TMPDIR ) /% .calls : $(TMPDIR ) /libfoobar.rmeta
14- $(RUSTDOC ) examples/$* .rs --crate-name $* --crate-type bin --output $(OUTPUT_DIR ) \
15- --extern foobar=$(TMPDIR ) /libfoobar.rmeta \
16- -Z unstable-options \
17- --scrape-examples-output-path $@ \
18- --scrape-examples-target-crate foobar
19-
20- $(TMPDIR ) /lib% .rmeta : src/lib.rs
21- $(RUSTC ) src/lib.rs --crate-name $* --crate-type lib --emit=metadata
5+ all : scrape
Original file line number Diff line number Diff line change 1+ -include ../../run-make-fulldeps/tools.mk
2+
3+ OUTPUT_DIR := "$(TMPDIR ) /rustdoc"
4+
5+ $(TMPDIR ) /% .calls : $(TMPDIR ) /libfoobar.rmeta
6+ $(RUSTDOC ) examples/$* .rs --crate-name $* --crate-type bin --output $(OUTPUT_DIR ) \
7+ --extern foobar=$(TMPDIR ) /libfoobar.rmeta \
8+ -Z unstable-options \
9+ --scrape-examples-output-path $@ \
10+ --scrape-examples-target-crate foobar
11+
12+ $(TMPDIR ) /lib% .rmeta : src/lib.rs
13+ $(RUSTC ) src/lib.rs --crate-name $* --crate-type lib --emit=metadata
14+
15+ scrape : $(foreach d,$(deps ) ,$(TMPDIR ) /$(d ) .calls)
16+ $(RUSTDOC ) src/lib.rs --crate-name foobar --crate-type lib --output $(OUTPUT_DIR ) \
17+ -Z unstable-options \
18+ $(foreach d,$(deps ) ,--with-examples $(TMPDIR ) /$(d ) .calls)
19+
20+ $(HTMLDOCCK) $(OUTPUT_DIR) src/lib.rs
Original file line number Diff line number Diff line change 1- // @has foobar/fn.ok.html '//*[@class="prev"]' ''
1+ // @has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]//*[@class=" prev"]' ''
22// @has foobar/fn.ok.html '//*[@class="more-scraped-examples"]' ''
33
44pub fn ok ( ) { }
Original file line number Diff line number Diff line change 1+ deps := ex1 ex2
2+
3+ -include ../rustdoc-scrape-examples-multiple/scrape.mk
4+
5+ all : scrape
Original file line number Diff line number Diff line change 1+ fn main ( ) {
2+ foobar:: ok ( ) ;
3+
4+ // this is a
5+
6+ // BIG
7+
8+ // item
9+ }
Original file line number Diff line number Diff line change 1+ fn main ( ) {
2+ foobar:: ok ( ) ;
3+ // small item
4+ }
Original file line number Diff line number Diff line change 1+ // @has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]' 'ex2'
2+ // @has foobar/fn.ok.html '//*[@class="more-scraped-examples"]' 'ex1'
3+
4+ pub fn ok ( ) { }
Original file line number Diff line number Diff line change 1- -include ../../run-make-fulldeps/tools.mk
1+ deps := ex
22
3- OUTPUT_DIR := " $( TMPDIR ) /rustdoc"
3+ -include .. /rustdoc-scrape-examples-multiple/scrape.mk
44
5- all :
6- # 1. compile the library crate and emit an rmeta
7- $(RUSTC) src/lib.rs --crate-name foobar --crate-type lib --emit=metadata
8-
9- # 2. scrape examples from the reverse-dependency into an ex.calls file
10- $(RUSTDOC) examples/ex.rs --crate-name ex --crate-type bin --output $(OUTPUT_DIR) \
11- --extern foobar=$(TMPDIR)/libfoobar.rmeta \
12- -Z unstable-options \
13- --scrape-examples-output-path $(TMPDIR)/ex.calls \
14- --scrape-examples-target-crate foobar
15-
16- # 3. pass those examples to rustdoc when documenting the library crate
17- $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --output $(OUTPUT_DIR) \
18- -Z unstable-options \
19- --with-examples $(TMPDIR)/ex.calls
20-
21- # 4. check that the examples were scraped successfully
22- $(HTMLDOCCK) $(OUTPUT_DIR) src/lib.rs
5+ all : scrape
You can’t perform that action at this time.
0 commit comments