Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 6c4f05c

Browse files
authored
Copy gen_snapshots using python's shutil.copy, avoid links (#55830)
Default implementation of copy does it via hardlink, which seems to be causing issues with Gatekeeper on mac. BUG=flutter/flutter#154437
1 parent 8828844 commit 6c4f05c

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

ci/licenses_golden/excluded_files

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@
436436
../../../flutter/sky/packages/sky_engine/README.md
437437
../../../flutter/sky/packages/sky_engine/lib/_embedder.yaml
438438
../../../flutter/sky/packages/sky_engine/pubspec.yaml
439+
../../../flutter/sky/tools/cp.py
439440
../../../flutter/sky/tools/create_embedder_framework.py
440441
../../../flutter/sky/tools/create_ios_framework.py
441442
../../../flutter/sky/tools/create_macos_binary.py

lib/snapshot/BUILD.gn

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,18 @@ if (host_os == "mac" && (target_os == "mac" || target_os == "ios")) {
201201
gen_snapshot_target =
202202
"$dart_src/runtime/bin:$gen_snapshot_target_name($build_toolchain)"
203203

204-
copy(target_name) {
204+
action(target_name) {
205+
script = "//flutter/sky/tools/cp.py"
206+
205207
# The toolchain-specific output directory. For cross-compiles, this is a
206208
# clang-x64 or clang-arm64 subdirectory of the top-level build directory.
207209
output_dir = get_label_info(gen_snapshot_target, "root_out_dir")
208210

209-
sources = [ "${output_dir}/${gen_snapshot_target_name}" ]
211+
args = [
212+
rebase_path("${output_dir}/${gen_snapshot_target_name}"),
213+
rebase_path(
214+
"${root_out_dir}/artifacts_$host_cpu/gen_snapshot_${target_cpu}"),
215+
]
210216
outputs =
211217
[ "${root_out_dir}/artifacts_$host_cpu/gen_snapshot_${target_cpu}" ]
212218
deps = [ gen_snapshot_target ]

sky/tools/cp.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env python3
2+
#
3+
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
4+
# Use of this source code is governed by a BSD-style license that can be
5+
# found in the LICENSE file.
6+
7+
"""Copy a file.
8+
9+
This module works much like the cp posix command - it takes 2 arguments:
10+
(src, dst) and copies the file with path |src| to |dst|.
11+
"""
12+
13+
import os
14+
import shutil
15+
import sys
16+
17+
18+
def main(src, dst):
19+
# Use copy instead of copyfile to ensure the executable bit is copied.
20+
shutil.copy(src, os.path.normpath(dst))
21+
return 0
22+
23+
24+
if __name__ == '__main__':
25+
sys.exit(main(sys.argv[1], sys.argv[2]))

0 commit comments

Comments
 (0)