@@ -42,6 +42,16 @@ def is_before_build_script_impl_product(cls):
42
42
def should_build (self , host_target ):
43
43
return True
44
44
45
+ def _get_test_environment (self , host_target ):
46
+ env = {}
47
+ if platform .system () == 'Darwin' :
48
+ # the resulting binaries would search first in /usr/lib/swift,
49
+ # we need to prefer the libraries we just built
50
+ env ['DYLD_LIBRARY_PATH' ] = os .path .join (
51
+ _get_toolchain_path (host_target , self , self .args ),
52
+ 'usr' , 'lib' , 'swift' , 'macosx' )
53
+ return env
54
+
45
55
def run_bootstrap_script (
46
56
self ,
47
57
action ,
@@ -50,6 +60,8 @@ def run_bootstrap_script(
50
60
* ,
51
61
compile_only_for_running_host_architecture = False ,
52
62
):
63
+ test_environment = self ._get_test_environment (host_target )
64
+
53
65
script_path = os .path .join (
54
66
self .source_dir , 'Utilities' , 'bootstrap' )
55
67
@@ -115,7 +127,7 @@ def run_bootstrap_script(
115
127
116
128
helper_cmd .extend (additional_params )
117
129
118
- shell .call (helper_cmd )
130
+ shell .call (helper_cmd , env = test_environment )
119
131
120
132
def build (self , host_target ):
121
133
self .run_bootstrap_script (
0 commit comments