Add support for partial Info.plist from actool.
Change ios_app_bundle template to merge the generated Info.plist with the partial .plist created by the asset catalog compiler to support compiling application icon to Assets.car as is required for application built with iOS 11.0 SDK. Quote args of compile_xcasset.py in build/toolchain/mac/BUILD.gn as some of them may be empty or contain shell special characters (mostly spaces). Bug: 764286 Change-Id: I453f3cbb34c82483bace9900c49e0f3b351b2635 Reviewed-on: https://chromium-review.googlesource.com/671050 Commit-Queue: Sylvain Defresne <sdefresne@chromium.org> Reviewed-by: Scott Graham <scottmg@chromium.org> Reviewed-by: Robert Sesek <rsesek@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#503129} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: d73f3454a10aa2d20f50f1b145148380649e7849
This commit is contained in:
Родитель
7dd65b231a
Коммит
befea16e06
|
@ -172,15 +172,27 @@ template("lipo_binary") {
|
|||
# (optional) string, name of the test application for Xcode unit or ui
|
||||
# test target.
|
||||
#
|
||||
# primary_info_plist:
|
||||
# (optional) path to Info.plist to merge with the $partial_info_plist
|
||||
# generated by the compilation of the asset catalog.
|
||||
#
|
||||
# partial_info_plist:
|
||||
# (optional) path to the partial Info.plist generated by the asset
|
||||
# catalog compiler; if defined $primary_info_plist must also be defined.
|
||||
#
|
||||
template("create_signed_bundle") {
|
||||
assert(defined(invoker.product_type),
|
||||
"product_type must be defined for $target_name")
|
||||
assert(defined(invoker.bundle_extension),
|
||||
"bundle_extension must be defined for $target_name")
|
||||
assert(
|
||||
defined(invoker.bundle_binary_target) !=
|
||||
defined(invoker.bundle_binary_path),
|
||||
"Only one of bundle_binary_target or bundle_binary_path may be specified in " + target_name)
|
||||
assert(defined(invoker.bundle_binary_target) !=
|
||||
defined(invoker.bundle_binary_path),
|
||||
"Only one of bundle_binary_target or bundle_binary_path may be " +
|
||||
"specified for $target_name")
|
||||
assert(!defined(invoker.partial_info_plist) ||
|
||||
defined(invoker.primary_info_plist),
|
||||
"primary_info_plist must be defined when partial_info_plist is " +
|
||||
"defined for $target_name")
|
||||
|
||||
if (defined(invoker.xcode_test_application_name)) {
|
||||
assert(
|
||||
|
@ -237,6 +249,7 @@ template("create_signed_bundle") {
|
|||
"bundle_deps_filter",
|
||||
"data_deps",
|
||||
"deps",
|
||||
"partial_info_plist",
|
||||
"product_type",
|
||||
"public_configs",
|
||||
"public_deps",
|
||||
|
@ -319,6 +332,25 @@ template("create_signed_bundle") {
|
|||
code_signing_args += [ "-F=" + _framework ]
|
||||
}
|
||||
}
|
||||
if (defined(invoker.partial_info_plist)) {
|
||||
_partial_info_plists = [
|
||||
invoker.primary_info_plist,
|
||||
invoker.partial_info_plist,
|
||||
]
|
||||
|
||||
_plist_compiler_path = "//build/config/mac/plist_util.py"
|
||||
|
||||
code_signing_sources += _partial_info_plists
|
||||
code_signing_sources += [ _plist_compiler_path ]
|
||||
code_signing_outputs += [ "$bundle_root_dir/Info.plist" ]
|
||||
|
||||
code_signing_args +=
|
||||
[ "-P=" + rebase_path(_plist_compiler_path, root_build_dir) ]
|
||||
foreach(_partial_info_plist, _partial_info_plists) {
|
||||
code_signing_args +=
|
||||
[ "-p=" + rebase_path(_partial_info_plist, root_build_dir) ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -646,19 +678,6 @@ template("ios_app_bundle") {
|
|||
}
|
||||
}
|
||||
|
||||
_bundle_data_info_plist = target_name + "_bundle_data_info_plist"
|
||||
bundle_data(_bundle_data_info_plist) {
|
||||
forward_variables_from(invoker, [ "testonly" ])
|
||||
|
||||
sources = get_target_outputs(":$_generate_info_plist")
|
||||
outputs = [
|
||||
"{{bundle_root_dir}}/Info.plist",
|
||||
]
|
||||
public_deps = [
|
||||
":$_generate_info_plist",
|
||||
]
|
||||
}
|
||||
|
||||
_app_product_type = "com.apple.product-type.application"
|
||||
_product_type = _app_product_type
|
||||
if (defined(invoker.product_type)) {
|
||||
|
@ -731,11 +750,20 @@ template("ios_app_bundle") {
|
|||
bundle_extension = _bundle_extension
|
||||
product_type = _product_type
|
||||
|
||||
if (!defined(bundle_deps)) {
|
||||
bundle_deps = []
|
||||
_generate_info_plist_outputs =
|
||||
get_target_outputs(":$_generate_info_plist")
|
||||
primary_info_plist = _generate_info_plist_outputs[0]
|
||||
partial_info_plist = "$target_gen_dir/${_target_name}_partial_info.plist"
|
||||
|
||||
if (!defined(deps)) {
|
||||
deps = []
|
||||
}
|
||||
bundle_deps += [ ":$_bundle_data_info_plist" ]
|
||||
deps += [ ":$_generate_info_plist" ]
|
||||
|
||||
if (_write_pkg_info) {
|
||||
if (!defined(bundle_deps)) {
|
||||
bundle_deps = []
|
||||
}
|
||||
bundle_deps += [ ":$_bundle_data_pkg_info" ]
|
||||
}
|
||||
|
||||
|
|
|
@ -96,6 +96,12 @@ def SavePList(path, format, data):
|
|||
"""Saves |data| as a Plist to |path| in the specified |format|."""
|
||||
fd, name = tempfile.mkstemp()
|
||||
try:
|
||||
# "plutil" does not replace the destination file but update it in place,
|
||||
# so if more than one hardlink points to destination all of them will be
|
||||
# modified. This is not what is expected, so delete destination file if
|
||||
# it does exist.
|
||||
if os.path.exists(path):
|
||||
os.unlink(path)
|
||||
with os.fdopen(fd, 'w') as f:
|
||||
plistlib.writePlist(data, f)
|
||||
subprocess.check_call(['plutil', '-convert', format, '-o', path, name])
|
||||
|
|
|
@ -437,11 +437,12 @@ template("mac_toolchain") {
|
|||
_min_deployment_target = mac_deployment_target
|
||||
_compress_pngs = " -c "
|
||||
}
|
||||
command = "$env_wrapper rm -f {{output}} && " +
|
||||
"TOOL_VERSION=${tool_versions.compile_xcassets} " +
|
||||
"python $_tool -p $_sdk_name -t $_min_deployment_target " +
|
||||
"$_compress_pngs -T {{bundle_product_type}} -o {{output}} " +
|
||||
"{{inputs}}"
|
||||
command =
|
||||
"$env_wrapper rm -f \"{{output}}\" && " +
|
||||
"TOOL_VERSION=${tool_versions.compile_xcassets} " +
|
||||
"python $_tool$_compress_pngs -p \"$_sdk_name\" " +
|
||||
"-t \"$_min_deployment_target\" -T \"{{bundle_product_type}}\" " +
|
||||
"-P \"{{bundle_partial_info_plist}}\" -o {{output}} {{inputs}}"
|
||||
|
||||
description = "COMPILE_XCASSETS {{output}}"
|
||||
pool = ":bundle_pool($default_toolchain)"
|
||||
|
|
Загрузка…
Ссылка в новой задаче