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

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: Quote use of $OLDPWD. Created 4 years, 5 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..a5ff08faffad70413eba86ad297d98e48531be61 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,39 @@ 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 and
+ # using pwd would requires a sub-shell to be created.
+ _copydir = "mkdir -p {{output}} && cd {{source}} && " +
+ "pax -rwl . \"\$OLDPWD\"/{{output}}"
+ _command = "if [[ -d {{source}} ]]; then " + _copydir + "; else " +
+ copy_command + "; fi"
+
+ # TODO(crbug.com/625578): Remove this conversion on iOS once all the
+ # bundle_data target have been fixed to reference converted files.
+ _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