Add unstable option to only emit shared/crate-specific files

The intended use case is for docs.rs, which can now copy exactly the
files it cares about, rather than having to guess based on whether they
have a resource suffix or not. In particular, some files have a resource
suffix but cannot be shared between crates: https://github.com/rust-lang/docs.rs/pull/1312#issuecomment-798783688

The end goal is to fix https://github.com/rust-lang/docs.rs/issues/1327
by reverting https://github.com/rust-lang/docs.rs/pull/1324.

This obsoletes `--print=unversioned-files`, which I plan to remove as
soon as docs.rs stops using it.
This commit is contained in:
Joshua Nelson 2021-03-25 12:46:35 -04:00
parent 7c89cc4a6f
commit f77ebd4ffa
7 changed files with 129 additions and 12 deletions

View file

@ -0,0 +1,32 @@
-include ../../run-make-fulldeps/tools.mk
CRATE_ONLY = $(TMPDIR)/crate-only
TOOLCHAIN_ONLY = $(TMPDIR)/toolchain-only
ALL_SHARED = $(TMPDIR)/all-shared
all: crate-only toolchain-only all-shared
crate-only:
$(RUSTDOC) -Z unstable-options --emit=crate-specific --output $(CRATE_ONLY) --resource-suffix=-xxx x.rs
[ -e $(CRATE_ONLY)/search-index-xxx.js ]
[ -e $(CRATE_ONLY)/settings.html ]
[ -e $(CRATE_ONLY)/x/all.html ]
[ -e $(CRATE_ONLY)/x/index.html ]
! [ -e $(CRATE_ONLY)/storage-xxx.js ]
! [ -e $(CRATE_ONLY)/SourceSerifPro-It.ttf.woff ]
toolchain-only:
$(RUSTDOC) -Z unstable-options --emit=toolchain-shared-resources --output $(TOOLCHAIN_ONLY) --resource-suffix=-xxx x.rs
[ -e $(TOOLCHAIN_ONLY)/storage-xxx.js ]
! [ -e $(TOOLCHAIN_ONLY)/SourceSerifPro-It.ttf.woff ]
! [ -e $(TOOLCHAIN_ONLY)/search-index-xxx.js ]
! [ -e $(TOOLCHAIN_ONLY)/x/index.html ]
all-shared:
$(RUSTDOC) -Z unstable-options --emit=toolchain-shared-resources,unversioned-shared-resources --output $(ALL_SHARED) --resource-suffix=-xxx x.rs
[ -e $(ALL_SHARED)/storage-xxx.js ]
[ -e $(ALL_SHARED)/SourceSerifPro-It.ttf.woff ]
! [ -e $(ALL_SHARED)/search-index-xxx.js ]
! [ -e $(ALL_SHARED)/settings.html ]
! [ -e $(ALL_SHARED)/x ]
! [ -e $(ALL_SHARED)/src ]

View file

@ -0,0 +1 @@
// nothing to see here