Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/cargo/core/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub struct Manifest {
profiles: Profiles,
publish: bool,
replace: Vec<(PackageIdSpec, Dependency)>,
css_extension: Option<String>,
}

/// General metadata about a package which is just blindly uploaded to the
Expand Down Expand Up @@ -166,7 +167,8 @@ impl Manifest {
metadata: ManifestMetadata,
profiles: Profiles,
publish: bool,
replace: Vec<(PackageIdSpec, Dependency)>) -> Manifest {
replace: Vec<(PackageIdSpec, Dependency)>,
css_extension: Option<String>) -> Manifest {
Manifest {
summary: summary,
targets: targets,
Expand All @@ -178,6 +180,7 @@ impl Manifest {
profiles: profiles,
publish: publish,
replace: replace,
css_extension: css_extension,
}
}

Expand All @@ -197,6 +200,9 @@ impl Manifest {
pub fn links(&self) -> Option<&str> {
self.links.as_ref().map(|s| &s[..])
}
pub fn css_extension(&self) -> Option<&str> {
self.css_extension.as_ref().map(|s| &s[..])
}

pub fn add_warning(&mut self, s: String) {
self.warnings.push(s)
Expand Down
6 changes: 6 additions & 0 deletions src/cargo/ops/cargo_rustc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,12 @@ fn rustdoc(cx: &mut Context, unit: &Unit) -> CargoResult<Work> {
rustdoc.arg("--target").arg(target);
}

if let Some(css_extension) = unit.pkg.manifest().css_extension() {
// We need to activate nightly option to make this option available
rustdoc.arg("-Z").arg("unstable-options");
rustdoc.arg("--extend-css").arg(css_extension);
}

let doc_dir = cx.out_dir(unit);

// Create the documentation directory ahead of time as rustdoc currently has
Expand Down
5 changes: 4 additions & 1 deletion src/cargo/util/toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ pub struct TomlProject {
exclude: Option<Vec<String>>,
include: Option<Vec<String>>,
publish: Option<bool>,
css_extension: Option<String>,

// package metadata
description: Option<String>,
Expand Down Expand Up @@ -584,6 +585,7 @@ impl TomlManifest {

let exclude = project.exclude.clone().unwrap_or(Vec::new());
let include = project.include.clone().unwrap_or(Vec::new());
let css_extension = project.css_extension.clone();

let summary = try!(Summary::new(pkgid, deps,
self.features.clone()
Expand All @@ -609,7 +611,8 @@ impl TomlManifest {
metadata,
profiles,
publish,
replace);
replace,
css_extension);
if project.license_file.is_some() && project.license.is_some() {
manifest.add_warning(format!("only one of `license` or \
`license-file` is necessary"));
Expand Down