@@ -288,3 +288,67 @@ test!(rerun_if_changed_in_dep {
288
288
assert_that( p. cargo( "build" ) ,
289
289
execs( ) . with_status( 0 ) . with_stdout( "" ) ) ;
290
290
} ) ;
291
+
292
+ test ! ( same_build_dir_cached_packages {
293
+ let p = project( "foo" )
294
+ . file( "a1/Cargo.toml" , r#"
295
+ [package]
296
+ name = "a1"
297
+ version = "0.0.1"
298
+ authors = []
299
+ [dependencies]
300
+ b = { path = "../b" }
301
+ "# )
302
+ . file( "a1/src/lib.rs" , "" )
303
+ . file( "a2/Cargo.toml" , r#"
304
+ [package]
305
+ name = "a2"
306
+ version = "0.0.1"
307
+ authors = []
308
+ [dependencies]
309
+ b = { path = "../b" }
310
+ "# )
311
+ . file( "a2/src/lib.rs" , "" )
312
+ . file( "b/Cargo.toml" , r#"
313
+ [package]
314
+ name = "b"
315
+ version = "0.0.1"
316
+ authors = []
317
+ [dependencies]
318
+ c = { path = "../c" }
319
+ "# )
320
+ . file( "b/src/lib.rs" , "" )
321
+ . file( "c/Cargo.toml" , r#"
322
+ [package]
323
+ name = "c"
324
+ version = "0.0.1"
325
+ authors = []
326
+ [dependencies]
327
+ d = { path = "../d" }
328
+ "# )
329
+ . file( "c/src/lib.rs" , "" )
330
+ . file( "d/Cargo.toml" , r#"
331
+ [package]
332
+ name = "d"
333
+ version = "0.0.1"
334
+ authors = []
335
+ "# )
336
+ . file( "d/src/lib.rs" , "" )
337
+ . file( ".cargo/config" , r#"
338
+ [build]
339
+ target-dir = "./target"
340
+ "# ) ;
341
+ p. build( ) ;
342
+
343
+ assert_that( p. cargo( "build" ) . cwd( p. root( ) . join( "a1" ) ) ,
344
+ execs( ) . with_status( 0 ) . with_stdout( & format!( "\
345
+ {compiling} d v0.0.1 ({dir}/d)
346
+ {compiling} c v0.0.1 ({dir}/c)
347
+ {compiling} b v0.0.1 ({dir}/b)
348
+ {compiling} a1 v0.0.1 ({dir}/a1)
349
+ " , compiling = COMPILING , dir = p. url( ) ) ) ) ;
350
+ assert_that( p. cargo( "build" ) . cwd( p. root( ) . join( "a2" ) ) ,
351
+ execs( ) . with_status( 0 ) . with_stdout( & format!( "\
352
+ {compiling} a2 v0.0.1 ({dir}/a2)
353
+ " , compiling = COMPILING , dir = p. url( ) ) ) ) ;
354
+ } ) ;
0 commit comments