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 deps = invoker.deps | |
38 if (defined(invoker.testonly)) { | |
39 testonly = invoker.testonly | |
40 } | |
41 } | |
42 } | |
43 | |
44 template("resource_copy_ios") { | |
sdefresne
2015/07/25 19:15:30
I think this should be part of ios_app, otherwise
Dirk Pranke
2015/07/31 21:27:40
Will investigate. marking as a TODO for now.
| |
45 assert(defined(invoker.resources), | |
46 "The source list of resources to copy over") | |
47 assert(defined(invoker.bundle_directory), | |
48 "The directory within the bundle to place the sources in") | |
49 assert(defined(invoker.app_name), "The name of the application") | |
50 | |
51 _bundle_directory = invoker.bundle_directory | |
52 _app_name = invoker.app_name | |
53 _resources = invoker.resources | |
54 | |
55 copy(target_name) { | |
56 set_sources_assignment_filter([]) | |
57 sources = _resources | |
58 outputs = [ | |
59 "$root_build_dir/$_app_name.app/$_bundle_directory/{{source_file_part}}", | |
60 ] | |
61 } | |
62 } | |
63 | |
64 template("ios_app") { | |
65 assert(defined(invoker.deps), | |
66 "Dependencies must be specified for $target_name") | |
67 assert(defined(invoker.info_plist), | |
68 "The application plist file must be specified for $target_name") | |
69 assert(defined(invoker.app_name), | |
70 "The name of iOS application for $target_name") | |
71 assert(defined(invoker.entitlements_path), | |
72 "The entitlements path must be specified for $target_name") | |
73 assert(defined(invoker.code_signing_identity), | |
74 "The entitlements path must be specified for $target_name") | |
sdefresne
2015/07/25 19:15:30
This comment is incorrect, this is checking "code_
Dirk Pranke
2015/07/31 21:27:40
Done.
| |
75 | |
76 # We just create a variable so we can use the same in interpolation | |
77 app_name = invoker.app_name | |
78 | |
79 if (defined(invoker.testonly)) { | |
80 testonly = invoker.testonly | |
81 } | |
82 | |
83 struct_gen_target_name = target_name + "_struct" | |
84 plist_gen_target_name = target_name + "_plist" | |
85 bin_gen_target_name = target_name + "_bin" | |
86 | |
87 # Generate the project structure | |
88 | |
sdefresne
2015/07/25 19:15:30
nit: remove blank line?
Dirk Pranke
2015/07/31 21:27:41
Done.
| |
89 action(struct_gen_target_name) { | |
90 script = ios_app_script | |
91 | |
92 sources = [] | |
93 outputs = [ | |
94 "$root_build_dir/$app_name.app", | |
95 ] | |
96 | |
97 args = [ | |
98 "structure", | |
99 "-d", | |
100 rebase_path(root_build_dir), | |
101 "-n", | |
102 app_name, | |
103 ] | |
104 } | |
105 | |
106 # Generate the executable | |
107 executable(bin_gen_target_name) { | |
108 output_name = "${app_name}.app/${app_name}" | |
109 if (defined(invoker.testonly)) { | |
110 testonly = invoker.testonly | |
111 } | |
112 | |
113 if (defined(invoker.libs)) { | |
114 libs = invoker.libs | |
115 } else { | |
116 libs = [] | |
117 } | |
118 libs += [ | |
119 "UIKit.framework", | |
120 "QuartzCore.framework", | |
121 "OpenGLES.framework", | |
122 ] | |
123 | |
124 deps = invoker.deps + [ | |
125 ":$struct_gen_target_name", | |
126 ":$plist_gen_target_name", | |
127 ] | |
128 } | |
129 | |
130 # Process the Info.plist | |
131 | |
132 action(plist_gen_target_name) { | |
133 script = ios_app_script | |
134 | |
135 sources = [ | |
136 invoker.info_plist, | |
137 ] | |
138 outputs = [ | |
139 "$root_build_dir/${app_name}.app/Info.plist", | |
140 ] | |
141 | |
142 args = [ | |
143 "plist", | |
144 "-i", | |
145 rebase_path(invoker.info_plist, root_build_dir), | |
146 "-o", | |
147 rebase_path("$root_build_dir/${app_name}.app"), | |
148 ] | |
149 | |
150 deps = [ | |
151 ":$struct_gen_target_name", | |
152 ] | |
153 } | |
154 | |
155 # Copy the generated binaries and assets to their appropriate locations | |
156 | |
157 #copy_gen_target_name = target_name + "_copy" | |
sdefresne
2015/07/25 19:15:30
This looks like this can be removed as the other t
Dirk Pranke
2015/07/31 21:27:40
Right.
| |
158 #copy(copy_gen_target_name) { | |
159 # sources = [ | |
160 # # "$root_build_dir/$app_name", | |
161 # #"$root_build_dir/Info.plist", | |
162 # ] | |
163 # | |
164 # outputs = [ | |
165 # "$root_build_dir/$app_name.app/{{source_file_part}}", | |
166 # ] | |
167 # | |
168 # deps = [ | |
169 # ":$struct_gen_target_name", | |
170 # ":$bin_gen_target_name", | |
171 # ":$plist_gen_target_name", | |
172 # ] | |
173 #} | |
174 | |
175 # Perform Code Signing | |
176 | |
177 code_sign_gen_target_name = target_name + "_codesign" | |
178 code_sign_ios(code_sign_gen_target_name) { | |
179 entitlements_path = invoker.entitlements_path | |
180 identity = invoker.code_signing_identity | |
181 application_path = "$root_build_dir/$app_name.app" | |
182 deps = [ | |
183 #":$copy_gen_target_name", | |
184 ":$struct_gen_target_name", | |
185 ":$plist_gen_target_name", | |
186 ":$bin_gen_target_name", | |
187 ] | |
188 if (defined(invoker.testonly)) { | |
189 testonly = invoker.testonly | |
190 } | |
191 } | |
192 | |
193 # Top level group | |
194 | |
195 group(target_name) { | |
196 # Skip code signing if no identity is provided. This is useful for simulator | |
197 # builds | |
sdefresne
2015/07/25 19:15:30
nit: full stop?
Dirk Pranke
2015/07/31 21:27:40
Done.
| |
198 deps = [] | |
199 if (invoker.code_signing_identity == "") { | |
sdefresne
2015/07/25 19:15:30
question: why not flatten the hierarchy, i.e. do t
Dirk Pranke
2015/07/31 21:27:40
I just hadn't gotten to cleaning this up yet. Will
| |
200 deps += [ | |
201 ":$struct_gen_target_name", | |
202 ":$plist_gen_target_name", | |
203 ":$bin_gen_target_name", | |
204 ] | |
205 } else { | |
206 deps += [ ":$code_sign_gen_target_name" ] | |
207 } | |
208 } | |
209 } | |
OLD | NEW |