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

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

Issue 830593003: Update mojo sdk to rev 9fbbc4f0fef1187312316c0ed992342474e139f1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cherry-pick mojo 9d3b8dd17f12d20035a14737fdc38dd926890ff8 Created 5 years, 11 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
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++ and JavaScript source files from mojom files. The output files
8 # will go under the generated file directory tree with the same path as each 8 # will go under the generated file directory tree with the same path as each
9 # input file. 9 # input file.
10 # 10 #
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,
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
15 # |deps|.
16 #
11 # Parameters: 17 # Parameters:
12 # 18 #
13 # sources (required) 19 # sources (required)
14 # List of source .mojom files to compile. 20 # List of source .mojom files to compile.
15 # 21 #
16 # deps (optional) 22 # deps (optional)
17 # Note: this can contain only other mojom targets. 23 # Note: this can contain only other mojom targets.
18 # 24 #
25 # mojo_sdk_deps (optional)
26 # List of deps specified relative to the parent directory of the Mojo
27 # public SDK. These deps will be added as ordinary deps rebased to the
28 # current directory.
29 #
19 # public_deps (optional) 30 # public_deps (optional)
20 # Note: this can contain only other mojom targets. 31 # Note: this can contain only other mojom targets.
21 # 32 #
33 # mojo_sdk_public_deps (optional)
34 # List of public deps specified relative to the parent directory of the
35 # Mojo public SDK. These deps will be added as ordinary public deps
36 # rebased to the current directory.
37 #
22 # testonly (optional) 38 # testonly (optional)
23 # 39 #
24 # visibility (optional) 40 # visibility (optional)
25 template("mojom") { 41 template("mojom") {
26 assert(defined(invoker.sources), 42 assert(defined(invoker.sources),
27 "\"sources\" must be defined for the $target_name template.") 43 "\"sources\" must be defined for the $target_name template.")
28 44
29 generator_root = rebase_path("mojo/public/tools/bindings", ".", mojo_root) 45 generator_root = rebase_path("mojo/public/tools/bindings", ".", mojo_root)
30 generator_script = "$generator_root/mojom_bindings_generator.py" 46 generator_script = "$generator_root/mojom_bindings_generator.py"
31 generator_sources = [ 47 generator_sources = [
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 "{{source_gen_dir}}/{{source_name_part}}.mojom-internal.h", 113 "{{source_gen_dir}}/{{source_name_part}}.mojom-internal.h",
98 ] 114 ]
99 generator_dart_outputs = 115 generator_dart_outputs =
100 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.dart" ] 116 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.dart" ]
101 generator_java_outputs = 117 generator_java_outputs =
102 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar" ] 118 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar" ]
103 generator_js_outputs = [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ] 119 generator_js_outputs = [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ]
104 generator_python_outputs = 120 generator_python_outputs =
105 [ "{{source_gen_dir}}/{{source_name_part}}_mojom.py" ] 121 [ "{{source_gen_dir}}/{{source_name_part}}_mojom.py" ]
106 122
123 rebased_mojo_sdk_public_deps = []
124 if (defined(invoker.mojo_sdk_public_deps)) {
125 foreach(sdk_dep, invoker.mojo_sdk_public_deps) {
126 # Check that the SDK dep was not mistakenly given as an absolute path.
127 assert(get_path_info(sdk_dep, "abspath") != sdk_dep)
128 rebased_mojo_sdk_public_deps += [ rebase_path(sdk_dep, ".", mojo_root) ]
129 }
130 }
131
132 rebased_mojo_sdk_deps = []
133 if (defined(invoker.mojo_sdk_deps)) {
134 foreach(sdk_dep, invoker.mojo_sdk_deps) {
135 # Check that the SDK dep was not mistakenly given as an absolute path.
136 assert(get_path_info(sdk_dep, "abspath") != sdk_dep)
137 rebased_mojo_sdk_deps += [ rebase_path(sdk_dep, ".", mojo_root) ]
138 }
139 }
140
107 if (defined(invoker.visibility)) { 141 if (defined(invoker.visibility)) {
108 # Need to save this because the the target_name is overwritten inside the 142 # Need to save this because the the target_name is overwritten inside the
109 # action to be that of the action itself. Only define this in the case the 143 # action to be that of the action itself. Only define this in the case the
110 # var is used to avoid unused var error. 144 # var is used to avoid unused var error.
111 target_visibility = [ ":$target_name" ] 145 target_visibility = [ ":$target_name" ]
112 } 146 }
113 147
114 generator_target_name = target_name + "__generator" 148 generator_target_name = target_name + "__generator"
115 action_foreach(generator_target_name) { 149 action_foreach(generator_target_name) {
116 if (defined(invoker.visibility)) { 150 if (defined(invoker.visibility)) {
(...skipping 26 matching lines...) Expand all
143 if (defined(invoker.testonly)) { 177 if (defined(invoker.testonly)) {
144 testonly = invoker.testonly 178 testonly = invoker.testonly
145 } 179 }
146 sources = process_file_template(invoker.sources, generator_cpp_outputs) 180 sources = process_file_template(invoker.sources, generator_cpp_outputs)
147 data = process_file_template(invoker.sources, generator_js_outputs) 181 data = process_file_template(invoker.sources, generator_js_outputs)
148 182
149 public_configs = 183 public_configs =
150 rebase_path([ "mojo/public/build/config:mojo_sdk" ], ".", mojo_root) 184 rebase_path([ "mojo/public/build/config:mojo_sdk" ], ".", mojo_root)
151 185
152 public_deps = rebase_path([ "mojo/public/cpp/bindings" ], ".", mojo_root) 186 public_deps = rebase_path([ "mojo/public/cpp/bindings" ], ".", mojo_root)
187 public_deps += rebased_mojo_sdk_public_deps
153 if (defined(invoker.public_deps)) { 188 if (defined(invoker.public_deps)) {
154 public_deps += invoker.public_deps 189 public_deps += invoker.public_deps
155 } 190 }
156 191
157 deps = [ 192 deps = [
158 ":$generator_target_name", 193 ":$generator_target_name",
159 ] 194 ]
195 deps += rebased_mojo_sdk_deps
160 if (defined(invoker.deps)) { 196 if (defined(invoker.deps)) {
161 deps += invoker.deps 197 deps += invoker.deps
162 } 198 }
163 } 199 }
164 200
165 all_deps = [] 201 all_deps = rebased_mojo_sdk_deps + rebased_mojo_sdk_public_deps
166 if (defined(invoker.deps)) { 202 if (defined(invoker.deps)) {
167 all_deps += invoker.deps 203 all_deps += invoker.deps
168 } 204 }
169 if (defined(invoker.public_deps)) { 205 if (defined(invoker.public_deps)) {
170 all_deps += invoker.public_deps 206 all_deps += invoker.public_deps
171 } 207 }
172 208
173 group("${target_name}__is_mojom") { 209 group("${target_name}__is_mojom") {
174 } 210 }
175 211
(...skipping 25 matching lines...) Expand all
201 # //mojo/something:something and we can append "_java" to get the java 237 # //mojo/something:something and we can append "_java" to get the java
202 # dependency name. 238 # dependency name.
203 full_name = get_label_info(d, "label_no_toolchain") 239 full_name = get_label_info(d, "label_no_toolchain")
204 deps += [ "${full_name}_java" ] 240 deps += [ "${full_name}_java" ]
205 } 241 }
206 242
207 srcjars = process_file_template(invoker.sources, generator_java_outputs) 243 srcjars = process_file_template(invoker.sources, generator_java_outputs)
208 } 244 }
209 } 245 }
210 } 246 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698