Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2251)

Unified Diff: build/toolchain/mac/BUILD.gn

Issue 2106353004: Implement "copy_bundle_data" tool without using a python script. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@create-bundle-deps
Patch Set: Use "pax" instead of "rsync" to use hard links when possible. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/toolchain/mac/copy_bundle_data.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/toolchain/mac/BUILD.gn
diff --git a/build/toolchain/mac/BUILD.gn b/build/toolchain/mac/BUILD.gn
index 231a546891d463367ebcdce18584116f5d5f92fa..66770d37af9d47c21cb4e49d1facb5729eae4a33 100644
--- a/build/toolchain/mac/BUILD.gn
+++ b/build/toolchain/mac/BUILD.gn
@@ -64,7 +64,6 @@ tool_versions =
exec_script("get_tool_mtime.py",
rebase_path([
"//build/toolchain/mac/compile_xcassets.py",
- "//build/toolchain/mac/copy_bundle_data.py",
"//build/toolchain/mac/filter_libtool.py",
"//build/toolchain/mac/linker_driver.py",
],
@@ -307,14 +306,36 @@ template("mac_toolchain") {
}
tool("copy_bundle_data") {
- if (is_ios) {
- _extra_args = "--strings-format=binary1"
- } else {
- _extra_args = ""
+ # copy_command use hardlink if possible but this does not work with
+ # directories. If source is a directory, instead use "pax" to create
+ # the same tree structure using hardlinks to individual files (this
+ # preserve symbolic links too) as recommended in the replies to the
+ # question at http://serverfault.com/q/209888/43689 ("cp -al" isn't
+ # available on macOS).
+ #
+ # According to the man page for pax, the commands to use to clone
+ # olddir to newdir using pax are the following:
+ #
+ # $ mkdir newdir
+ # $ cd olddir
+ # $ pax -rwl . ../newdir
+ #
+ # The _copydir command does exactly that but use an absolute path
+ # constructed using shell variable $OLDPWD (automatically set when
+ # cd is used) as computing the relative path is a bit complex.
+ _copydir = "mkdir -p {{output}} && cd {{source}} && " +
Robert Sesek 2016/07/01 15:12:17 I assume this cd is safe because we're running in
sdefresne 2016/07/04 09:12:53 Yes, the "cd" is safe as this is only changing the
+ "pax -rwl . \$OLDPWD/{{output}}"
Robert Sesek 2016/07/01 15:12:17 The substitution will handle shell escaping and qu
sdefresne 2016/07/04 09:12:53 Done.
+ _command = "if [[ -d {{source}} ]]; then " + _copydir + "; else " +
+ copy_command + "; fi"
+
+ _convert_strings = is_ios
+ if (_convert_strings) {
+ _convert = "plutil -convert binary1 -o {{output}} {{source}}"
+ _command = "case {{source}} in " + "*.strings) " + _convert + ";; " +
+ "*) " + _command + ";; esac"
}
- _tool = rebase_path("//build/toolchain/mac/copy_bundle_data.py",
- root_build_dir)
- command = "TOOL_VERSION=${tool_versions.copy_bundle_data} python $_tool ${_extra_args} {{source}} {{output}}"
+
+ command = "rm -rf {{output}} && " + _command
description = "COPY_BUNDLE_DATA {{source}} {{output}}"
pool = ":bundle_pool($default_toolchain)"
}
« no previous file with comments | « no previous file | build/toolchain/mac/copy_bundle_data.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698