@@ -11,7 +11,8 @@ import shutil
11
11
from swift_build_support .swift_build_support import shell
12
12
13
13
14
- def merge_file_lists (src_root_dirs , skip_files , skip_subpaths ):
14
+ def merge_file_lists (src_root_dirs , explicit_src_files , skip_files ,
15
+ skip_subpaths ):
15
16
"""Merges the file lists recursively from all src_root_dirs supplied,
16
17
returning the union of all file paths found.
17
18
Files matching skip_files are ignored and skipped.
@@ -29,6 +30,12 @@ def merge_file_lists(src_root_dirs, skip_files, skip_subpaths):
29
30
dirs [:] = filter (
30
31
lambda dir : os .path .join (rel_dir , dir )
31
32
not in skip_subpaths , dirs )
33
+
34
+ for file in explicit_src_files :
35
+ # If this is an absolute installation path, e.g. /Applications/Xcode/...,
36
+ # treat it as being relative to a built toolchain
37
+ relative_path = file [1 :] if file .startswith ("/" ) else file
38
+ file_list .append (relative_path ) if relative_path not in file_list else file_list
32
39
return file_list
33
40
34
41
@@ -129,6 +136,15 @@ binaries.
129
136
default = ".DS_Store" ,
130
137
help = "Files to ignore and skip merge/copy, default " +
131
138
"is \" .DS_Store\" " )
139
+ # A list of files which this script will ensure are merged using lipo.
140
+ # The intent is to allow for exceptions to binaries located under
141
+ # `copy-subdirs` that are not built fat. However, if more such exceptions
142
+ # are added, it would be better to re-think our approach to a more-general
143
+ # solution.
144
+ parser .add_argument ("--explicit-src-files" , metavar = "<explicit-source-files>" ,
145
+ default = "" ,
146
+ help = "Optional list of files which should be merged to " +
147
+ "be installed" )
132
148
parser .add_argument ("--copy-subdirs" , metavar = "<subdirs-to-copy-verbatim>" ,
133
149
default = "" ,
134
150
help = "Optional list of subdirectory paths that " +
@@ -145,11 +161,12 @@ binaries.
145
161
args = parser .parse_args ()
146
162
147
163
skip_files = args .skip_files .split ()
164
+ explicit_sources = args .explicit_src_files .split ()
148
165
copy_verbatim_subpaths = [
149
166
subdir .strip ('/' ) for subdir in args .copy_subdirs .split ()]
150
167
151
- file_list = merge_file_lists (args .src_root_dirs , skip_files ,
152
- copy_verbatim_subpaths )
168
+ file_list = merge_file_lists (args .src_root_dirs , explicit_sources ,
169
+ skip_files , copy_verbatim_subpaths )
153
170
154
171
if args .verbose :
155
172
print ("Discovered files and dirs: %s" % file_list )
0 commit comments