// panic=abort and panic=unwind artifacts, additionally with various
// settings like debuginfo and whatnot.
unit.profile.hash(&mut hasher);
+ cx.used_in_plugin.contains(unit).hash(&mut hasher);
unit.mode.hash(&mut hasher);
if let Some(ref args) = bcx.extra_args_for(unit) {
args.hash(&mut hasher);
let mut queue = JobQueue::new(self.bcx);
self.prepare_units(export_dir, units)?;
self.prepare()?;
- self.build_used_in_plugin_map(units)?;
custom_build::build_map(&mut self, units)?;
for unit in units.iter() {
};
build_unit_dependencies(units, self.bcx, &mut self.unit_dependencies)?;
+ self.build_used_in_plugin_map(units)?;
let files = CompilationFiles::new(
units,
host_layout,
///
/// This will recursively walk `units` and all of their dependencies to
/// determine which crate are going to be used in plugins or not.
- pub fn build_used_in_plugin_map(&mut self, units: &[Unit<'a>]) -> CargoResult<()> {
+ fn build_used_in_plugin_map(&mut self, units: &[Unit<'a>]) -> CargoResult<()> {
let mut visited = HashSet::new();
for unit in units {
self.walk_used_in_plugin_map(unit, unit.target.for_host(), &mut visited)?;
assert_that(p.cargo("build -p foo"), execs().with_status(0));
assert_that(p.cargo("build -p bar"), execs().with_status(0));
}
+
+#[test]
+fn dont_rebuild_based_on_plugins() {
+ let p = project("p")
+ .file(
+ "Cargo.toml",
+ r#"
+ [package]
+ name = "foo"
+ version = "0.1.1"
+
+ [workspace]
+ members = ['bar']
+
+ [dependencies]
+ proc-macro-thing = { path = 'proc-macro-thing' }
+ "#,
+ )
+ .file("src/lib.rs", "")
+ .file(
+ "proc-macro-thing/Cargo.toml",
+ r#"
+ [package]
+ name = "proc-macro-thing"
+ version = "0.1.1"
+
+ [lib]
+ proc-macro = true
+
+ [dependencies]
+ baz = { path = '../baz' }
+ "#,
+ )
+ .file("proc-macro-thing/src/lib.rs", "")
+ .file(
+ "bar/Cargo.toml",
+ r#"
+ [package]
+ name = "bar"
+ version = "0.1.1"
+
+ [dependencies]
+ baz = { path = '../baz' }
+ "#,
+ )
+ .file("bar/src/main.rs", "fn main() {}")
+ .file(
+ "baz/Cargo.toml",
+ r#"
+ [package]
+ name = "baz"
+ version = "0.1.1"
+ "#,
+ )
+ .file("baz/src/lib.rs", "")
+ .build();
+
+ assert_that(p.cargo("build"), execs().with_status(0));
+ assert_that(p.cargo("build -p bar"), execs().with_status(0));
+ assert_that(
+ p.cargo("build"),
+ execs().with_status(0).with_stderr("[FINISHED] [..]\n"),
+ );
+ assert_that(
+ p.cargo("build -p bar"),
+ execs().with_status(0).with_stderr("[FINISHED] [..]\n"),
+ );
+}