Skip to content
Permalink
Browse files
2010-07-20 Ilya Tikhonovsky <loislo@chromium.org>
        Reviewed by Yury Semikhatsky.

        WebInspector: the bindings generation helper script can be
        simplified a bit. Chromium.
        https://bugs.webkit.org/show_bug.cgi?id=42523

        * WebCore.gyp/WebCore.gyp:
        * WebCore.gyp/scripts/rule_binding.py:
        * bindings/scripts/CodeGenerator.pm:
        * bindings/scripts/CodeGeneratorCPP.pm:
        * bindings/scripts/CodeGeneratorJS.pm:
        * bindings/scripts/CodeGeneratorObjC.pm:
        * bindings/scripts/CodeGeneratorV8.pm:
        * bindings/scripts/generate-bindings.pl:
        * inspector/CodeGeneratorInspector.pm:




Canonical link: https://commits.webkit.org/54602@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@63764 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
loislo committed Jul 20, 2010
1 parent 2212d41 commit 7c73827c6877d0e4dc5c48cb3ba9bb31783a4382
@@ -1,3 +1,21 @@
2010-07-20 Ilya Tikhonovsky <loislo@chromium.org>

Reviewed by Yury Semikhatsky.

WebInspector: the bindings generation helper script can be
simplified a bit. Chromium.
https://bugs.webkit.org/show_bug.cgi?id=42523

* WebCore.gyp/WebCore.gyp:
* WebCore.gyp/scripts/rule_binding.py:
* bindings/scripts/CodeGenerator.pm:
* bindings/scripts/CodeGeneratorCPP.pm:
* bindings/scripts/CodeGeneratorJS.pm:
* bindings/scripts/CodeGeneratorObjC.pm:
* bindings/scripts/CodeGeneratorV8.pm:
* bindings/scripts/generate-bindings.pl:
* inspector/CodeGeneratorInspector.pm:

2010-07-20 Joseph Pecoraro <joepeck@webkit.org>

Reviewed by Geoffrey Garen.
@@ -502,7 +502,6 @@
'<@(_inputs)',
'--',
'--defines', '<(feature_defines) LANGUAGE_JAVASCRIPT',
'--filename', 'RemoteInspectorFrontend',
'--generator', 'Inspector',
'<@(generator_include_dirs)'
],
@@ -121,28 +121,14 @@ def main(args):
command.extend(['-I', includeDir])
command.append(generateBindings)
command.extend(options)
command.extend(['--outputHeadersDir', hdir])
command.extend(['--outputDir', cppdir, input])

# Do it. check_call is new in 2.5, so simulate its behavior with call and
# assert.
returnCode = subprocess.call(command)
assert returnCode == 0

# Both the .cpp and .h were generated in cppdir, but if hdir is different,
# the .h needs to move. Copy it instead of using os.rename for maximum
# portability in all cases.
if cppdir != hdir:
inputBasename = os.path.basename(input)
(root, ext) = os.path.splitext(inputBasename)
if fileName != '':
hname = '%s.h' % (fileName)
else:
hname = '%s%s.h' % (prefix, root)
hsrc = os.path.join(cppdir, hname)
hdst = os.path.join(hdir, hname)
shutil.copyfile(hsrc, hdst)
os.unlink(hsrc)

return returnCode


@@ -31,6 +31,7 @@ use File::Find;
my $useDocument = "";
my $useGenerator = "";
my $useOutputDir = "";
my $useOutputHeadersDir = "";
my $useDirectories = "";
my $useLayerOnTop = 0;
my $preprocessor;
@@ -80,6 +81,7 @@ sub new
$useDirectories = shift;
$useGenerator = shift;
$useOutputDir = shift;
$useOutputHeadersDir = shift;
$useLayerOnTop = shift;
$preprocessor = shift;
$writeDependencies = shift;
@@ -107,7 +109,7 @@ sub ProcessDocument
require $ifaceName . ".pm";

# Dynamically load external code generation perl module
$codeGenerator = $ifaceName->new($object, $useOutputDir, $useLayerOnTop, $preprocessor, $writeDependencies, $verbose);
$codeGenerator = $ifaceName->new($object, $useOutputDir, $useOutputHeadersDir, $useLayerOnTop, $preprocessor, $writeDependencies, $verbose);
unless (defined($codeGenerator)) {
my $classes = $useDocument->classes;
foreach my $class (@$classes) {
@@ -98,6 +98,7 @@ sub new

$codeGenerator = shift;
$outputDir = shift;
shift; # $outputHeadersDir
shift; # $useLayerOnTop
shift; # $preprocessor
shift; # $writeDependencies
@@ -73,6 +73,7 @@ sub new

$codeGenerator = shift;
$outputDir = shift;
shift; # $outputHeadersDir
shift; # $useLayerOnTop
shift; # $preprocessor
$writeDependencies = shift;
@@ -199,6 +199,7 @@ sub new

$codeGenerator = shift;
$outputDir = shift;
shift; # $outputHeadersDir
shift; # $useLayerOnTop
shift; # $preprocessor
$writeDependencies = shift;
@@ -30,6 +30,7 @@ use Digest::MD5;

my $module = "";
my $outputDir = "";
my $outputHeadersDir = "";

my @headerContent = ();
my @implContentHeader = ();
@@ -71,6 +72,7 @@ sub new

$codeGenerator = shift;
$outputDir = shift;
$outputHeadersDir = shift;

bless($reference, $object);
return $reference;
@@ -110,7 +112,7 @@ sub GenerateInterface
my $name = $dataNode->name;

# Open files for writing
my $headerFileName = "$outputDir/V8$name.h";
my $headerFileName = "$outputHeadersDir/V8$name.h";
my $implFileName = "$outputDir/V8$name.cpp";

open($IMPL, ">$implFileName") || die "Couldn't open file $implFileName";
@@ -39,20 +39,20 @@

my @idlDirectories;
my $outputDirectory;
my $outputHeadersDirectory;
my $generator;
my $defines;
my $prefix;
my $filename;
my $preprocessor;
my $writeDependencies;
my $verbose;

GetOptions('include=s@' => \@idlDirectories,
'outputDir=s' => \$outputDirectory,
'outputHeadersDir=s' => \$outputHeadersDirectory,
'generator=s' => \$generator,
'defines=s' => \$defines,
'prefix=s' => \$prefix,
'filename=s' => \$filename,
'preprocessor=s' => \$preprocessor,
'verbose' => \$verbose,
'write-dependencies' => \$writeDependencies);
@@ -64,6 +64,9 @@
die('Must specify output directory.') unless defined($outputDirectory);
die('Must specify defines') unless defined($defines);

if (!$outputHeadersDirectory) {
$outputHeadersDirectory = $outputDirectory;
}
if ($verbose) {
print "$generator: $idlFile\n";
}
@@ -74,5 +77,5 @@
my $document = $parser->Parse($idlFile, $defines, $preprocessor);

# Generate desired output for given IDL file.
my $codeGen = CodeGenerator->new(\@idlDirectories, $generator, $outputDirectory, 0, $preprocessor, $writeDependencies, $verbose);
my $codeGen = CodeGenerator->new(\@idlDirectories, $generator, $outputDirectory, $outputHeadersDirectory, 0, $preprocessor, $writeDependencies, $verbose);
$codeGen->ProcessDocument($document, $defines);
@@ -89,6 +89,7 @@ EOF

my $codeGenerator;
my $outputDir;
my $outputHeadersDir;
my $writeDependencies;
my $verbose;

@@ -113,6 +114,7 @@ sub new

$codeGenerator = shift;
$outputDir = shift;
$outputHeadersDir = shift;
shift; # $useLayerOnTop
shift; # $preprocessor
$writeDependencies = shift;
@@ -277,7 +279,7 @@ sub finish
close($SOURCE);
undef($SOURCE);

open(my $HEADER, ">$outputDir/$frontendClassName.h") || die "Couldn't open file $outputDir/$frontendClassName.h";
open(my $HEADER, ">$outputHeadersDir/$frontendClassName.h") || die "Couldn't open file $outputHeadersDir/$frontendClassName.h";
print $HEADER generateHeader($frontendClassName, \%frontendTypes, $frontendConstructor, \%frontendMethods, $frontendFooter);
close($HEADER);
undef($HEADER);

0 comments on commit 7c73827

Please sign in to comment.