1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 mac_app_script = "//build/config/mac/mac_app.py"
7 template("code_sign_mac") {
8 assert(defined(invoker.entitlements_path),
9 "The path to the entitlements .xcent file")
10 assert(defined(invoker.identity), "The code signing identity")
11 assert(defined(invoker.application_path), "The application to code sign")
12 assert(defined(invoker.deps))
16 invoker.entitlements_path,
19 _application_path = invoker.application_path
21 script = mac_app_script
24 "$_application_path/_CodeSignature/CodeResources",
30 rebase_path(invoker.application_path, root_build_dir),
34 rebase_path(invoker.entitlements_path, root_build_dir),
37 forward_variables_from(invoker,
46 template("process_nibs_mac") {
47 assert(defined(invoker.sources), "The nib sources must be specified")
48 assert(defined(invoker.module), "The nib module must be specified")
49 assert(defined(invoker.output_dir), "The output directory must be specified")
51 action_foreach(target_name) {
52 sources = invoker.sources
54 script = mac_app_script
56 invoker_out_dir = invoker.output_dir
59 "$root_build_dir/$invoker_out_dir/{{source_name_part}}.nib",
73 forward_variables_from(invoker,
81 template("resource_copy_mac") {
82 assert(defined(invoker.resources),
83 "The source list of resources to copy over")
84 assert(defined(invoker.bundle_directory),
85 "The directory within the bundle to place the sources in")
87 if (defined(invoker.app_name)) {
88 _app_name = invoker.app_name
90 _app_name = target_name
93 _bundle_directory = invoker.bundle_directory
94 _resources = invoker.resources
97 set_sources_assignment_filter([])
100 "$root_build_dir/$_app_name.app/$_bundle_directory/Contents/Resources/{{source_file_part}}",
105 template("mac_app") {
106 assert(defined(invoker.deps),
107 "Dependencies must be specified for $target_name")
108 assert(defined(invoker.info_plist),
109 "The application plist file must be specified for $target_name")
110 assert(defined(invoker.xibs),
111 "The list of XIB files must be specified for $target_name")
113 group_gen_target_name = target_name
114 copy_all_target_name = target_name + "_all_copy"
116 # We just create a variable so we can use the same in interpolation
117 if (defined(invoker.app_name)) {
118 _app_name = invoker.app_name
120 _app_name = target_name
123 # Generate the executable
124 bin_gen_target_name = target_name + "_bin"
125 executable(bin_gen_target_name) {
126 visibility = [ ":$group_gen_target_name" ]
128 output_name = app_name
131 # Process the Info.plist
132 plist_gen_target_name = target_name + "_plist"
134 action(plist_gen_target_name) {
135 visibility = [ ":$group_gen_target_name" ]
136 script = mac_app_script
142 "$root_build_dir/Info.plist",
148 rebase_path(invoker.info_plist, root_build_dir),
150 rebase_path(root_build_dir),
154 # Copy the generated binaries and assets to their appropriate locations
155 copy_plist_gen_target_name = target_name + "_plist_copy"
156 copy(copy_plist_gen_target_name) {
157 visibility = [ ":$group_gen_target_name" ]
159 "$root_build_dir/Info.plist",
163 "$root_build_dir/$app_name.app/Contents/{{source_file_part}}",
167 ":$plist_gen_target_name",
171 copy_bin_target_name = target_name + "_bin_copy"
172 copy(copy_bin_target_name) {
173 visibility = [ ":$group_gen_target_name" ]
175 "$root_build_dir/$app_name",
179 "$root_build_dir/$app_name.app/Contents/MacOS/{{source_file_part}}",
183 ":$bin_gen_target_name",
187 copy_xib_target_name = target_name + "_xib_copy"
188 process_nibs_mac(copy_xib_target_name) {
189 visibility = [ ":$group_gen_target_name" ]
190 sources = invoker.xibs
192 output_dir = "$app_name.app/Contents/Resources"
195 group(copy_all_target_name) {
196 visibility = [ ":$group_gen_target_name" ]
198 ":$struct_gen_target_name",
199 ":$copy_plist_gen_target_name",
200 ":$copy_bin_target_name",
201 ":$copy_xib_target_name",
207 group(group_gen_target_name) {
209 ":$copy_all_target_name",