@@ -6,14 +6,14 @@ use cargo::{
6
6
ops:: CompileOptions ,
7
7
GlobalContext ,
8
8
} ;
9
- use cargo_test_support:: compare;
10
9
use cargo_test_support:: paths:: { root, CargoPathExt } ;
11
10
use cargo_test_support:: registry:: Package ;
12
- use cargo_test_support:: tools;
13
11
use cargo_test_support:: {
14
12
basic_bin_manifest, basic_lib_manifest, basic_manifest, cargo_exe, git, is_nightly, main_file,
15
13
paths, process, project, rustc_host, sleep_ms, symlink_supported, t, Execs , ProjectBuilder ,
16
14
} ;
15
+ use cargo_test_support:: { cargo_process, compare} ;
16
+ use cargo_test_support:: { git_process, tools} ;
17
17
use cargo_util:: paths:: dylib_path_envvar;
18
18
use std:: env;
19
19
use std:: fs;
@@ -33,6 +33,58 @@ fn cargo_compile_simple() {
33
33
p. process ( & p. bin ( "foo" ) ) . with_stdout ( "i am foo\n " ) . run ( ) ;
34
34
}
35
35
36
+ #[ cargo_test]
37
+ fn build_with_symlink_to_path_dependency_with_build_script_in_git ( ) {
38
+ if !symlink_supported ( ) {
39
+ return ;
40
+ }
41
+
42
+ let root = paths:: root ( ) ;
43
+ git:: repo ( & root)
44
+ . nocommit_file (
45
+ "Cargo.toml" ,
46
+ r#"
47
+ [package]
48
+ name = "foo"
49
+ version = "0.1.0"
50
+ edition = "2021"
51
+
52
+ [dependencies]
53
+ # the path leads through a symlink, 'symlink-to-original' is a worktree root,
54
+ # and symlink-to-dir/ is a symlink to a sub-directory to be stepped through.
55
+ lib = { version = "0.1.0", path = "symlink-to-original/symlink-to-dir/lib" }
56
+ "# ,
57
+ )
58
+ . nocommit_file ( "src/main.rs" , "fn main() { }" )
59
+ . nocommit_file ( "original/dir/lib/build.rs" , "fn main() {}" )
60
+ . nocommit_file (
61
+ "original/dir/lib/Cargo.toml" ,
62
+ r#"
63
+ [package]
64
+ name = "lib"
65
+ version = "0.1.0"
66
+ edition = "2021"
67
+ "# ,
68
+ )
69
+ . nocommit_file ( "original/dir/lib/src/lib.rs" , "" )
70
+ . nocommit_symlink_dir ( "original" , "symlink-to-original" )
71
+ . nocommit_symlink_dir ( "original/dir" , "original/symlink-to-dir" )
72
+ . build ( ) ;
73
+
74
+ // It is necessary to have a sub-repository and to add files so there is an index.
75
+ git_process ( "init" )
76
+ . cwd ( root. join ( "original" ) )
77
+ . build_command ( )
78
+ . status ( )
79
+ . unwrap ( ) ;
80
+ git_process ( "add ." )
81
+ . cwd ( root. join ( "original" ) )
82
+ . build_command ( )
83
+ . status ( )
84
+ . unwrap ( ) ;
85
+ cargo_process ( "build" ) . run ( )
86
+ }
87
+
36
88
#[ cargo_test]
37
89
fn cargo_fail_with_no_stderr ( ) {
38
90
let p = project ( )
0 commit comments