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

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

Issue 1879493002: [iOS/GN] Convert //ios/third_party/ochamcrest to build a framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-framework-bundle
Patch Set: Add a comment to explain the "set_sources_assignment_filter" in "ios_framework_bundle" template 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 | « build/config/BUILDCONFIG.gn ('k') | ios/third_party/ochamcrest/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/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 # TODO(crbug.com/297668): refactor this template to extract common behaviour 8 # 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 9 # 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. 10 # that forward to "executable" on all platform except iOS/OS X.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 "-s=IOS_DEPLOYMENT_TARGET=$ios_deployment_target", 69 "-s=IOS_DEPLOYMENT_TARGET=$ios_deployment_target",
70 "-s=IOS_PLATFORM_BUILD=$ios_platform_build", 70 "-s=IOS_PLATFORM_BUILD=$ios_platform_build",
71 "-s=IOS_PLATFORM_NAME=$ios_sdk_name", 71 "-s=IOS_PLATFORM_NAME=$ios_sdk_name",
72 "-s=IOS_PLATFORM_VERSION=$ios_sdk_version", 72 "-s=IOS_PLATFORM_VERSION=$ios_sdk_version",
73 "-s=IOS_SDK_BUILD=$ios_sdk_build", 73 "-s=IOS_SDK_BUILD=$ios_sdk_build",
74 "-s=IOS_SDK_NAME=$ios_sdk_name$ios_sdk_version", 74 "-s=IOS_SDK_NAME=$ios_sdk_name$ios_sdk_version",
75 "-s=IOS_SUPPORTED_PLATFORM=$ios_sdk_platform", 75 "-s=IOS_SUPPORTED_PLATFORM=$ios_sdk_platform",
76 "-s=PRODUCT_NAME=$_output_name", 76 "-s=PRODUCT_NAME=$_output_name",
77 "-s=XCODE_BUILD=$xcode_build", 77 "-s=XCODE_BUILD=$xcode_build",
78 "-s=XCODE_VERSION=$xcode_version", 78 "-s=XCODE_VERSION=$xcode_version",
79 "-o=" + rebase_path(outputs[0], root_build_dir), 79 "-o=" + rebase_path(outputs[0], root_out_dir),
80 ] + rebase_path(sources, root_build_dir) 80 ] + rebase_path(sources, root_out_dir)
81 args = [ "@{{response_file_name}}" ] 81 args = [ "@{{response_file_name}}" ]
82 } 82 }
83 83
84 bundle_data(_bundle_data_info_plist) { 84 bundle_data(_bundle_data_info_plist) {
85 forward_variables_from(invoker, [ "testonly" ]) 85 forward_variables_from(invoker, [ "testonly" ])
86 visibility = [ ":$_target_name" ] 86 visibility = [ ":$_target_name" ]
87 sources = get_target_outputs(":$_generate_info_plist") 87 sources = get_target_outputs(":$_generate_info_plist")
88 outputs = [ 88 outputs = [
89 "{{bundle_root_dir}}/Info.plist", 89 "{{bundle_root_dir}}/Info.plist",
90 ] 90 ]
(...skipping 12 matching lines...) Expand all
103 [ 103 [
104 "assert_no_deps", 104 "assert_no_deps",
105 "code_signing_identity", 105 "code_signing_identity",
106 "data_deps", 106 "data_deps",
107 "entitlements_path", 107 "entitlements_path",
108 "info_plist", 108 "info_plist",
109 "output_name", 109 "output_name",
110 "visibility", 110 "visibility",
111 ]) 111 ])
112 112
113 output_name = rebase_path("$target_gen_dir/$_output_name", root_build_dir) 113 output_name = rebase_path("$target_gen_dir/$_output_name", root_out_dir)
114 if (!defined(libs)) { 114 if (!defined(libs)) {
115 libs = [] 115 libs = []
116 } 116 }
117 libs += [ "UIKit.framework" ] 117 libs += [ "UIKit.framework" ]
118 118
119 # TODO(crbug.com/599203) - iossim should probably be a data dependency 119 # TODO(crbug.com/599203) - iossim should probably be a data dependency
120 # of the create_bundle(target_name) target instead but at the moment 120 # of the create_bundle(target_name) target instead but at the moment
121 # create_bundle() is ignoring data_deps. 121 # create_bundle() is ignoring data_deps.
122 if (use_ios_simulator) { 122 if (use_ios_simulator) {
123 if (!defined(data_deps)) { 123 if (!defined(data_deps)) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 outputs = [ 203 outputs = [
204 "$target_gen_dir/$_nib_filename/objects.nib", 204 "$target_gen_dir/$_nib_filename/objects.nib",
205 "$target_gen_dir/$_nib_filename/runtime.nib", 205 "$target_gen_dir/$_nib_filename/runtime.nib",
206 ] 206 ]
207 args = [ 207 args = [
208 "--minimum-deployment-target", 208 "--minimum-deployment-target",
209 ios_deployment_target, 209 ios_deployment_target,
210 "--output", 210 "--output",
211 rebase_path("$target_gen_dir/$_nib_filename"), 211 rebase_path("$target_gen_dir/$_nib_filename"),
212 "--input", 212 "--input",
213 rebase_path(invoker.source, root_build_dir), 213 rebase_path(invoker.source, root_out_dir),
214 ] 214 ]
215 } 215 }
216 216
217 bundle_data(_target_name) { 217 bundle_data(_target_name) {
218 forward_variables_from(invoker, "*", [ "source" ]) 218 forward_variables_from(invoker, "*", [ "source" ])
219 219
220 if (!defined(public_deps)) { 220 if (!defined(public_deps)) {
221 public_deps = [] 221 public_deps = []
222 } 222 }
223 public_deps += [ ":$_compile_xib" ] 223 public_deps += [ ":$_compile_xib" ]
(...skipping 15 matching lines...) Expand all
239 # output_name: 239 # output_name:
240 # (optional) string, name of the generated framework without the 240 # (optional) string, name of the generated framework without the
241 # .framework suffix. If omitted, defaults to target_name. 241 # .framework suffix. If omitted, defaults to target_name.
242 # 242 #
243 # framework_version: 243 # framework_version:
244 # (optional) string, version of the framework. Typically this is a 244 # (optional) string, version of the framework. Typically this is a
245 # single letter, like "A". If omitted, the Versions/ subdirectory 245 # single letter, like "A". If omitted, the Versions/ subdirectory
246 # structure will not be created, and build output will go directly 246 # structure will not be created, and build output will go directly
247 # into the framework subdirectory. 247 # into the framework subdirectory.
248 # 248 #
249 # public_headers:
250 # (optional) list of paths to header file that needs to be copied
251 # into the framework bundle Headers subdirectory. If omitted or
252 # empty then the Headers subdirectory is not created.
253 #
254 # sources
255 # (optional) list of files. Needs to be defined and non-empty if
256 # public_headers is defined and non-empty.
257 #
249 # See "gn help shared_library" for more information on arguments supported 258 # See "gn help shared_library" for more information on arguments supported
250 # by shared library target. 259 # by shared library target.
251 template("ios_framework_bundle") { 260 template("ios_framework_bundle") {
261 if (defined(invoker.public_headers) && invoker.public_headers != []) {
262 assert(defined(invoker.sources) && invoker.sources != [],
263 "sources must be set for $target_name when public_headers is set")
264
265 _target_name = target_name
266 _output_name = target_name
267 if (defined(invoker.output_name)) {
268 _output_name = invoker.output_name
269 }
270
271 _public_headers = invoker.public_headers
272 _framework_name = _output_name + ".framework"
273 _framework_root = "$root_out_dir/$_framework_name"
274
275 _header_map_filename = "$target_gen_dir/$_output_name.headers.hmap"
276 _framework_headers_target = _target_name + "_framework_headers"
277
278 _compile_headers_map_target = _target_name + "_compile_headers_map"
279 action(_compile_headers_map_target) {
280 visibility = [ ":$_framework_headers_target" ]
281 script = "$root_out_dir/gyp-mac-tool"
282 outputs = [
283 _header_map_filename,
284 ]
285
286 # The header map generation only wants the list of headers, not all of
287 # sources, so filter any non-header source files from "sources". It is
288 # less error prone that having the developer duplicate the list of all
289 # headers in addition to "sources".
290 set_sources_assignment_filter([
291 "*.c",
292 "*.cc",
293 "*.cpp",
294 "*.m",
295 "*.mm",
296 ])
297 sources = invoker.sources
298 set_sources_assignment_filter([])
299
300 args = [
301 "compile-ios-framework-header-map",
302 rebase_path(_header_map_filename),
303 rebase_path(_framework_root, root_out_dir),
304 ] + rebase_path(sources, root_out_dir)
305 }
306
307 _create_module_map_target = _target_name + "_module_map"
308 action(_create_module_map_target) {
309 visibility = [ ":$_framework_headers_target" ]
310 script = "$root_out_dir/gyp-mac-tool"
311 outputs = [
312 "$_framework_root/Modules/module.modulemap",
313 ]
314 args = [
315 "package-ios-framework",
316 rebase_path("$_framework_root", root_out_dir),
317 ]
318 }
319
320 _copy_public_headers_target = _target_name + "_copy_public_headers"
321 copy(_copy_public_headers_target) {
322 visibility = [ ":$_framework_headers_target" ]
323 sources = _public_headers
324 outputs = [
325 "$_framework_root/Headers/{{source_file_part}}",
326 ]
327 }
328
329 _headers_map_config = _target_name + "_headers_map"
330 config(_headers_map_config) {
331 visibility = [ ":$_target_name" ]
332 include_dirs = [ _header_map_filename ]
333 }
334
335 group(_framework_headers_target) {
336 deps = [
337 ":$_compile_headers_map_target",
338 ":$_copy_public_headers_target",
339 ":$_create_module_map_target",
340 ]
341 }
342 }
343
252 framework_bundle(target_name) { 344 framework_bundle(target_name) {
253 forward_variables_from(invoker, "*") 345 forward_variables_from(invoker, "*", [ "public_headers" ])
346
347 if (defined(_public_headers)) {
348 configs += [ ":$_headers_map_config" ]
349 if (!defined(deps)) {
350 deps = []
351 }
352 deps += [ ":$_framework_headers_target" ]
353 }
254 } 354 }
255 } 355 }
OLDNEW
« no previous file with comments | « build/config/BUILDCONFIG.gn ('k') | ios/third_party/ochamcrest/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698