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

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

Issue 1865483002: [Mac/GN] Initial framework bundle support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove _package_target 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
« no previous file with comments | « no previous file | ui/base/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/toolchain/toolchain.gni")
6
5 mac_app_script = "//build/config/mac/mac_app.py" 7 mac_app_script = "//build/config/mac/mac_app.py"
6 8
7 template("code_sign_mac") { 9 template("code_sign_mac") {
8 assert(defined(invoker.entitlements_path), 10 assert(defined(invoker.entitlements_path),
9 "The path to the entitlements .xcent file") 11 "The path to the entitlements .xcent file")
10 assert(defined(invoker.identity), "The code signing identity") 12 assert(defined(invoker.identity), "The code signing identity")
11 assert(defined(invoker.application_path), "The application to code sign") 13 assert(defined(invoker.application_path), "The application to code sign")
12 assert(defined(invoker.deps)) 14 assert(defined(invoker.deps))
13 15
14 action(target_name) { 16 action(target_name) {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 205 }
204 206
205 # Top level group 207 # Top level group
206 208
207 group(group_gen_target_name) { 209 group(group_gen_target_name) {
208 deps = [ 210 deps = [
209 ":$copy_all_target_name", 211 ":$copy_all_target_name",
210 ] 212 ]
211 } 213 }
212 } 214 }
215
216 # Template to package a shared library into a Mac framework bundle.
217 #
218 # Arguments
219 #
220 # info_plist:
221 # string, path to the Info.plist file that will be used for the bundle.
222 #
223 # output_name:
224 # (optional) string, name of the generated framework without the
225 # .framework suffix. If omitted, defaults to target_name.
226 #
227 # framework_version:
228 # (optional) string, version of the framework. Typically this is a
229 # single letter, like "A". If omitted, the Versions/ subdirectory
230 # structure will not be created, and build output will go directly
231 # into the framework subdirectory.
232 template("mac_framework") {
233 assert(defined(invoker.deps),
234 "Dependencies must be specified for $target_name")
235 assert(defined(invoker.info_plist),
236 "The Info.plist file must be specified for $target_name")
237
238 _target_name = target_name
239 _output_name = target_name
240 if (defined(invoker.output_name)) {
241 _output_name = invoker.output_name
242 }
243 _framework_name = _output_name + ".framework"
244 _framework_version = ""
245 if (defined(invoker.framework_version)) {
246 _framework_version = invoker.framework_version
247 }
248 _framework_target = _output_name + "_framework"
249
250 _shared_library_target = target_name + "_shared_library"
251 _shared_library_bundle_data = _shared_library_target + "_bundle_data"
252
253 shared_library(_shared_library_target) {
254 visibility = [ ":$_shared_library_bundle_data" ]
255 forward_variables_from(invoker,
256 "*",
257 [
258 "assert_no_deps",
259 "data_deps",
260 "info_plist",
261 "output_name",
262 "visibility",
263 ])
264 }
265
266 bundle_data(_shared_library_bundle_data) {
267 visibility = [ ":$_framework_target" ]
268 forward_variables_from(invoker, [ "testonly" ])
269 sources = [
270 "$root_out_dir/${shlib_prefix}${_shared_library_target}${shlib_extension}" ,
271 ]
272 outputs = [
273 "{{bundle_executable_dir}}/$_output_name",
274 ]
275 public_deps = [
276 ":$_shared_library_target",
277 ]
278 }
279
280 _info_plist_target = target_name + "_info_plist"
281
282 # TODO(rsesek): Process Info.plist variables.
283
284 _info_plist_bundle_data = _info_plist_target + "_bundle_data"
285
286 bundle_data(_info_plist_bundle_data) {
287 visibility = [ ":$_framework_target" ]
288 forward_variables_from(invoker, [ "testonly" ])
289 sources = [
290 invoker.info_plist,
291 ]
292 outputs = [
293 "{{bundle_root_dir}}/Info.plist",
294 ]
295 }
296
297 create_bundle(_framework_target) {
298 visibility = [ ":$_target_name" ]
299 forward_variables_from(invoker,
300 [
301 "data_deps",
302 "deps",
303 "public_deps",
304 "testonly",
305 "visibility",
306 ])
307
308 if (!defined(deps)) {
309 deps = []
310 }
311 deps += [
312 ":$_info_plist_bundle_data",
313 ":$_shared_library_bundle_data",
314 ]
315
316 bundle_root_dir = "$root_out_dir/$_framework_name"
317 if (_framework_version != "") {
318 bundle_root_dir += "/Versions/$_framework_version"
319 }
320 bundle_resources_dir = "$bundle_root_dir/Resources"
321 bundle_executable_dir = "$bundle_root_dir"
322 }
323
324 if (_framework_version != "") {
325 action(_target_name) {
326 forward_variables_from(invoker,
327 [
328 "visibility",
329 "testonly",
330 ])
331 script = "$root_out_dir/gyp-mac-tool"
332 outputs = [
333 "$root_out_dir/$_framework_name/Versions/Current",
334 ]
335 args = [
336 "package-framework",
337 "$_framework_name",
338 "$_framework_version",
339 ]
340 deps = [
341 ":$_framework_target",
342 ]
343 }
344 } else {
345 group(_target_name) {
346 forward_variables_from(invoker,
347 [
348 "visibility",
349 "testonly",
350 ])
351 deps = [
352 ":$_framework_target",
353 ]
354 }
355 }
356 }
OLDNEW
« no previous file with comments | « no previous file | ui/base/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698