Skip to content

Commit f2682e9

Browse files
Back out verify magic number of swift incremental output
Reviewed By: rmaz Differential Revision: D69931903 fbshipit-source-id: 6001c0281b923f53f538f7dcebd2293dc4783add
1 parent a3a2b68 commit f2682e9

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

prelude/apple/tools/swift_exec.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -81,41 +81,6 @@ def replace_module_prefixes(match):
8181
f.truncate()
8282

8383

84-
def _read_output_file_map(command):
85-
for i in range(len(command)):
86-
if command[i] == "-output-file-map":
87-
with open(command[i + 1]) as f:
88-
return json.load(f)
89-
90-
return None
91-
92-
93-
def _validate_file_type_of_incremental_output(command):
94-
output_file_map = _read_output_file_map(command)
95-
if output_file_map is None:
96-
print("Failed to read output file map", file=sys.stderr)
97-
sys.exit(1)
98-
99-
for _, outputs in output_file_map.items():
100-
swiftdeps = outputs.get("swift-dependencies", None)
101-
if swiftdeps:
102-
with open(swiftdeps, "rb") as f:
103-
magic = f.read(4)
104-
if not (magic == b"DDEP" or magic == b"DEPS"):
105-
print(
106-
f"Invalid magic number in {swiftdeps}: {magic}", file=sys.stderr
107-
)
108-
sys.exit(1)
109-
110-
obj = outputs.get("object", None)
111-
if obj:
112-
with open(obj, "rb") as f:
113-
magic = f.read(4)
114-
if magic != b"\xcf\xfa\xed\xfe":
115-
print(f"Invalid magic number in {obj}: {magic}", file=sys.stderr)
116-
sys.exit(1)
117-
118-
11984
def main():
12085
env = os.environ.copy()
12186
if "INSIDE_RE_WORKER" in env and _RE_TMPDIR_ENV_VAR in env:
@@ -190,9 +155,6 @@ def main():
190155
if should_remove_module_prefixes:
191156
_remove_swiftinterface_module_prefixes(command)
192157

193-
if "-incremental" in command:
194-
_validate_file_type_of_incremental_output(command)
195-
196158
sys.exit(result.returncode)
197159

198160

0 commit comments

Comments
 (0)