Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("//build/toolchain/toolchain.gni") | 5 import("//build/toolchain/toolchain.gni") |
| 6 import("//build/config/mac/mac_sdk.gni") | |
| 6 | 7 |
| 7 # This is used as the base template for both iOS and Mac frameworks.. | 8 # This is used as the base template for both iOS and Mac frameworks.. |
| 8 # | 9 # |
| 9 # Arguments | 10 # Arguments |
| 10 # | 11 # |
| 11 # output_name: | 12 # output_name: |
| 12 # (optional) string, name of the generated framework without the | 13 # (optional) string, name of the generated framework without the |
| 13 # .framework suffix. If omitted, defaults to target_name. | 14 # .framework suffix. If omitted, defaults to target_name. |
| 14 # | 15 # |
| 15 # framework_version: | 16 # framework_version: |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 "$_framework_name", | 131 "$_framework_name", |
| 131 "$_framework_version", | 132 "$_framework_version", |
| 132 ] | 133 ] |
| 133 public_deps = [ | 134 public_deps = [ |
| 134 ":$_framework_target", | 135 ":$_framework_target", |
| 135 ] | 136 ] |
| 136 } | 137 } |
| 137 } | 138 } |
| 138 } | 139 } |
| 139 | 140 |
| 141 # Template to combile .xib or .storyboard files. | |
| 142 # | |
| 143 # | |
| 144 # Arguments | |
| 145 # | |
| 146 # sources: | |
| 147 # list of string, sources to compile | |
| 148 # | |
| 149 # ibtool_flags: | |
| 150 # (optional) list of string, additional flags to pass to the ibtool | |
| 151 template("compile_xibs") { | |
| 152 action_foreach(target_name) { | |
| 153 forward_variables_from(invoker, | |
| 154 [ | |
| 155 "testonly", | |
| 156 "visibility", | |
| 157 ]) | |
| 158 assert(defined(invoker.sources), | |
| 159 "Sources must be specified for $target_name") | |
| 160 | |
| 161 ibtool_flags = [] | |
| 162 if (defined(invoker.ibtool_flags)) { | |
| 163 ibtool_flags = invoker.ibtool_flags | |
| 164 } | |
| 165 | |
| 166 script = "//build/config/mac/compile_xib.py" | |
| 167 sources = invoker.sources | |
| 168 outputs = [ | |
| 169 "$target_gen_dir/{{source_name_part}}.nib", | |
| 170 ] | |
| 171 args = [ | |
| 172 "--input", | |
| 173 "{{source}}", | |
|
sdefresne
2016/04/19 07:09:10
Nice, I didn't knew about this, I was always using
| |
| 174 "--output", | |
| 175 rebase_path("$target_gen_dir/{{source_name_part}}.nib"), | |
| 176 ] + ibtool_flags | |
| 177 } | |
| 178 } | |
| 179 | |
| 180 # Template to compile and package Mac XIB files as bundle data. | |
| 181 # | |
| 182 # Arguments | |
| 183 # | |
| 184 # sources: | |
| 185 # list of string, sources to comiple | |
| 186 # | |
| 187 # output_path: | |
| 188 # (optional) string, the path to use for the outputs list in the | |
| 189 # bundle_data step. If unspecified, defaults to bundle_resources_dir. | |
| 190 template("mac_xib_bundle_data") { | |
| 191 _target_name = target_name | |
| 192 _compile_target_name = _target_name + "_compile_ibtool" | |
| 193 | |
| 194 compile_xibs(_compile_target_name) { | |
| 195 forward_variables_from(invoker, [ "testonly" ]) | |
| 196 visibility = [ ":$_target_name" ] | |
| 197 sources = invoker.sources | |
| 198 ibtool_flags = [ | |
| 199 "--minimum-deployment-target", | |
| 200 mac_deployment_target, | |
| 201 "--target-device", | |
| 202 "mac", | |
| 203 ] | |
| 204 } | |
| 205 | |
| 206 bundle_data(_target_name) { | |
| 207 forward_variables_from(invoker, | |
| 208 [ | |
| 209 "testonly", | |
| 210 "visibility", | |
| 211 ]) | |
| 212 | |
| 213 public_deps = [ | |
| 214 ":$_compile_target_name", | |
| 215 ] | |
| 216 sources = get_target_outputs(":$_compile_target_name") | |
| 217 | |
| 218 _output_path = "{{bundle_resources_dir}}" | |
| 219 if (defined(invoker.output_path)) { | |
| 220 _output_path = invoker.output_path | |
| 221 } | |
| 222 | |
| 223 outputs = [ | |
| 224 "$_output_path/{{source_file_part}}", | |
| 225 ] | |
| 226 } | |
| 227 } | |
| 228 | |
| 140 # Template to package a shared library into a Mac framework bundle. | 229 # Template to package a shared library into a Mac framework bundle. |
| 141 # | 230 # |
| 142 # Arguments | 231 # Arguments |
| 143 # | 232 # |
| 144 # info_plist: | 233 # info_plist: |
| 145 # string, path to the Info.plist file that will be used for the bundle. | 234 # string, path to the Info.plist file that will be used for the bundle. |
| 146 # | 235 # |
| 147 # output_name: | 236 # output_name: |
| 148 # (optional) string, name of the generated framework without the | 237 # (optional) string, name of the generated framework without the |
| 149 # .framework suffix. If omitted, defaults to target_name. | 238 # .framework suffix. If omitted, defaults to target_name. |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 326 ]) | 415 ]) |
| 327 if (!defined(deps)) { | 416 if (!defined(deps)) { |
| 328 deps = [] | 417 deps = [] |
| 329 } | 418 } |
| 330 deps += [ ":$_loadable_module_bundle_data" ] | 419 deps += [ ":$_loadable_module_bundle_data" ] |
| 331 | 420 |
| 332 bundle_root_dir = "$root_out_dir/$_target_name.plugin/Contents" | 421 bundle_root_dir = "$root_out_dir/$_target_name.plugin/Contents" |
| 333 bundle_executable_dir = "$bundle_root_dir/MacOS" | 422 bundle_executable_dir = "$bundle_root_dir/MacOS" |
| 334 } | 423 } |
| 335 } | 424 } |
| OLD | NEW |