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 ios_app_script = "//build/config/ios/ios_app.py" | |
6 | |
7 template("code_sign_ios") { | |
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 = ios_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 "testonly", | |
42 ]) | |
43 } | |
44 } | |
45 | |
46 # TODO(GYP), TODO(dpranke): Should this be part of ios_app? | |
47 template("resource_copy_ios") { | |
48 assert(defined(invoker.resources), | |
49 "The source list of resources to copy over") | |
50 assert(defined(invoker.bundle_directory), | |
51 "The directory within the bundle to place the sources in") | |
52 assert(defined(invoker.app_name), "The name of the application") | |
53 | |
54 _bundle_directory = invoker.bundle_directory | |
55 _app_name = invoker.app_name | |
56 _resources = invoker.resources | |
57 | |
58 copy(target_name) { | |
59 set_sources_assignment_filter([]) | |
60 sources = _resources | |
61 outputs = [ | |
62 "$root_build_dir/$_app_name.app/$_bundle_directory/{{source_file_part}}", | |
63 ] | |
64 } | |
65 } | |
66 | |
67 template("ios_app") { | |
68 assert(defined(invoker.deps), | |
69 "Dependencies must be specified for $target_name") | |
70 assert(defined(invoker.info_plist), | |
71 "The application plist file must be specified for $target_name") | |
72 assert(defined(invoker.app_name), | |
73 "The iOS application name must be specified for $target_name") | |
74 assert(defined(invoker.entitlements_path), | |
75 "The entitlements path must be specified for $target_name") | |
76 assert(defined(invoker.code_signing_identity), | |
77 "The code_signing_identity must be specified for $target_name") | |
78 | |
79 # We just create a variable so we can use the same in interpolation | |
80 app_name = invoker.app_name | |
brettw
2015/08/06 18:07:27
This still isn't optional (should default to targe
Dirk Pranke
2015/08/06 18:29:46
Yeah, I fixed the mac one but not the ios one. wil
Dirk Pranke
2015/08/06 20:32:11
I'm not sure if can use output_name; we app_name f
brettw
2015/08/06 22:38:15
Okay, we can do a follow up. I'm still quite certa
| |
81 | |
82 forward_variables_from(invoker, [ "testonly" ]) | |
83 | |
84 plist_gen_target_name = target_name + "_plist" | |
85 bin_gen_target_name = target_name + "_bin" | |
86 group_target_name = target_name | |
87 | |
88 # Generate the executable | |
89 executable(bin_gen_target_name) { | |
90 visibility = [ ":$group_target_name" ] | |
91 | |
92 output_name = "${app_name}.app/${app_name}" | |
93 if (defined(invoker.testonly)) { | |
brettw
2015/08/06 18:07:27
You forward testonly above. Is this necessary? If
Dirk Pranke
2015/08/06 18:29:46
I don't think this is necessary. Will fix.
| |
94 testonly = invoker.testonly | |
95 } | |
96 | |
97 if (defined(invoker.libs)) { | |
98 libs = invoker.libs | |
99 } else { | |
100 libs = [] | |
101 } | |
102 libs += [ | |
103 "UIKit.framework", | |
104 "QuartzCore.framework", | |
105 "OpenGLES.framework", | |
106 ] | |
107 | |
108 deps = invoker.deps + [ ":$plist_gen_target_name" ] | |
brettw
2015/08/06 18:07:27
Can this treat the invoker deps as optional? I rea
Dirk Pranke
2015/08/06 18:29:46
Will fix.
| |
109 } | |
110 | |
111 # Process the Info.plist | |
112 action(plist_gen_target_name) { | |
113 visibility = [ | |
114 ":$group_target_name", | |
115 ":$bin_gen_target_name", | |
116 ] | |
117 | |
118 script = ios_app_script | |
119 | |
120 sources = [ | |
121 invoker.info_plist, | |
122 ] | |
123 outputs = [ | |
124 "$root_build_dir/${app_name}.app/Info.plist", | |
125 ] | |
126 | |
127 args = [ | |
128 "plist", | |
129 "-i", | |
130 rebase_path(invoker.info_plist, root_build_dir), | |
131 "-o", | |
132 rebase_path("$root_build_dir/${app_name}.app"), | |
133 ] | |
134 } | |
135 | |
136 # Perform Code Signing | |
137 entitlements_path = invoker.entitlements_path | |
138 if (invoker.code_signing_identity != "") { | |
139 code_sign_gen_target_name = target_name + "_codesign" | |
140 code_sign_ios(code_sign_gen_target_name) { | |
141 visibility = [ ":$target_name" ] | |
142 | |
143 identity = invoker.code_signing_identity | |
144 application_path = "$root_build_dir/$app_name.app" | |
145 deps = [ | |
146 ":$plist_gen_target_name", | |
147 ":$bin_gen_target_name", | |
148 ] | |
149 } | |
150 } else { | |
151 # This avoids a potential unused variable warning in the caller. | |
152 entitlements_path = entitlements_path | |
153 } | |
154 | |
155 # Top level group | |
156 group(target_name) { | |
157 deps = [ | |
158 ":$plist_gen_target_name", | |
159 ":$bin_gen_target_name", | |
160 ] | |
161 if (invoker.code_signing_identity != "") { | |
162 deps += [ ":$code_sign_gen_target_name" ] | |
163 } | |
164 } | |
165 } | |
OLD | NEW |