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

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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 "{{source_gen_dir}}/{{source_name_part}}.mojom.h", 101 "{{source_gen_dir}}/{{source_name_part}}.mojom.h",
102 "{{source_gen_dir}}/{{source_name_part}}.mojom-internal.h", 102 "{{source_gen_dir}}/{{source_name_part}}.mojom-internal.h",
103 ] 103 ]
104 generator_dart_outputs = 104 generator_dart_outputs =
105 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.dart" ] 105 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.dart" ]
106 generator_java_outputs = 106 generator_java_outputs =
107 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar" ] 107 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar" ]
108 generator_js_outputs = [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ] 108 generator_js_outputs = [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ]
109 generator_python_outputs = 109 generator_python_outputs =
110 [ "{{source_gen_dir}}/{{source_name_part}}_mojom.py" ] 110 [ "{{source_gen_dir}}/{{source_name_part}}_mojom.py" ]
111 generator_python_zip_output = "$target_out_dir/$target_name.pyzip"
111 112
112 if (defined(invoker.visibility)) { 113 if (defined(invoker.visibility)) {
113 # Need to save this because the the target_name is overwritten inside the 114 # Need to save this because the the target_name is overwritten inside the
114 # action to be that of the action itself. Only define this in the case the 115 # action to be that of the action itself. Only define this in the case the
115 # var is used to avoid unused var error. 116 # var is used to avoid unused var error.
116 target_visibility = [ ":$target_name" ] 117 target_visibility = [ ":$target_name" ]
117 } 118 }
118 119
119 generator_target_name = target_name + "__generator" 120 generator_target_name = target_name + "__generator"
120 action_foreach(generator_target_name) { 121 action_foreach(generator_target_name) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 # invoker.public_deps) are mojom targets themselves. 183 # invoker.public_deps) are mojom targets themselves.
183 group("${target_name}__check_deps_are_all_mojom") { 184 group("${target_name}__check_deps_are_all_mojom") {
184 deps = [] 185 deps = []
185 foreach(d, all_deps) { 186 foreach(d, all_deps) {
186 name = get_label_info(d, "label_no_toolchain") 187 name = get_label_info(d, "label_no_toolchain")
187 toolchain = get_label_info(d, "toolchain") 188 toolchain = get_label_info(d, "toolchain")
188 deps += [ "${name}__is_mojom(${toolchain})" ] 189 deps += [ "${name}__is_mojom(${toolchain})" ]
189 } 190 }
190 } 191 }
191 192
193 action("${target_name}_python") {
194 script = rebase_path("mojo/public/tools/gn/zip.py", ".", mojo_root)
195
196 inputs = process_file_template(invoker.sources, generator_python_outputs)
197
198 deps = []
199 zip_inputs = []
200
201 foreach(d, all_deps) {
202 # Resolve the name, so that a target //mojo/something becomes
203 # //mojo/something:something and we can append "_python" to get the python
204 # dependency name.
205 full_name = get_label_info(d, "label_no_toolchain")
206 dep_name = get_label_info(d, "name")
207 dep_target_out_dir = get_label_info(d, "target_out_dir")
208 deps += [ "${full_name}_python" ]
209 zip_inputs += [ "$dep_target_out_dir/$dep_name.pyzip" ]
210 }
211
212 output = generator_python_zip_output
213 outputs = [
214 output,
215 ]
216
217 rebase_base_dir = rebase_path(target_gen_dir, root_build_dir)
218 rebase_inputs = rebase_path(inputs, root_build_dir)
219 rebase_zip_inputs = rebase_path(zip_inputs, root_build_dir)
220 rebase_output = rebase_path(output, root_build_dir)
221 args = [
222 "--base-dir=$rebase_base_dir",
223 "--inputs=$rebase_inputs",
224 "--zip-inputs=$rebase_zip_inputs",
225 "--output=$rebase_output",
226 ]
227 }
228
192 if (is_android) { 229 if (is_android) {
193 import("//build/config/android/rules.gni") 230 import("//build/config/android/rules.gni")
194 231
195 java_target_name = target_name + "_java" 232 java_target_name = target_name + "_java"
196 android_library(java_target_name) { 233 android_library(java_target_name) {
197 deps = rebase_path([ 234 deps = rebase_path([
198 "mojo/public/java:bindings", 235 "mojo/public/java:bindings",
199 "mojo/public/java:system", 236 "mojo/public/java:system",
200 ], 237 ],
201 ".", 238 ".",
202 mojo_root) 239 mojo_root)
203 240
204 foreach(d, all_deps) { 241 foreach(d, all_deps) {
205 # Resolve the name, so that a target //mojo/something becomes 242 # Resolve the name, so that a target //mojo/something becomes
206 # //mojo/something:something and we can append "_java" to get the java 243 # //mojo/something:something and we can append "_java" to get the java
207 # dependency name. 244 # dependency name.
208 full_name = get_label_info(d, "label_no_toolchain") 245 full_name = get_label_info(d, "label_no_toolchain")
209 deps += [ "${full_name}_java" ] 246 deps += [ "${full_name}_java" ]
210 } 247 }
211 248
212 srcjars = process_file_template(invoker.sources, generator_java_outputs) 249 srcjars = process_file_template(invoker.sources, generator_java_outputs)
213 } 250 }
214 } 251 }
215 } 252 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698