@@ -1190,19 +1190,26 @@ def use_interpreter_for_simple_runs():
1190
1190
# path.
1191
1191
result += (
1192
1192
'env SWIFT_INTERPRETER=%r %s %r %s -module-name main %s %s %s '
1193
- % (config .swift , xcrun_prefix , config .swift , target_options ,
1194
- config .swift_test_options ,
1195
- config .swift_driver_test_options ,
1196
- swift_execution_tests_extra_flags ))
1193
+ % (
1194
+ escape_for_substitute_captures (config .swift ),
1195
+ escape_for_substitute_captures (xcrun_prefix ),
1196
+ escape_for_substitute_captures (config .swift ),
1197
+ escape_for_substitute_captures (target_options ),
1198
+ escape_for_substitute_captures (config .swift_test_options ),
1199
+ escape_for_substitute_captures (config .swift_driver_test_options ),
1200
+ escape_for_substitute_captures (swift_execution_tests_extra_flags )
1201
+ )
1202
+ )
1197
1203
if stdlib :
1198
1204
result += '-Xfrontend -disable-access-control '
1199
1205
if parameterized :
1200
- result += ' \ \ 1 '
1206
+ result += r' \1 '
1201
1207
if gyb :
1202
1208
result += '%t/main.swift'
1203
1209
else :
1204
1210
result += '%s'
1205
- return result
1211
+ return SubstituteCaptures (result )
1212
+
1206
1213
config .target_run_stdlib_swiftgyb = make_simple_target_run (gyb = True )
1207
1214
config .target_run_simple_swiftgyb = make_simple_target_run (gyb = True )
1208
1215
config .target_run_stdlib_swift = make_simple_target_run (stdlib = True )
@@ -1597,11 +1604,12 @@ if run_vendor == 'apple':
1597
1604
"%s %s %s" %
1598
1605
(xcrun_prefix , config .clangxx , config .target_cc_options ))
1599
1606
1600
- config .target_build_swift_dylib = (
1601
- "%s -parse-as-library -emit-library -o '\\ 1' "
1602
- "-Xlinker -install_name -Xlinker @executable_path/$(basename '\\ 1')"
1603
- % (config .target_build_swift ))
1604
- config .target_add_rpath = r'-Xlinker -rpath -Xlinker \1'
1607
+ config .target_build_swift_dylib = SubstituteCaptures (
1608
+ f"{ escape_for_substitute_captures (config .target_build_swift )} "
1609
+ r" -parse-as-library -emit-library -o '\1'"
1610
+ r" -Xlinker -install_name -Xlinker @executable_path/$(basename '\1')"
1611
+ )
1612
+ config .target_add_rpath = SubstituteCaptures (r'-Xlinker -rpath -Xlinker \1' )
1605
1613
1606
1614
target_future = format ('%s-apple-%s%s%s' % (run_cpu , run_os , target_future_version , run_environment ))
1607
1615
@@ -1833,10 +1841,11 @@ elif (run_os in ['linux-gnu', 'linux-gnueabihf', 'freebsd', 'openbsd', 'windows-
1833
1841
config .swift_test_options , config .swift_driver_test_options ,
1834
1842
swift_execution_tests_extra_flags ))
1835
1843
config .target_codesign = "echo"
1836
- config .target_build_swift_dylib = (
1837
- "%s -parse-as-library -emit-library -o '\\ 1'"
1838
- % (config .target_build_swift ))
1839
- config .target_add_rpath = r'-Xlinker -rpath -Xlinker \1'
1844
+ config .target_build_swift_dylib = SubstituteCaptures (
1845
+ f"{ escape_for_substitute_captures (config .target_build_swift )} "
1846
+ r" -parse-as-library -emit-library -o '\1'"
1847
+ )
1848
+ config .target_add_rpath = SubstituteCaptures (r'-Xlinker -rpath -Xlinker \1' )
1840
1849
config .target_swift_frontend = (
1841
1850
'%s -target %s %s %s %s %s '
1842
1851
% (config .swift_frontend , config .variant_triple , config .resource_dir_opt , mcp_opt ,
@@ -1926,11 +1935,11 @@ elif run_os == 'linux-androideabi' or run_os == 'linux-android':
1926
1935
config .resource_dir_opt , mcp_opt , config .swift_test_options ,
1927
1936
config .swift_driver_test_options , swift_execution_tests_extra_flags ])
1928
1937
config .target_codesign = "echo"
1929
- config .target_build_swift_dylib = ' ' . join ([
1930
- config .target_build_swift ,
1931
- ' -parse-as-library' , ' -emit-library' ,
1932
- '-o' , "' \\ 1'" ] )
1933
- config .target_add_rpath = r'-Xlinker -rpath -Xlinker \1'
1938
+ config .target_build_swift_dylib = SubstituteCaptures (
1939
+ f" { escape_for_substitute_captures ( config .target_build_swift ) } "
1940
+ r" -parse-as-library -emit-library -o '\1'"
1941
+ )
1942
+ config .target_add_rpath = SubstituteCaptures ( r'-Xlinker -rpath -Xlinker \1' )
1934
1943
config .target_swift_frontend = ' ' .join ([
1935
1944
config .swift_frontend ,
1936
1945
'-target' , config .variant_triple ,
@@ -2010,9 +2019,10 @@ elif run_os == 'wasi':
2010
2019
mcp_opt , config .swift_test_options ,
2011
2020
config .swift_driver_test_options , swift_execution_tests_extra_flags ])
2012
2021
config .target_codesign = "echo"
2013
- config .target_build_swift_dylib = (
2014
- "%s -parse-as-library -emit-library -static -o '\\ 1'"
2015
- % (config .target_build_swift ))
2022
+ config .target_build_swift_dylib = SubstituteCaptures (
2023
+ f"{ escape_for_substitute_captures (config .target_build_swift )} "
2024
+ r" -parse-as-library -emit-library -static -o '\1'"
2025
+ )
2016
2026
config .target_add_rpath = ''
2017
2027
config .target_swift_frontend = ' ' .join ([
2018
2028
config .swift_frontend ,
@@ -2093,9 +2103,10 @@ elif config.external_embedded_platform:
2093
2103
mcp_opt , config .swift_test_options ,
2094
2104
config .swift_driver_test_options , swift_execution_tests_extra_flags ])
2095
2105
config .target_codesign = "echo"
2096
- config .target_build_swift_dylib = (
2097
- "%s -parse-as-library -emit-library -static -o '\\ 1'"
2098
- % (config .target_build_swift ))
2106
+ config .target_build_swift_dylib = SubstituteCaptures (
2107
+ f"{ escape_for_substitute_captures (config .target_build_swift )} "
2108
+ r" -parse-as-library -emit-library -static -o '\1'"
2109
+ )
2099
2110
config .target_add_rpath = ''
2100
2111
config .target_swift_frontend = ' ' .join ([
2101
2112
config .swift_frontend ,
0 commit comments