StyleGuide, "src/doc/style-guide", "style-guide";
);
-fn open(builder: &Builder<'_>, path: impl AsRef<Path>) {
- if builder.config.dry_run || !builder.config.cmd.open() {
- return;
- }
-
- let path = path.as_ref();
- builder.info(&format!("Opening doc {}", path.display()));
- if let Err(err) = opener::open(path) {
- builder.info(&format!("{}\n", err));
- }
-}
-
// "library/std" -> ["library", "std"]
//
// Used for deciding whether a particular step is one requested by the user on
let index = out.join("index.html");
let rustbook = builder.tool_exe(Tool::Rustbook);
let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook);
- if builder.config.dry_run || up_to_date(&src, &index) && up_to_date(&rustbook, &index) {
+ if builder.config.dry_run() || up_to_date(&src, &index) && up_to_date(&rustbook, &index) {
return;
}
builder.info(&format!("Rustbook ({}) - {}", target, name));
invoke_rustdoc(builder, compiler, &shared_assets, target, path);
}
- if builder.was_invoked_explicitly::<Self>(Kind::Doc) {
- let out = builder.doc_out(target);
- let index = out.join("book").join("index.html");
- open(builder, &index);
- }
+ let out = builder.doc_out(target);
+ let index = out.join("book").join("index.html");
+ builder.maybe_open_in_browser::<Self>(index);
}
}
&& up_to_date(&footer, &html)
&& up_to_date(&favicon, &html)
&& up_to_date(&full_toc, &html)
- && (builder.config.dry_run || up_to_date(&version_info, &html))
- && (builder.config.dry_run || up_to_date(&rustdoc, &html))
+ && (builder.config.dry_run() || up_to_date(&version_info, &html))
+ && (builder.config.dry_run() || up_to_date(&rustdoc, &html))
{
continue;
}
// with no particular explicit doc requested (e.g. library/core).
if builder.paths.is_empty() || builder.was_invoked_explicitly::<Self>(Kind::Doc) {
let index = out.join("index.html");
- open(builder, &index);
+ builder.open_in_browser(&index);
}
}
}
let version_input = builder.src.join("src").join("doc").join("version_info.html.template");
let version_info = out.join("version_info.html");
- if !builder.config.dry_run && !up_to_date(&version_input, &version_info) {
+ if !builder.config.dry_run() && !up_to_date(&version_input, &version_info) {
let info = t!(fs::read_to_string(&version_input))
.replace("VERSION", &builder.rust_release())
- .replace("SHORT_HASH", builder.rust_info.sha_short().unwrap_or(""))
- .replace("STAMP", builder.rust_info.sha().unwrap_or(""));
+ .replace("SHORT_HASH", builder.rust_info().sha_short().unwrap_or(""))
+ .replace("STAMP", builder.rust_info().sha().unwrap_or(""));
t!(fs::write(&version_info, &info));
}
for requested_crate in requested_crates {
if STD_PUBLIC_CRATES.iter().any(|k| *k == requested_crate.as_str()) {
let index = out.join(requested_crate).join("index.html");
- open(builder, &index);
+ builder.open_in_browser(index);
}
}
}
// Let's open the first crate documentation page:
if let Some(krate) = to_open {
let index = out.join(krate).join("index.html");
- open(builder, &index);
+ builder.open_in_browser(index);
}
}
}
}
fn symlink_dir_force(config: &Config, src: &Path, dst: &Path) -> io::Result<()> {
- if config.dry_run {
+ if config.dry_run() {
return Ok(());
}
if let Ok(m) = fs::symlink_metadata(dst) {
cmd.arg("--rustc");
cmd.arg(&rustc);
cmd.arg("--rustc-target").arg(&self.target.rustc_target_arg());
- if builder.config.verbose() {
+ if builder.is_verbose() {
cmd.arg("--verbose");
}
if self.validate {
name: INTERNER.intern_str("rustc"),
src: INTERNER.intern_path(out_base),
});
- if builder.was_invoked_explicitly::<Self>(Kind::Doc) {
- let out = builder.doc_out(self.target);
- let index = out.join("rustc").join("index.html");
- open(builder, &index);
- }
+
+ let out = builder.doc_out(self.target);
+ let index = out.join("rustc").join("index.html");
+ builder.maybe_open_in_browser::<Self>(index);
}
}