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

Side by Side Diff: Source/bindings/scripts/generate_bindings.pl

Issue 24156003: Revert IDL compiler build flow to Perl, rename 'deprecated' (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 7 years, 3 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
1 #!/usr/bin/perl -w 1 #!/usr/bin/perl -w
2 # 2 #
3 # Copyright (C) 2005 Apple Computer, Inc. 3 # Copyright (C) 2005 Apple Computer, Inc.
4 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> 4 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com>
5 # 5 #
6 # This file is part of WebKit 6 # This file is part of WebKit
7 # 7 #
8 # This library is free software; you can redistribute it and/or 8 # This library is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Library General Public 9 # modify it under the terms of the GNU Library General Public
10 # License as published by the Free Software Foundation; either 10 # License as published by the Free Software Foundation; either
(...skipping 11 matching lines...) Expand all
22 # 22 #
23 23
24 use strict; 24 use strict;
25 25
26 use File::Path; 26 use File::Path;
27 use File::Basename; 27 use File::Basename;
28 use Getopt::Long; 28 use Getopt::Long;
29 use Text::ParseWords; 29 use Text::ParseWords;
30 use Cwd; 30 use Cwd;
31 31
32 use deprecated_idl_parser; 32 use idl_parser;
33 use deprecated_code_generator_v8; 33 use code_generator_v8;
34 use deprecated_idl_serializer; 34 use idl_serializer;
35 35
36 my @idlDirectories; 36 my @idlDirectories;
37 my $outputDirectory; 37 my $outputDirectory;
38 my $preprocessor; 38 my $preprocessor;
39 my $verbose; 39 my $verbose;
40 my $interfaceDependenciesFile; 40 my $interfaceDependenciesFile;
41 my $additionalIdlFiles; 41 my $additionalIdlFiles;
42 my $idlAttributesFile; 42 my $idlAttributesFile;
43 my $writeFileOnlyIfChanged; 43 my $writeFileOnlyIfChanged;
44 44
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 98
99 if (!$idlFound) { 99 if (!$idlFound) {
100 # We generate empty .h and .cpp files just to tell build scripts that .h and .cpp files are created. 100 # We generate empty .h and .cpp files just to tell build scripts that .h and .cpp files are created.
101 generateEmptyHeaderAndCpp($targetInterfaceName, $outputDirectory); 101 generateEmptyHeaderAndCpp($targetInterfaceName, $outputDirectory);
102 exit 0; 102 exit 0;
103 } 103 }
104 } 104 }
105 105
106 # Parse the target IDL file. 106 # Parse the target IDL file.
107 my $targetParser = deprecated_idl_parser->new(!$verbose); 107 my $targetParser = idl_parser->new(!$verbose);
108 my $targetDocument = $targetParser->Parse($targetIdlFile, $preprocessor); 108 my $targetDocument = $targetParser->Parse($targetIdlFile, $preprocessor);
109 109
110 if ($idlAttributesFile) { 110 if ($idlAttributesFile) {
111 my $idlAttributes = loadIDLAttributes($idlAttributesFile); 111 my $idlAttributes = loadIDLAttributes($idlAttributesFile);
112 checkIDLAttributes($idlAttributes, $targetDocument, basename($targetIdlFile) ); 112 checkIDLAttributes($idlAttributes, $targetDocument, basename($targetIdlFile) );
113 } 113 }
114 114
115 foreach my $idlFile (@dependencyIdlFiles) { 115 foreach my $idlFile (@dependencyIdlFiles) {
116 next if $idlFile eq $targetIdlFile; 116 next if $idlFile eq $targetIdlFile;
117 117
118 my $interfaceName = fileparse(basename($idlFile), ".idl"); 118 my $interfaceName = fileparse(basename($idlFile), ".idl");
119 my $parser = deprecated_idl_parser->new(!$verbose); 119 my $parser = idl_parser->new(!$verbose);
120 my $document = $parser->Parse($idlFile, $preprocessor); 120 my $document = $parser->Parse($idlFile, $preprocessor);
121 121
122 foreach my $interface (@{$document->interfaces}) { 122 foreach my $interface (@{$document->interfaces}) {
123 if (!$interface->isPartial || $interface->name eq $targetInterfaceName) { 123 if (!$interface->isPartial || $interface->name eq $targetInterfaceName) {
124 my $targetDataNode; 124 my $targetDataNode;
125 foreach my $interface (@{$targetDocument->interfaces}) { 125 foreach my $interface (@{$targetDocument->interfaces}) {
126 if ($interface->name eq $targetInterfaceName) { 126 if ($interface->name eq $targetInterfaceName) {
127 $targetDataNode = $interface; 127 $targetDataNode = $interface;
128 last; 128 last;
129 } 129 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 167 }
168 } 168 }
169 } 169 }
170 170
171 # Serialize to and from JSON to ensure Perl and Python parsers are equivalent, 171 # Serialize to and from JSON to ensure Perl and Python parsers are equivalent,
172 # as part of porting compiler to Python. See http://crbug.com/242795 172 # as part of porting compiler to Python. See http://crbug.com/242795
173 $targetDocument = deserializeJSON(serializeJSON($targetDocument)); 173 $targetDocument = deserializeJSON(serializeJSON($targetDocument));
174 174
175 # Generate desired output for the target IDL file. 175 # Generate desired output for the target IDL file.
176 my @interfaceIdlFiles = ($targetDocument->fileName(), @dependencyIdlFiles); 176 my @interfaceIdlFiles = ($targetDocument->fileName(), @dependencyIdlFiles);
177 my $codeGenerator = deprecated_code_generator_v8->new($targetDocument, \@idlDire ctories, $preprocessor, $verbose, \@interfaceIdlFiles, $writeFileOnlyIfChanged); 177 my $codeGenerator = code_generator_v8->new($targetDocument, \@idlDirectories, $p reprocessor, $verbose, \@interfaceIdlFiles, $writeFileOnlyIfChanged);
178 my $interfaces = $targetDocument->interfaces; 178 my $interfaces = $targetDocument->interfaces;
179 foreach my $interface (@$interfaces) { 179 foreach my $interface (@$interfaces) {
180 print "Generating bindings code for IDL interface \"" . $interface->name . " \"...\n" if $verbose; 180 print "Generating bindings code for IDL interface \"" . $interface->name . " \"...\n" if $verbose;
181 $codeGenerator->GenerateInterface($interface); 181 $codeGenerator->GenerateInterface($interface);
182 $codeGenerator->WriteData($interface, $outputDirectory); 182 $codeGenerator->WriteData($interface, $outputDirectory);
183 } 183 }
184 184
185 sub generateEmptyHeaderAndCpp 185 sub generateEmptyHeaderAndCpp
186 { 186 {
187 my ($targetInterfaceName, $outputDirectory) = @_; 187 my ($targetInterfaceName, $outputDirectory) = @_;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 last OUTER; 295 last OUTER;
296 } 296 }
297 } 297 }
298 } 298 }
299 if ($error) { 299 if ($error) {
300 die "IDL ATTRIBUTE CHECKER ERROR: $error 300 die "IDL ATTRIBUTE CHECKER ERROR: $error
301 If you want to add a new IDL attribute, you need to add it to bindings/scripts/I DLAttributes.txt and add explanations to the Blink IDL document (http://chromium .org/blink/webidl). 301 If you want to add a new IDL attribute, you need to add it to bindings/scripts/I DLAttributes.txt and add explanations to the Blink IDL document (http://chromium .org/blink/webidl).
302 "; 302 ";
303 } 303 }
304 } 304 }
OLDNEW
« no previous file with comments | « Source/bindings/scripts/deprecated_idl_serializer.pm ('k') | Source/bindings/scripts/idl_compiler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698