Rename CrateSpecific -> InvocationSpecific

This commit is contained in:
Joshua Nelson 2021-03-31 11:35:57 -04:00
parent d4f3f91c48
commit 1086d9b7b5
4 changed files with 22 additions and 22 deletions

View File

@ -274,7 +274,7 @@ crate struct RenderOptions {
crate enum EmitType {
Unversioned,
Toolchain,
CrateSpecific,
InvocationSpecific,
}
impl FromStr for EmitType {
@ -285,7 +285,7 @@ impl FromStr for EmitType {
match s {
"unversioned-shared-resources" => Ok(Unversioned),
"toolchain-shared-resources" => Ok(Toolchain),
"crate-specific" => Ok(CrateSpecific),
"invocation-specific" => Ok(InvocationSpecific),
_ => Err(()),
}
}
@ -293,7 +293,7 @@ impl FromStr for EmitType {
impl RenderOptions {
crate fn should_emit_crate(&self) -> bool {
self.emit.is_empty() || self.emit.contains(&EmitType::CrateSpecific)
self.emit.is_empty() || self.emit.contains(&EmitType::InvocationSpecific)
}
}

View File

@ -49,10 +49,10 @@ enum SharedResource<'a> {
///
/// It has a resource suffix.
ToolchainSpecific { basename: &'static str },
/// This file may change for any crate within a build.
/// This file may change for any crate within a build, or based on the CLI arguments.
///
/// This differs from normal crate-specific files because it has a resource suffix.
CrateSpecific { basename: &'a str },
/// This differs from normal invocation-specific files because it has a resource suffix.
InvocationSpecific { basename: &'a str },
}
impl SharedResource<'_> {
@ -61,7 +61,7 @@ impl SharedResource<'_> {
match self {
Unversioned { name }
| ToolchainSpecific { basename: name }
| CrateSpecific { basename: name } => Path::new(name).extension(),
| InvocationSpecific { basename: name } => Path::new(name).extension(),
}
}
@ -69,7 +69,7 @@ impl SharedResource<'_> {
match self {
SharedResource::Unversioned { name } => cx.dst.join(name),
SharedResource::ToolchainSpecific { basename } => cx.suffix_path(basename),
SharedResource::CrateSpecific { basename } => cx.suffix_path(basename),
SharedResource::InvocationSpecific { basename } => cx.suffix_path(basename),
}
}
@ -80,7 +80,7 @@ impl SharedResource<'_> {
let kind = match self {
SharedResource::Unversioned { .. } => EmitType::Unversioned,
SharedResource::ToolchainSpecific { .. } => EmitType::Toolchain,
SharedResource::CrateSpecific { .. } => EmitType::CrateSpecific,
SharedResource::InvocationSpecific { .. } => EmitType::InvocationSpecific,
};
emit.contains(&kind)
}
@ -165,7 +165,7 @@ pub(super) fn write_shared(
// Crate resources should always be dynamic.
let write_crate = |p: &_, make_content: &dyn Fn() -> Result<Vec<u8>, Error>| {
let content = make_content()?;
cx.write_shared(SharedResource::CrateSpecific { basename: p }, content, &options.emit)
cx.write_shared(SharedResource::InvocationSpecific { basename: p }, content, &options.emit)
};
// Add all the static files. These may already exist, but we just

View File

@ -532,7 +532,7 @@ fn opts() -> Vec<RustcOptGroup> {
"",
"emit",
"Comma separated list of types of output for rustdoc to emit",
"[unversioned-shared-resources,toolchain-shared-resources,crate-specific]",
"[unversioned-shared-resources,toolchain-shared-resources,invocation-specific]",
)
}),
]

View File

@ -1,21 +1,21 @@
-include ../../run-make-fulldeps/tools.mk
CRATE_ONLY = $(TMPDIR)/crate-only
INVOCATION_ONLY = $(TMPDIR)/invocation-only
TOOLCHAIN_ONLY = $(TMPDIR)/toolchain-only
ALL_SHARED = $(TMPDIR)/all-shared
all: crate-only toolchain-only all-shared
all: invocation-only toolchain-only all-shared
crate-only:
$(RUSTDOC) -Z unstable-options --emit=crate-specific --output $(CRATE_ONLY) --resource-suffix=-xxx --theme y.css 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 ]
invocation-only:
$(RUSTDOC) -Z unstable-options --emit=invocation-specific --output $(INVOCATION_ONLY) --resource-suffix=-xxx --theme y.css x.rs
[ -e $(INVOCATION_ONLY)/search-index-xxx.js ]
[ -e $(INVOCATION_ONLY)/settings.html ]
[ -e $(INVOCATION_ONLY)/x/all.html ]
[ -e $(INVOCATION_ONLY)/x/index.html ]
# FIXME: this probably shouldn't have a suffix
[ -e $(CRATE_ONLY)/y-xxx.css ]
! [ -e $(CRATE_ONLY)/storage-xxx.js ]
! [ -e $(CRATE_ONLY)/SourceSerifPro-It.ttf.woff ]
[ -e $(INVOCATION_ONLY)/y-xxx.css ]
! [ -e $(INVOCATION_ONLY)/storage-xxx.js ]
! [ -e $(INVOCATION_ONLY)/SourceSerifPro-It.ttf.woff ]
toolchain-only:
$(RUSTDOC) -Z unstable-options --emit=toolchain-shared-resources --output $(TOOLCHAIN_ONLY) --resource-suffix=-xxx x.rs