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

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

Issue 796373006: Content handler for python. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 #
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 "{{source_gen_dir}}/{{source_name_part}}.mojom.h", 117 "{{source_gen_dir}}/{{source_name_part}}.mojom.h",
118 "{{source_gen_dir}}/{{source_name_part}}.mojom-internal.h", 118 "{{source_gen_dir}}/{{source_name_part}}.mojom-internal.h",
119 ] 119 ]
120 generator_dart_outputs = 120 generator_dart_outputs =
121 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.dart" ] 121 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.dart" ]
122 generator_java_outputs = 122 generator_java_outputs =
123 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar" ] 123 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar" ]
124 generator_js_outputs = [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ] 124 generator_js_outputs = [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ]
125 generator_python_outputs = 125 generator_python_outputs =
126 [ "{{source_gen_dir}}/{{source_name_part}}_mojom.py" ] 126 [ "{{source_gen_dir}}/{{source_name_part}}_mojom.py" ]
127 generator_python_zip_output = "$target_out_dir/$target_name.pyzip"
127 128
128 if (defined(invoker.visibility)) { 129 if (defined(invoker.visibility)) {
129 # Need to save this because the the target_name is overwritten inside the 130 # Need to save this because the the target_name is overwritten inside the
130 # action to be that of the action itself. Only define this in the case the 131 # action to be that of the action itself. Only define this in the case the
131 # var is used to avoid unused var error. 132 # var is used to avoid unused var error.
132 target_visibility = [ ":$target_name" ] 133 target_visibility = [ ":$target_name" ]
133 } 134 }
134 135
135 generator_target_name = target_name + "__generator" 136 generator_target_name = target_name + "__generator"
136 action_foreach(generator_target_name) { 137 action_foreach(generator_target_name) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 public_deps += [ rebase_path(sdk_dep, ".", mojo_root) ] 182 public_deps += [ rebase_path(sdk_dep, ".", mojo_root) ]
182 } 183 }
183 } 184 }
184 185
185 deps = [ 186 deps = [
186 ":$generator_target_name", 187 ":$generator_target_name",
187 ] 188 ]
188 if (defined(invoker.deps)) { 189 if (defined(invoker.deps)) {
189 deps += invoker.deps 190 deps += invoker.deps
190 } 191 }
192 data_deps = [ ":${target_name}_python" ]
191 if (defined(invoker.mojo_sdk_deps)) { 193 if (defined(invoker.mojo_sdk_deps)) {
192 foreach(sdk_dep, invoker.mojo_sdk_deps) { 194 foreach(sdk_dep, invoker.mojo_sdk_deps) {
193 # Check that the SDK dep was not mistakenly given as an absolute path. 195 # Check that the SDK dep was not mistakenly given as an absolute path.
194 assert(get_path_info(sdk_dep, "abspath") != sdk_dep) 196 assert(get_path_info(sdk_dep, "abspath") != sdk_dep)
195 deps += [ rebase_path(sdk_dep, ".", mojo_root) ] 197 deps += [ rebase_path(sdk_dep, ".", mojo_root) ]
196 } 198 }
197 } 199 }
198 } 200 }
199 201
200 all_deps = [] 202 all_deps = []
(...skipping 11 matching lines...) Expand all
212 # invoker.public_deps) are mojom targets themselves. 214 # invoker.public_deps) are mojom targets themselves.
213 group("${target_name}__check_deps_are_all_mojom") { 215 group("${target_name}__check_deps_are_all_mojom") {
214 deps = [] 216 deps = []
215 foreach(d, all_deps) { 217 foreach(d, all_deps) {
216 name = get_label_info(d, "label_no_toolchain") 218 name = get_label_info(d, "label_no_toolchain")
217 toolchain = get_label_info(d, "toolchain") 219 toolchain = get_label_info(d, "toolchain")
218 deps += [ "${name}__is_mojom(${toolchain})" ] 220 deps += [ "${name}__is_mojom(${toolchain})" ]
219 } 221 }
220 } 222 }
221 223
224 action("${target_name}_python") {
225 script = rebase_path("mojo/public/tools/gn/zip.py", ".", mojo_root)
226
227 inputs = process_file_template(invoker.sources, generator_python_outputs)
228
229 deps = []
230 zip_inputs = []
231
232 foreach(d, all_deps) {
233 # Resolve the name, so that a target //mojo/something becomes
234 # //mojo/something:something and we can append "_python" to get the python
235 # dependency name.
236 full_name = get_label_info(d, "label_no_toolchain")
237 dep_name = get_label_info(d, "name")
238 dep_target_out_dir = get_label_info(d, "target_out_dir")
239 deps += [ "${full_name}_python" ]
240 zip_inputs += [ "$dep_target_out_dir/$dep_name.pyzip" ]
241 }
242
243 output = generator_python_zip_output
244 outputs = [
245 output,
246 ]
247
248 rebase_base_dir = rebase_path(target_gen_dir, root_build_dir)
249 rebase_inputs = rebase_path(inputs, root_build_dir)
250 rebase_zip_inputs = rebase_path(zip_inputs, root_build_dir)
251 rebase_output = rebase_path(output, root_build_dir)
252 args = [
253 "--base-dir=$rebase_base_dir",
254 "--inputs=$rebase_inputs",
255 "--zip-inputs=$rebase_zip_inputs",
256 "--output=$rebase_output",
257 ]
258 }
259
222 if (is_android) { 260 if (is_android) {
223 import("//build/config/android/rules.gni") 261 import("//build/config/android/rules.gni")
224 262
225 java_target_name = target_name + "_java" 263 java_target_name = target_name + "_java"
226 android_library(java_target_name) { 264 android_library(java_target_name) {
227 deps = rebase_path([ 265 deps = rebase_path([
228 "mojo/public/java:bindings", 266 "mojo/public/java:bindings",
229 "mojo/public/java:system", 267 "mojo/public/java:system",
230 ], 268 ],
231 ".", 269 ".",
232 mojo_root) 270 mojo_root)
233 271
234 foreach(d, all_deps) { 272 foreach(d, all_deps) {
235 # Resolve the name, so that a target //mojo/something becomes 273 # Resolve the name, so that a target //mojo/something becomes
236 # //mojo/something:something and we can append "_java" to get the java 274 # //mojo/something:something and we can append "_java" to get the java
237 # dependency name. 275 # dependency name.
238 full_name = get_label_info(d, "label_no_toolchain") 276 full_name = get_label_info(d, "label_no_toolchain")
239 deps += [ "${full_name}_java" ] 277 deps += [ "${full_name}_java" ]
240 } 278 }
241 279
242 srcjars = process_file_template(invoker.sources, generator_java_outputs) 280 srcjars = process_file_template(invoker.sources, generator_java_outputs)
243 } 281 }
244 } 282 }
245 } 283 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698