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

Side by Side Diff: mojo/public/tools/bindings/mojom.gni

Issue 1095183003: mojom.gni: add a source set called ${target_name}_cpp_sources. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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("../../mojo_sdk.gni") 5 import("../../mojo_sdk.gni")
6 6
7 # Generate C++ and JavaScript source files from mojom files. The output files 7 # Generate C++/JavaScript/Java/Python/Dart/Go source files from mojom files. The
8 # will go under the generated file directory tree with the same path as each 8 # output files will go under the generated file directory tree with the same
9 # input file. 9 # path as each input file.
10 # 10 #
11 # If a mojom target is intended for use in a client repo where the location of 11 # If a mojom target is intended for use in a client repo where the location of
12 # the Mojo SDK will be different than its location in the Mojo repo, 12 # the Mojo SDK will be different than its location in the Mojo repo,
13 # dependencies on the SDK should be specified relative to the parent directory 13 # dependencies on the SDK should be specified relative to the parent directory
14 # of the Mojo public SDK in |mojo_sdk_deps| rather than via absolute paths in 14 # of the Mojo public SDK in |mojo_sdk_deps| rather than via absolute paths in
15 # |deps|. 15 # |deps|.
16 # 16 #
17 # Parameters: 17 # Parameters:
18 # 18 #
19 # sources (optional if one of the deps sets listed below is present) 19 # sources (optional if one of the deps sets listed below is present)
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 205 }
206 206
207 source_set(target_name) { 207 source_set(target_name) {
208 if (defined(invoker.visibility)) { 208 if (defined(invoker.visibility)) {
209 visibility = invoker.visibility 209 visibility = invoker.visibility
210 } 210 }
211 if (defined(invoker.testonly)) { 211 if (defined(invoker.testonly)) {
212 testonly = invoker.testonly 212 testonly = invoker.testonly
213 } 213 }
214 if (defined(invoker.sources)) { 214 if (defined(invoker.sources)) {
215 sources = process_file_template(invoker.sources, generator_cpp_outputs)
216 data = process_file_template(invoker.sources, generator_js_outputs) 215 data = process_file_template(invoker.sources, generator_js_outputs)
217 } 216 }
218 217
219 public_configs = 218 public_configs =
220 rebase_path([ "mojo/public/build/config:mojo_sdk" ], ".", mojo_root) 219 rebase_path([ "mojo/public/build/config:mojo_sdk" ], ".", mojo_root)
221 220
222 public_deps = rebase_path([ "mojo/public/cpp/bindings" ], ".", mojo_root) 221 public_deps = rebase_path([ "mojo/public/cpp/bindings" ], ".", mojo_root)
222 if (defined(invoker.sources)) {
223 public_deps += [ ":${target_name}_cpp_sources" ]
224 }
223 public_deps += rebased_mojo_sdk_public_deps 225 public_deps += rebased_mojo_sdk_public_deps
224 if (defined(invoker.public_deps)) { 226 if (defined(invoker.public_deps)) {
225 public_deps += invoker.public_deps 227 public_deps += invoker.public_deps
226 } 228 }
227 229
228 deps = [] 230 deps = []
229 if (defined(invoker.sources)) { 231 if (defined(invoker.sources)) {
230 deps += [ ":$generator_target_name" ] 232 deps += [ ":$generator_target_name" ]
231 } 233 }
232 deps += rebased_mojo_sdk_deps 234 deps += rebased_mojo_sdk_deps
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 args = [ 348 args = [
347 "--base-dir=$rebase_import_from", 349 "--base-dir=$rebase_import_from",
348 "--zip-inputs=$rebase_zip_inputs", 350 "--zip-inputs=$rebase_zip_inputs",
349 "--output=$rebase_output", 351 "--output=$rebase_output",
350 ] 352 ]
351 if (defined(invoker.sources)) { 353 if (defined(invoker.sources)) {
352 args += [ "--link-inputs=$rebase_inputs" ] 354 args += [ "--link-inputs=$rebase_inputs" ]
353 } 355 }
354 } 356 }
355 357
358 if (defined(invoker.sources)) {
359 # The generated C++ source files. The main reason to introduce this target
360 # is so that mojo/public/cpp/bindings can depend on mojom interfaces without
361 # circular dependencies.
362 source_set("${target_name}_cpp_sources") {
363 if (defined(invoker.visibility)) {
364 visibility = target_visibility + invoker.visibility
365 }
366 if (defined(invoker.testonly)) {
367 testonly = invoker.testonly
368 }
369 sources = process_file_template(invoker.sources, generator_cpp_outputs)
370 public_configs =
371 rebase_path([ "mojo/public/build/config:mojo_sdk" ], ".", mojo_root)
372 deps = [ ":$generator_target_name" ]
373 }
374 }
375
356 if (is_android) { 376 if (is_android) {
357 import("//build/config/android/rules.gni") 377 import("//build/config/android/rules.gni")
358 378
359 java_target_name = target_name + "_java" 379 java_target_name = target_name + "_java"
360 android_library(java_target_name) { 380 android_library(java_target_name) {
361 deps = rebase_path([ 381 deps = rebase_path([
362 "mojo/public/java:bindings", 382 "mojo/public/java:bindings",
363 "mojo/public/java:system", 383 "mojo/public/java:system",
364 ], 384 ],
365 ".", 385 ".",
366 mojo_root) 386 mojo_root)
367 387
368 foreach(d, all_deps) { 388 foreach(d, all_deps) {
369 # Resolve the name, so that a target //mojo/something becomes 389 # Resolve the name, so that a target //mojo/something becomes
370 # //mojo/something:something and we can append "_java" to get the java 390 # //mojo/something:something and we can append "_java" to get the java
371 # dependency name. 391 # dependency name.
372 full_name = get_label_info(d, "label_no_toolchain") 392 full_name = get_label_info(d, "label_no_toolchain")
373 deps += [ "${full_name}_java" ] 393 deps += [ "${full_name}_java" ]
374 } 394 }
375 395
376 if (defined(invoker.sources)) { 396 if (defined(invoker.sources)) {
377 srcjars = process_file_template(invoker.sources, generator_java_outputs) 397 srcjars = process_file_template(invoker.sources, generator_java_outputs)
378 } 398 }
379 } 399 }
380 } 400 }
381 } 401 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698