From f2682e98097724b5d05590fe0fdc34e381d10157 Mon Sep 17 00:00:00 2001 From: Chatura Atapattu Date: Thu, 20 Feb 2025 15:42:36 -0800 Subject: [PATCH] Back out verify magic number of swift incremental output Reviewed By: rmaz Differential Revision: D69931903 fbshipit-source-id: 6001c0281b923f53f538f7dcebd2293dc4783add --- prelude/apple/tools/swift_exec.py | 38 ------------------------------- 1 file changed, 38 deletions(-) diff --git a/prelude/apple/tools/swift_exec.py b/prelude/apple/tools/swift_exec.py index 7e834afe503ee..ef0d76b991bbb 100755 --- a/prelude/apple/tools/swift_exec.py +++ b/prelude/apple/tools/swift_exec.py @@ -81,41 +81,6 @@ def replace_module_prefixes(match): f.truncate() -def _read_output_file_map(command): - for i in range(len(command)): - if command[i] == "-output-file-map": - with open(command[i + 1]) as f: - return json.load(f) - - return None - - -def _validate_file_type_of_incremental_output(command): - output_file_map = _read_output_file_map(command) - if output_file_map is None: - print("Failed to read output file map", file=sys.stderr) - sys.exit(1) - - for _, outputs in output_file_map.items(): - swiftdeps = outputs.get("swift-dependencies", None) - if swiftdeps: - with open(swiftdeps, "rb") as f: - magic = f.read(4) - if not (magic == b"DDEP" or magic == b"DEPS"): - print( - f"Invalid magic number in {swiftdeps}: {magic}", file=sys.stderr - ) - sys.exit(1) - - obj = outputs.get("object", None) - if obj: - with open(obj, "rb") as f: - magic = f.read(4) - if magic != b"\xcf\xfa\xed\xfe": - print(f"Invalid magic number in {obj}: {magic}", file=sys.stderr) - sys.exit(1) - - def main(): env = os.environ.copy() if "INSIDE_RE_WORKER" in env and _RE_TMPDIR_ENV_VAR in env: @@ -190,9 +155,6 @@ def main(): if should_remove_module_prefixes: _remove_swiftinterface_module_prefixes(command) - if "-incremental" in command: - _validate_file_type_of_incremental_output(command) - sys.exit(result.returncode)