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

Side by Side Diff: Source/bindings/scripts/code_generator_v8.py

Issue 18190004: Add Python flow to bindings generation, move dummy-generating IDL files over (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Tweak similarity Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are
5 # met:
6 #
7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer
11 # in the documentation and/or other materials provided with the
12 # distribution.
13 # * Neither the name of Google Inc. nor the names of its
14 # contributors may be used to endorse or promote products derived from
15 # this software without specific prior written permission.
16 #
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 """Generate Blink V8 bindings (.cpp and .h files).
30
31 Given an IR of the IDL files for an interface (produced by the frontend),
haraken 2013/07/08 06:06:29 I'd avoid using the work "IR" and "frontend" since
Nils Barth (inactive) 2013/07/09 08:48:16 I've clarified above, where the terms are useful,
32 generates the .cpp and .h files for the binding.
33
34 FIXME: Currently a stub, as part of landing the parser and code generator
haraken 2013/07/08 06:06:29 Let's explain our working plan here. In other word
Nils Barth (inactive) 2013/07/09 08:48:16 Done! (Please feel free to suggest rewordings.)
35 incrementally. Only implements generation of dummy .cpp and .h files.
36 """
37
38 import os.path
39
40
41 def generate_dummy_header_and_cpp(target_interface_name, output_directory):
42 header_basename = 'V8%s.h' % target_interface_name
43 cpp_basename = 'V8%s.cpp' % target_interface_name
44 header_fullname = os.path.join(output_directory, header_basename)
45 cpp_fullname = os.path.join(output_directory, cpp_basename)
46 contents = """/*
47 This file is generated just to tell build scripts that {header_basename} and
48 {cpp_basename} are created for {target_interface_name}.idl, and thus
49 prevent the build scripts from trying to generate {header_basename} and
50 {cpp_basename} at every build. This file must not be tried to compile.
51 */
haraken 2013/07/08 06:06:29 You might want to use the jinja template for this.
Nils Barth (inactive) 2013/07/09 08:48:16 That's a really good point – we don't want manual
52 """.format(**locals())
53 with open(header_fullname, 'w') as header_file:
54 header_file.write(contents)
55 with open(cpp_fullname, 'w') as cpp_file:
56 cpp_file.write(contents)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698