Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Side by Side Diff: build/config/ios/rules.gni

Issue 1877523002: Mac/iOS/GN: Generate Info.plist files for Mac apps and frameworks with gn. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unused variable issues. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/config/ios/ios_sdk.gni") 5 import("//build/config/ios/ios_sdk.gni")
6 import("//build/config/mac/rules.gni") 6 import("//build/config/mac/rules.gni")
7 7
8 template("ios_info_plist") {
9 assert(defined(invoker.info_plist),
Robert Sesek 2016/04/21 15:36:21 I think you can rely on the asserts in the info_pl
Patti Lor 2016/04/22 02:49:55 Done.
10 "The Info.plist file must be specified for $target_name")
11 assert(defined(invoker._output_name),
12 "The output_name file must be specified for $target_name")
13
14 info_plist(target_name) {
15 extra_substitutions = []
16 if (defined(invoker.extra_substitutions)) {
17 extra_substitutions = invoker.extra_substitutions
18 }
19 extra_substitutions += [
20 "IOS_DEPLOYMENT_TARGET=$ios_deployment_target",
21 "IOS_PLATFORM_BUILD=$ios_platform_build",
22 "IOS_PLATFORM_NAME=$ios_sdk_name",
23 "IOS_PLATFORM_VERSION=$ios_sdk_version",
24 "IOS_SDK_BUILD=$ios_sdk_build",
25 "IOS_SDK_NAME=$ios_sdk_name$ios_sdk_version",
26 "IOS_SUPPORTED_PLATFORM=$ios_sdk_platform",
27 ]
28 plist_templates = [
29 "//build/config/ios/BuildInfo.plist",
30 invoker.info_plist,
31 ]
32 forward_variables_from(invoker, [ "_output_name" ])
33 }
34 }
35
8 # TODO(crbug.com/297668): refactor this template to extract common behaviour 36 # TODO(crbug.com/297668): refactor this template to extract common behaviour
9 # between OS X and iOS bundle generation, then create a generic "app" template 37 # between OS X and iOS bundle generation, then create a generic "app" template
10 # that forward to "executable" on all platform except iOS/OS X. 38 # that forward to "executable" on all platform except iOS/OS X.
11 39
12 # Template to build an application bundle for iOS. 40 # Template to build an application bundle for iOS.
13 # 41 #
14 # This should be used instead of "executable" built-in target type on iOS. 42 # This should be used instead of "executable" built-in target type on iOS.
15 # As the template forward the generation of the application executable to 43 # As the template forward the generation of the application executable to
16 # an "executable" target, all arguments supported by "executable" targets 44 # an "executable" target, all arguments supported by "executable" targets
17 # are also supported by this template. 45 # are also supported by this template.
(...skipping 20 matching lines...) Expand all
38 66
39 _output_name = target_name 67 _output_name = target_name
40 _target_name = target_name 68 _target_name = target_name
41 if (defined(invoker.output_name)) { 69 if (defined(invoker.output_name)) {
42 _output_name = invoker.output_name 70 _output_name = invoker.output_name
43 } 71 }
44 72
45 _generate_info_plist = target_name + "_generate_info_plist" 73 _generate_info_plist = target_name + "_generate_info_plist"
46 _bundle_data_info_plist = target_name + "_bundle_data_info_plist" 74 _bundle_data_info_plist = target_name + "_bundle_data_info_plist"
47 75
48 action(_generate_info_plist) { 76 ios_info_plist(_generate_info_plist) {
49 visibility = [ ":$_bundle_data_info_plist" ] 77 forward_variables_from(invoker,
50 script = "//build/config/ios/ios_gen_plist.py" 78 [
51 sources = [ 79 "extra_substitutions",
52 "//build/config/ios/BuildInfo.plist", 80 "info_plist",
53 invoker.info_plist, 81 "_output_name",
54 ] 82 ])
55 outputs = [
56 "$target_gen_dir/$target_name/Info.plist",
57 ]
58 extra_args = []
59 if (defined(invoker.extra_substitutions)) {
60 foreach(substitution, invoker.extra_substitutions) {
61 extra_args += [ "-s=$substitution" ]
62 }
63 }
64 response_file_contents =
65 extra_args + [
66 "-s=BUILD_MACHINE_OS_BUILD=$machine_os_build",
67 "-s=EXECUTABLE_NAME=$_output_name",
68 "-s=GCC_VERSION=com.apple.compilers.llvm.clang.1_0",
69 "-s=IOS_DEPLOYMENT_TARGET=$ios_deployment_target",
70 "-s=IOS_PLATFORM_BUILD=$ios_platform_build",
71 "-s=IOS_PLATFORM_NAME=$ios_sdk_name",
72 "-s=IOS_PLATFORM_VERSION=$ios_sdk_version",
73 "-s=IOS_SDK_BUILD=$ios_sdk_build",
74 "-s=IOS_SDK_NAME=$ios_sdk_name$ios_sdk_version",
75 "-s=IOS_SUPPORTED_PLATFORM=$ios_sdk_platform",
76 "-s=PRODUCT_NAME=$_output_name",
77 "-s=XCODE_BUILD=$xcode_build",
78 "-s=XCODE_VERSION=$xcode_version",
79 "-o=" + rebase_path(outputs[0], root_out_dir),
80 ] + rebase_path(sources, root_out_dir)
81 args = [ "@{{response_file_name}}" ]
82 } 83 }
83 84
84 bundle_data(_bundle_data_info_plist) { 85 bundle_data(_bundle_data_info_plist) {
85 forward_variables_from(invoker, [ "testonly" ]) 86 forward_variables_from(invoker, [ "testonly" ])
86 visibility = [ ":$_target_name" ] 87 visibility = [ ":$_target_name" ]
87 sources = get_target_outputs(":$_generate_info_plist") 88 sources = get_target_outputs(":$_generate_info_plist")
88 outputs = [ 89 outputs = [
89 "{{bundle_root_dir}}/Info.plist", 90 "{{bundle_root_dir}}/Info.plist",
90 ] 91 ]
91 public_deps = [ 92 public_deps = [
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 "visibility", 364 "visibility",
364 "public_configs", 365 "public_configs",
365 ]) 366 ])
366 367
367 public_deps = [ 368 public_deps = [
368 ":$_framework_target", 369 ":$_framework_target",
369 ] 370 ]
370 } 371 }
371 } 372 }
372 } 373 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698