Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 mac_app_script = "//build/config/mac/mac_app.py" | |
| 6 | |
| 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)) | |
| 13 | |
| 14 action(target_name) { | |
| 15 sources = [ | |
| 16 invoker.entitlements_path, | |
| 17 ] | |
| 18 | |
| 19 _application_path = invoker.application_path | |
| 20 | |
| 21 script = mac_app_script | |
| 22 | |
| 23 outputs = [ | |
| 24 "$_application_path/_CodeSignature/CodeResources", | |
| 25 ] | |
| 26 | |
| 27 args = [ | |
| 28 "codesign", | |
| 29 "-p", | |
| 30 rebase_path(invoker.application_path, root_build_dir), | |
| 31 "-i", | |
| 32 invoker.identity, | |
| 33 "-e", | |
| 34 rebase_path(invoker.entitlements_path, root_build_dir), | |
| 35 ] | |
| 36 | |
| 37 forward_variables_from(invoker, | |
| 38 [ | |
| 39 "deps", | |
| 40 "public_deps", | |
| 41 "visibility", | |
| 42 ]) | |
| 43 } | |
| 44 } | |
| 45 | |
| 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") | |
| 50 | |
| 51 action_foreach(target_name) { | |
| 52 sources = invoker.sources | |
| 53 | |
| 54 script = mac_app_script | |
| 55 | |
| 56 invoker_out_dir = invoker.output_dir | |
| 57 | |
| 58 outputs = [ | |
| 59 "$root_build_dir/$invoker_out_dir/{{source_name_part}}.nib", | |
| 60 ] | |
| 61 | |
| 62 args = [ | |
| 63 "nib", | |
| 64 "-i", | |
| 65 "{{source}}", | |
| 66 "-o", | |
| 67 invoker_out_dir, | |
| 68 "-m", | |
| 69 invoker.module, | |
| 70 ] | |
| 71 } | |
| 72 | |
| 73 forward_variables_from(invoker, | |
| 74 [ | |
| 75 "deps", | |
| 76 "public_deps", | |
| 77 "visibility", | |
| 78 ]) | |
| 79 } | |
| 80 | |
| 81 template("resource_copy_mac") { | |
|
brettw
2015/08/06 18:07:27
This file seems weirdly the same as the iOS one. S
Dirk Pranke
2015/08/06 18:29:46
I think they can probably be merged, but I'd like
brettw
2015/08/06 19:35:10
Yes, we can do this in a follow-up.
| |
| 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") | |
| 86 | |
| 87 if (defined(invoker.app_name)) { | |
| 88 _app_name = invoker.app_name | |
| 89 } else { | |
| 90 _app_name = target_name | |
| 91 } | |
| 92 | |
| 93 _bundle_directory = invoker.bundle_directory | |
| 94 _resources = invoker.resources | |
| 95 | |
| 96 copy(target_name) { | |
| 97 set_sources_assignment_filter([]) | |
| 98 sources = _resources | |
| 99 outputs = [ | |
| 100 "$root_build_dir/$_app_name.app/$_bundle_directory/Contents/Resources/{{so urce_file_part}}", | |
| 101 ] | |
| 102 } | |
| 103 } | |
| 104 | |
| 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") | |
| 112 | |
| 113 group_gen_target_name = target_name | |
| 114 copy_all_target_name = target_name + "_all_copy" | |
| 115 | |
| 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 | |
| 119 } else { | |
| 120 _app_name = target_name | |
| 121 } | |
| 122 | |
| 123 # Generate the executable | |
| 124 bin_gen_target_name = target_name + "_bin" | |
| 125 executable(bin_gen_target_name) { | |
| 126 visibility = [ ":$group_gen_target_name" ] | |
| 127 deps = invoker.deps | |
| 128 output_name = app_name | |
| 129 } | |
| 130 | |
| 131 # Process the Info.plist | |
| 132 plist_gen_target_name = target_name + "_plist" | |
| 133 | |
| 134 action(plist_gen_target_name) { | |
| 135 visibility = [ ":$group_gen_target_name" ] | |
| 136 script = mac_app_script | |
| 137 | |
| 138 sources = [ | |
| 139 invoker.info_plist, | |
| 140 ] | |
| 141 outputs = [ | |
| 142 "$root_build_dir/Info.plist", | |
| 143 ] | |
| 144 | |
| 145 args = [ | |
| 146 "plist", | |
| 147 "-i", | |
| 148 rebase_path(invoker.info_plist, root_build_dir), | |
| 149 "-o", | |
| 150 rebase_path(root_build_dir), | |
| 151 ] | |
| 152 } | |
| 153 | |
| 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" ] | |
| 158 sources = [ | |
| 159 "$root_build_dir/Info.plist", | |
| 160 ] | |
| 161 | |
| 162 outputs = [ | |
| 163 "$root_build_dir/$app_name.app/Contents/{{source_file_part}}", | |
| 164 ] | |
| 165 | |
| 166 deps = [ | |
| 167 ":$plist_gen_target_name", | |
| 168 ] | |
| 169 } | |
| 170 | |
| 171 copy_bin_target_name = target_name + "_bin_copy" | |
| 172 copy(copy_bin_target_name) { | |
| 173 visibility = [ ":$group_gen_target_name" ] | |
| 174 sources = [ | |
| 175 "$root_build_dir/$app_name", | |
| 176 ] | |
| 177 | |
| 178 outputs = [ | |
| 179 "$root_build_dir/$app_name.app/Contents/MacOS/{{source_file_part}}", | |
| 180 ] | |
| 181 | |
| 182 deps = [ | |
| 183 ":$bin_gen_target_name", | |
| 184 ] | |
| 185 } | |
| 186 | |
| 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 | |
| 191 module = app_name | |
| 192 output_dir = "$app_name.app/Contents/Resources" | |
| 193 } | |
| 194 | |
| 195 group(copy_all_target_name) { | |
| 196 visibility = [ ":$group_gen_target_name" ] | |
| 197 deps = [ | |
| 198 ":$struct_gen_target_name", | |
| 199 ":$copy_plist_gen_target_name", | |
| 200 ":$copy_bin_target_name", | |
| 201 ":$copy_xib_target_name", | |
| 202 ] | |
| 203 } | |
| 204 | |
| 205 # Top level group | |
| 206 | |
| 207 group(group_gen_target_name) { | |
| 208 deps = [ | |
| 209 ":$copy_all_target_name", | |
| 210 ] | |
| 211 } | |
| 212 } | |
| OLD | NEW |