The plist templates can have different values for the same key.
If the value is a list (plist array), merge should be the concatenation.
Don't compute union as as list can contain dicts.
BUG=692552
Review-Url: https://codereview.chromium.org/2715543002
Cr-Original-Commit-Position: refs/heads/master@{#452083}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 0cf3dac55d77555df465f3809e8f8636efef303d
The generation of PkgInfo is disabled for the moment (as come target
downstream already pack a PkgInfo file and enabling the target would
cause a non-deterministic build) and can be enabled by an undocumented
parameter write_pkg_info.
Update build/config/mac/write_pkg_info.py to support loading plist
in any format, not only xml1.
BUG=672516
Review-Url: https://codereview.chromium.org/2559323005
Cr-Original-Commit-Position: refs/heads/master@{#437551}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 8afe7bf6abf4c6c50b9c8f153e4ebf3cb045ef83
Reason for revert:
Reland after fixing mac builds.
Original issue's description:
> Revert of Remove unused build override (patchset #2 id:20001 of https://codereview.chromium.org/2498603002/ )
>
> Reason for revert:
> This breaks all the Mac builds.
>
> /b/build/slave/ios-simulator/build/src/buildtools/mac/gn gen //out/Debug-iphonesimulator --check
> -> returned 1
> ERROR at //build/config/mac/mac_sdk.gni:18:27: Undefined identifier
> mac_deployment_target = mac_deployment_target_build_override
> ^-----------------------------------
> See //build/toolchain/mac/BUILD.gn:14:1: whence it was imported.
> import("//build/config/mac/mac_sdk.gni")
> ^--------------------------------------
> See //BUILD.gn:73:1: which caused the file to be included.
> group("gn_all") {
> ^----------------
> GN gen failed: 1
>
> Original issue's description:
> > Remove unused build override
> >
> > The only downstream project using this used to be WebRTC, where it's no
> > longer needed.
> >
> > BUG=webrtc:6431
> > NOTRY=true
> >
> > Committed: https://crrev.com/6dd0024530bfa1d1f88840204633788bad70239e
> > Cr-Commit-Position: refs/heads/master@{#433856}
>
> TBR=dpranke@chromium.org,kjellander@chromium.org,kthelgason@webrtc.org,kthelgason@chromium.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:6431
>
> Committed: https://crrev.com/5638488a75f3e1424bedc0607e2183b9d0ad8f4a
> Cr-Commit-Position: refs/heads/master@{#433861}
TBR=dpranke@chromium.org,kjellander@chromium.org,kthelgason@webrtc.org,avi@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
BUG=webrtc:6431
Review-Url: https://codereview.chromium.org/2525673002
Cr-Original-Commit-Position: refs/heads/master@{#434157}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: e3f40e988d9487bfa030e714152fadc458d90e4a
Rather than trying to symlink as an action after producing the bundle, do it
as an early-stage action. As part of this, mac_framework_bundle callers need
to explicitly specify the top-level symlinks (framework_contents) that should
be created. Frameworks are now packaged like so:
1. At `gn gen` time, an exec_script runs to write the framework_version to a
file. If the previous value written does not match the new value, the entire
framework output directory is clobbered. This must be done at gen-time to
ensure nothing tries to clean the framework while also attempting to copy
to it.
2. Also at `gn gen` time, a TOC file for the framework_contents is written.
This allows the build to emulate depending on the presence of the top-level
symlinks, since ninja does not stat symlinks correctly.
https://github.com/ninja-build/ninja/issues/1186
3. The package_framework.py action now runs before the main create_bundle().
This action depends on the TOC file from (2) and will create all the
required symlinks in the bundle. At the time this runs, the symlink target
may not yet exist.
4. The create_bundle target is now always the leaf edge for
mac_framework_bundle, and it copies all bundle contents to the fully
versioned path (rather than through a symlink).
This should resolve the issue of the build not stabilizing between specifying
a framework_version and not.
BUG=648757
Review-Url: https://codereview.chromium.org/2487763002
Cr-Original-Commit-Position: refs/heads/master@{#430778}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 9522ddcc745f739414607811da8a2c6a17dbb17a
Add new template compile_plist that merge multiple plist files and
perform variables subsitutions and change info_plist implementation
to use it.
The new template will be used to compile entitlements files that
need different substitutions and do not use the one for Info.plist.
BUG=613543
Review-Url: https://codereview.chromium.org/2475893002
Cr-Original-Commit-Position: refs/heads/master@{#430269}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 7a7cd719032f146447c5b41ee6e243648ec0d397
Rename build/config/mac/gen_plist.py to build/config/mac/plist_util.py
after splitting the possible action (currently variable substitution and
plist merging).
Extend tweak_info_plist template to add another parameter info_plists
corresponding to a list of path to merge before tweaking (this allow for
adding partial plist files depending on configuration options).
Always pass the --platform variable based on the value of $current_os
to the tweak_info_plist template and make args optional.
Refactor info_plist template to use separate steps for merge and variable
substitution (as the script now implement them as two separate actions).
BUG=613543
Review-Url: https://codereview.chromium.org/2480433002
Cr-Original-Commit-Position: refs/heads/master@{#429830}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 9bb379e5fbd071abaf1359d724eb79b1ff6e7ceb
Write the current framework_version to a file at gen-time, and clobber the
entire framework bundle if it differs from the current value in the file.
This has to be done at gen-time because it is not possible to run a script at
the create_bundle stage before any other dependencies in its tree run. Take
this sample graph:
bundle_data --> shared_library
/
mac_framework_bundle
\
action("clean_framework_version")
It is not possible, from a mac_framework_bundle, to force the
clean_framework_version action to run before the shared_library. When the
action does run, its stamp will have a newer mtime than the shared_library.
Because bundle_data are hard linked into place, the link source file will
have an older mtime than the action, and the build will never stabilize.
BUG=648757
R=dpranke@chromium.org
Originally Committed: https://crrev.com/fed4fc1df8bab7159f19e04ed658c1f417e4e499
Reverted: https://crrev.com/d76ba00e6cc2625000d495e79bdc8d747645405e
Review-Url: https://codereview.chromium.org/2453043002
Cr-Original-Commit-Position: refs/heads/master@{#428366}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: a74b313db5f7444667bcf6530f1b2740884f4bfd
Reason for revert:
rules.gni file is causing the build failure.
------
/b/c/b/Google_Chrome_Mac/src/buildtools/mac/gn gen //out/Release --check
-> returned 1
ERROR at //build/config/mac/rules.gni:313:3: Script returned non-zero exit code.
exec_script("//build/config/mac/prepare_framework_version.py",
^----------
Current dir: /b/c/b/Google_Chrome_Mac/src/out/Release/
Command: python -- /b/c/b/Google_Chrome_Mac/src/build/config/mac/prepare_framework_version.py /b/c/b/Google_Chrome_Mac/src/out/Release/obj/ui/base/ui_unittests_framework_version /b/c/b/Google_Chrome_Mac/src/out/Release/ui_unittests Framework.framework ''
Returned 1.
Original issue's description:
> [Mac/GN] Fix rebuilds when changing framework_version of a mac_framework_bundle.
>
> Write the current framework_version to a file at gen-time, and clobber the
> entire framework bundle if it differs from the current value in the file.
>
> This has to be done at gen-time because it is not possible to run a script at
> the create_bundle stage before any other dependencies in its tree run. Take
> this sample graph:
>
> bundle_data --> shared_library
> /
> mac_framework_bundle
> \
> action("clean_framework_version")
>
> It is not possible, from a mac_framework_bundle, to force the
> clean_framework_version action to run before the shared_library. When the
> action does run, its stamp will have a newer mtime than the shared_library.
> Because bundle_data are hard linked into place, the link source file will
> have an older mtime than the action, and the build will never stabilize.
>
> BUG=648757
> R=dpranke@chromium.org
>
> Committed: https://crrev.com/fed4fc1df8bab7159f19e04ed658c1f417e4e499
> Cr-Commit-Position: refs/heads/master@{#428183}
TBR=dpranke@chromium.org,brettw@chromium.org,rsesek@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=648757
Review-Url: https://codereview.chromium.org/2453933006
Cr-Original-Commit-Position: refs/heads/master@{#428212}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: d76ba00e6cc2625000d495e79bdc8d747645405e
Write the current framework_version to a file at gen-time, and clobber the
entire framework bundle if it differs from the current value in the file.
This has to be done at gen-time because it is not possible to run a script at
the create_bundle stage before any other dependencies in its tree run. Take
this sample graph:
bundle_data --> shared_library
/
mac_framework_bundle
\
action("clean_framework_version")
It is not possible, from a mac_framework_bundle, to force the
clean_framework_version action to run before the shared_library. When the
action does run, its stamp will have a newer mtime than the shared_library.
Because bundle_data are hard linked into place, the link source file will
have an older mtime than the action, and the build will never stabilize.
BUG=648757
R=dpranke@chromium.org
Review-Url: https://codereview.chromium.org/2453043002
Cr-Original-Commit-Position: refs/heads/master@{#428183}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: fed4fc1df8bab7159f19e04ed658c1f417e4e499
This ensures that the hermetic toolchain is only used if use_system_xcode is
false. This CL also causes two changes:
* svn is assumed to be installed on the system. It is not pulled from the
hermetic toolchain.
* mac_sdk_build was used to populate the SDK version in the Info.plist. This
was being populated with a different version than the SDK being used to build
Chrome, which is incorrect.
BUG=651267
Review-Url: https://codereview.chromium.org/2412353003
Cr-Original-Commit-Position: refs/heads/master@{#425170}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 6218c34684254f1c090bf501f6c46b0a69b63ec5
The default is to produce a .app bundle. This CL also adds an option to produce
a .xpc bundle, which is a MH_EXECUTE-type bundle structure with a different
extension.
BUG=604809
Review-Url: https://codereview.chromium.org/2369583002
Cr-Original-Commit-Position: refs/heads/master@{#420760}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 5ebcfa81e37ff1ebb2ef4baf00096598631c5aa2
They should be created by default for sanitizer builds (and were w/
GYP), but that setting got lost in the GN migration.
Also, this CL corrects the default logic for enable_dsyms and
enable_stripping so that we only do this for internal official
builds by default, rather than for all "official" builds (
since is_official_build is really an optimization setting, not
a description of how things should be packaged).
R=rsesek@chromium.org, thakis@chromium.org, inferno@chromium.org
BUG=635242
Review-Url: https://codereview.chromium.org/2230723002
Cr-Original-Commit-Position: refs/heads/master@{#410979}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 8b0cda7f8d3f9a4f1d53c78600fb0c62c7eec7f9
When targeting iOS, do not enforce a specific version of the macOS
SDK (as the targets build with that SDK are only tool required for
the build using host_toolchain).
BUG=634373
Review-Url: https://codereview.chromium.org/2225203003
Cr-Original-Commit-Position: refs/heads/master@{#410886}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 750b90480e0fcc67e292444cfdc350171bdaed06
To simplify the creation of binary bundles on iOS, always use lipo
to create the final binary, even when not generating fat binaries
(in that case the lipo invocation is just a simple copy unless dSYM
generation or code stripping are enabled).
BUG=635302
Review-Url: https://codereview.chromium.org/2222753003
Cr-Original-Commit-Position: refs/heads/master@{#410600}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: c7091801f98c82e3a1a0aa5c89feed19738c713c
The ios_framework_bundle and mac_framework_bundle templates were
sharing part of the implementation via the framework_bundle. This
template is unnecessarily complex due to differences between iOS
and macOS build so remove it and inline the implementation in the
two OS specific templates.
BUG=None
Review-Url: https://codereview.chromium.org/2209973002
Cr-Original-Commit-Position: refs/heads/master@{#409966}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 9d5d9721db94c90e362f857be02b5f0de22a5219
Xcode 8 requires that simulator builds are code signed (no code signing
identity is required) so always enable code signing (but do not copy the
entitlements on simulator).
BUG=None
Review-Url: https://codereview.chromium.org/2206723003
Cr-Original-Commit-Position: refs/heads/master@{#409623}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 6bfffe7e86347e2018ca4c8dd32fe9ba97eb7ed8
Refactor the code to generate the entitlements file from codesign.py
in a file using the "generate-entitlements" command.
Only generate it for the default toolchain as Info.plist is only
generated for the default toolchain.
BUG=626686
Review-Url: https://codereview.chromium.org/2187343003
Cr-Original-Commit-Position: refs/heads/master@{#409248}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 0f93390b516605f8487de6ec12956b00c3291a6c
The bundle_deps should always be forwarded to the create_bundle target
even if code signing is enabled (otherwise the Info.plist is not copied
into the framework bundle).
BUG=621708
Review-Url: https://codereview.chromium.org/2179293005
Cr-Original-Commit-Position: refs/heads/master@{#407838}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 8a46dd22f51efdfa8d8df86771196c33f43dd9db
iOS framework requires a valid Info.plist file, so add support for
generating it to ios_framework_bundle template.
BUG=629867
Review-Url: https://codereview.chromium.org/2164393002
Cr-Original-Commit-Position: refs/heads/master@{#407127}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 4edf6105b4fc4b98d12b23d8bf74e96d130dce54
Allow to specify dependencies that are only used by the create_bundle
target when using ios_app_bundle or ios_framework_bundle templates to
increase parallelism.
BUG=629867
Review-Url: https://codereview.chromium.org/2169973002
Cr-Original-Commit-Position: refs/heads/master@{#407102}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 047490e7bb0d5c4ef2862a7059931fdec4e69ce9
The XCTest support (used for EarlGrey tests) requires linking against
XCTest.framework whose location is relative to sdk-platform-path, so
propagate via ios_sdk_platform_path variable in gn.
BUG=629867
Review-Url: https://codereview.chromium.org/2168873003
Cr-Original-Commit-Position: refs/heads/master@{#407093}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 4eba1aaa77f9e89b2b1cdf117a7e6fd8175436e4
It's not clear that we really need the GN arg `save_unstripped_output`
to be a user-configurable thing, so this change removes it from the
declare_arg() block in the build file and instead becomes a shorthand
for (enable_stripping && !enable_dsyms).
R=rsesek@chromium.org
BUG=623685, 628052
Review-Url: https://codereview.chromium.org/2163533002
Cr-Original-Commit-Position: refs/heads/master@{#406338}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 1b53b935fb9febdbc52456d8643b02a39c83b737
When creating fat binaries, the generation of the .dSYM file need to
use the fat binary and not the intermediate binaries. So for a fat
build, //build/config/mac:strip_all is an empty configuration and the
linker tools do not pass the flag requesting generation of the .dSYM
file to linker_driver.py, instead the flags are passed when "lipo" is
invoked.
Fix //build/toolchain/mac/linker_driver.py to look for both "-o" and
"-output" when looking for the linker output to allow wrapping "lipo"
in addition to the compiler linker (as "lipo" only accept "-output"
flag to specify the output file).
Always add //build/config/mac:strip_all to the dependencies of all
linkable targets on iOS (as is done on Mac) and fix cronet.
BUG=593582
Review-Url: https://codereview.chromium.org/2160653002
Cr-Original-Commit-Position: refs/heads/master@{#406253}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 6e714433f6749c3664ca816d1c64a488828ef75d
This declares a new GN arg save_unstripped_output that can be enabled if
enable_stripping=true. If true, then an unstripped copy of the linker output
will be saved in the output directory with an ".unstripped" suffix.
BUG=628052
R=mark@chromium.org
Review-Url: https://codereview.chromium.org/2157573002
Cr-Original-Commit-Position: refs/heads/master@{#406110}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 7fa0d497278e20eb8f38e02269f0e88d8cffa9c2
For a fat build, the "ios_framework_bundle" and "framework_bundle"
are a bit different for the non-default toolchain. The main target
is a shared library (instead of a bundle) and the "+link" target
depends on the "+link" target of the default toolchain (because it
is a fat binary framework so it make sense to link against that one).
The fat shared library is created using "lipo" to concatenate all
the thin shared libraries together.
BUG=603180
Review-Url: https://codereview.chromium.org/2135323002
Cr-Original-Commit-Position: refs/heads/master@{#405969}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 31139a2a7ffb3b502b0a963b45c391759b167154
This separates out the default values of configs for the various target types into well-named global variables that can be referred to in different places.
This allows us to move the set_defaults calls for various templates to the places where those templates are defined rather than putting them all in BUILDCONFIG. An example of this is the test() target defaults, where the actual template is declared in a .gni file but the defaults have to be global.
Review-Url: https://codereview.chromium.org/2150753002
Cr-Original-Commit-Position: refs/heads/master@{#405627}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: edb6ecc9667278999e8b885a4e79849887580d2d
When a modifier was used for a substitution, the modifier variable
value starts with a semi-colon but since the code was testing with
string without the semi-colon no substitution was performed.
The substitution rules for :identifier and :rfc1034identifier were
swapped (:rfc1034identifier is the one using '-').
If the value contained '_' the :rfc1034idenfifier modifier should
have substitued a '-' but didn't (gyp had the same issue, fixed by
https://codereview.chromium.org/2141973002/).
BUG=625875
Review-Url: https://codereview.chromium.org/2142903002
Cr-Original-Commit-Position: refs/heads/master@{#404814}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b17a345954748b984d68e06080ad9733339f4dd2
According to "gn help root_build_dir" the variable corresponds to the
current directory when executing all compilers and scripts. So when
building the command-line for compilers or scripts, "rebase_path"
must use "root_build_dir" instead of "root_out_dir" otherwise they
will break if building for non-default toolchain.
BUG=603180
Review-Url: https://codereview.chromium.org/2109133002
Cr-Original-Commit-Position: refs/heads/master@{#402825}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 9b9b27be5e7007fb73ef6e0087e452227d92bbc6
This moves another step performed by gyp-mac-tool into a standalone script. In
addition, support for more top-level bundle directories (e.g. Helpers, XPCServices,
etc.) is added.
BUG=616813,604809
R=sdefresne@chromium.org
Review-Url: https://codereview.chromium.org/2055673002
Cr-Original-Commit-Position: refs/heads/master@{#398884}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 51dc7dae178061bfcc559f16d85e43f2695efacf
This creates a new script called the linker driver, which runs all three
steps of linking: the image link, debug info link, and stripping. In GYP,
the last two steps were handled as postbuilds, but GN lacks those. Instead,
the linker driver performs all three operations in one build step.
BUG=330301,431177
R=mark@chromium.org,dpranke@chromium.org
Review-Url: https://codereview.chromium.org/1999513002
Cr-Original-Commit-Position: refs/heads/master@{#397880}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b89811bd0b77ae38f45359c6d78a5e06b997e499
Chrome on iOS needs to use tweak_info_plist, so port support
for info_plist_target from mac_info_plist to ios_info_plist.
BUG=617134
Review-Url: https://codereview.chromium.org/2033403003
Cr-Original-Commit-Position: refs/heads/master@{#397727}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: e0ab61670fb9d7826de41e313004a0e4d0379da6
Allowing the invoker of ios_info_plist output can help remove one
intermediate target when generating some bundles.
BUG=459705
Review-Url: https://codereview.chromium.org/1996913003
Cr-Original-Commit-Position: refs/heads/master@{#395073}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 59302f49921ea20fe7b6a722892c912f8ca84656
Use "xcrun" instead of "xcodebuild" as it is much faster and available
on all version of OS X supported for building Chrome.
Reduce running time of "gn gen" from 2.5 to 2.2s on MacBook Pro
laptop.
BUG=609541
Review-Url: https://codereview.chromium.org/1993653002
Cr-Original-Commit-Position: refs/heads/master@{#394505}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 268142df3c289fcd2605cd68f41e04ebade1067b