mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add "interface hash" for improved incremental builds.
Compute the hash of all interface tokens when parsing; write the interface hash to the swiftdeps file, or if the -dump-interface-hash option is passed to the frontend. This hash will be used in incremental mode to determine whether a file's interface has changed, and therefore whether dependent files need to be rebuilt in response to the change. Committed on ChrisW's behalf while he gets his setup unborked. rdar://problem/15352929 Swift SVN r30477
This commit is contained in:
49
utils/split_file.py
Executable file
49
utils/split_file.py
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
split_file.py [-o <dir>] <path>
|
||||
|
||||
Take the file at <path> and write it to multiple files, switching to a new file
|
||||
every time an annotation of the form "// BEGIN file1.swift" is encountered. If
|
||||
<dir> is specified, place the files in <dir>; otherwise, put them in the
|
||||
current directory.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import getopt
|
||||
|
||||
def usage():
|
||||
sys.stderr.write(__doc__.strip() + "\n")
|
||||
sys.exit(1)
|
||||
|
||||
fp_out = None
|
||||
dest_dir = '.'
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], 'o:h')
|
||||
for (opt, arg) in opts:
|
||||
if opt == '-o':
|
||||
dest_dir = arg
|
||||
elif opt == '-h':
|
||||
usage()
|
||||
except getopt.GetoptError:
|
||||
usage()
|
||||
|
||||
if len(args) != 1:
|
||||
usage()
|
||||
fp_in = open(args[0], 'r')
|
||||
|
||||
for line in fp_in:
|
||||
m = re.match(r'^//\s*BEGIN\s+([^\s]+)\s*$', line)
|
||||
if m:
|
||||
if fp_out:
|
||||
fp_out.close()
|
||||
fp_out = open(os.path.join(dest_dir, m.group(1)), 'w')
|
||||
elif fp_out:
|
||||
fp_out.write(line)
|
||||
|
||||
fp_in.close()
|
||||
if fp_out:
|
||||
fp_out.close()
|
||||
Reference in New Issue
Block a user