|
Lines 49-54
my $preprocessor;
a/Source/WebCore/bindings/scripts/generate-bindings.pl_sec1
|
| 49 |
my $writeDependencies; |
49 |
my $writeDependencies; |
| 50 |
my $verbose; |
50 |
my $verbose; |
| 51 |
my $supplementalDependencyFile; |
51 |
my $supplementalDependencyFile; |
|
|
52 |
my $additionalIdlFilesList; |
| 52 |
|
53 |
|
| 53 |
GetOptions('include=s@' => \@idlDirectories, |
54 |
GetOptions('include=s@' => \@idlDirectories, |
| 54 |
'outputDir=s' => \$outputDirectory, |
55 |
'outputDir=s' => \$outputDirectory, |
|
Lines 60-66
GetOptions('include=s@' => \@idlDirectories,
a/Source/WebCore/bindings/scripts/generate-bindings.pl_sec2
|
| 60 |
'preprocessor=s' => \$preprocessor, |
61 |
'preprocessor=s' => \$preprocessor, |
| 61 |
'verbose' => \$verbose, |
62 |
'verbose' => \$verbose, |
| 62 |
'write-dependencies' => \$writeDependencies, |
63 |
'write-dependencies' => \$writeDependencies, |
| 63 |
'supplementalDependencyFile=s' => \$supplementalDependencyFile); |
64 |
'supplementalDependencyFile=s' => \$supplementalDependencyFile, |
|
|
65 |
'additionalIdlFilesList=s' => \$additionalIdlFilesList); |
| 64 |
|
66 |
|
| 65 |
my $targetIdlFile = $ARGV[0]; |
67 |
my $targetIdlFile = $ARGV[0]; |
| 66 |
|
68 |
|
|
Lines 93-105
if ($supplementalDependencyFile) {
a/Source/WebCore/bindings/scripts/generate-bindings.pl_sec3
|
| 93 |
open FH, "< $supplementalDependencyFile" or die "Cannot open $supplementalDependencyFile\n"; |
95 |
open FH, "< $supplementalDependencyFile" or die "Cannot open $supplementalDependencyFile\n"; |
| 94 |
while (my $line = <FH>) { |
96 |
while (my $line = <FH>) { |
| 95 |
my ($idlFile, @followingIdlFiles) = split(/\s+/, $line); |
97 |
my ($idlFile, @followingIdlFiles) = split(/\s+/, $line); |
| 96 |
if ($idlFile and $idlFile eq $targetIdlFile) { |
98 |
if ($idlFile and basename($idlFile) eq basename($targetIdlFile)) { |
| 97 |
$idlFound = 1; |
99 |
$idlFound = 1; |
| 98 |
@supplementedIdlFiles = @followingIdlFiles; |
100 |
@supplementedIdlFiles = @followingIdlFiles; |
| 99 |
} |
101 |
} |
| 100 |
} |
102 |
} |
| 101 |
close FH; |
103 |
close FH; |
| 102 |
|
104 |
|
|
|
105 |
# The file $additionalIdlFilesList contains one IDL file per line: |
| 106 |
# P.idl |
| 107 |
# Q.idl |
| 108 |
# ... |
| 109 |
# These IDL files are ones which should not be included in DerivedSources*.cpp |
| 110 |
# (i.e. they are not described in the supplemental dependency file) |
| 111 |
# but should generate .h and .cpp files. |
| 112 |
if (!$idlFound and $additionalIdlFilesList) { |
| 113 |
open FH, "< $additionalIdlFilesList" or die "Cannot open $additionalIdlFilesList\n"; |
| 114 |
my @idlFiles = <FH>; |
| 115 |
chomp(@idlFiles); |
| 116 |
$idlFound = grep { $_ and basename($_) eq basename($targetIdlFile) } @idlFiles; |
| 117 |
close FH; |
| 118 |
} |
| 119 |
|
| 103 |
if (!$idlFound) { |
120 |
if (!$idlFound) { |
| 104 |
if ($verbose) { |
121 |
if ($verbose) { |
| 105 |
print "$targetIdlFile is supplementing another IDL file, and thus .h and .cpp for $targetIdlFile are not generated.\n"; |
122 |
print "$targetIdlFile is supplementing another IDL file, and thus .h and .cpp for $targetIdlFile are not generated.\n"; |
|
Lines 112-117
if ($supplementalDependencyFile) {
a/Source/WebCore/bindings/scripts/generate-bindings.pl_sec4
|
| 112 |
my $targetParser = IDLParser->new(!$verbose); |
129 |
my $targetParser = IDLParser->new(!$verbose); |
| 113 |
my $targetDocument = $targetParser->Parse($targetIdlFile, $defines, $preprocessor); |
130 |
my $targetDocument = $targetParser->Parse($targetIdlFile, $defines, $preprocessor); |
| 114 |
|
131 |
|
|
|
132 |
# FIXME(haraken): Remove this if-else statement. |
| 133 |
# This if-else statement is temporary and will be removed |
| 134 |
# after build scripts for all platforms support [Supplemental] IDL. |
| 135 |
# The motivation for the [Supplemented] IDL is as follows: |
| 136 |
# |
| 137 |
# In order to support the [Supplemental] IDL, we need to |
| 138 |
# (1) run resolve-supplemental.pl and generate supplemental_dependency.tmp |
| 139 |
# (2) and run generate-bindings.pl with the supplemental_dependency.tmp. |
| 140 |
# |
| 141 |
# This build flow requires a change on the following build scripts, |
| 142 |
# but changing all the build scripts all at once without any regression is too difficult: |
| 143 |
# |
| 144 |
# - DerivedSources.make |
| 145 |
# - DerivedSources.pri |
| 146 |
# - GNUmakefile.am |
| 147 |
# - PlatformBlackBerry.cmake |
| 148 |
# - UseJSC.cmake |
| 149 |
# - UseV8.cmake |
| 150 |
# - WebCore.vcproj/MigrateScripts |
| 151 |
# - WebCore.vcproj/WebCore.vcproj |
| 152 |
# - bindings/gobject/GNUmakefile.am |
| 153 |
# - WebCore.gyp/WebCore.gyp |
| 154 |
# |
| 155 |
# Thus, we are planning to change the build scripts one by one, which implies that |
| 156 |
# we need to allow the temporary state in which some build scripts support [Supplemental] IDL |
| 157 |
# but others do not. To accomplish this, we introduce a temporal IDL, [Supplemented]. |
| 158 |
# The [Supplemented] IDL on an attribute means that the attribute is marked with [Supplemental] |
| 159 |
# in another IDL file somewhere, like this: |
| 160 |
# |
| 161 |
# DOMWindowWebAudio.idl: |
| 162 |
# interface [ |
| 163 |
# Supplemental=DOMWindow |
| 164 |
# ] DOMWindowWebAudio { |
| 165 |
# attribute attr1; |
| 166 |
# attribute attr2; |
| 167 |
# }; |
| 168 |
# |
| 169 |
# DOMWindow.idl: |
| 170 |
# interface [ |
| 171 |
# ] DOMWindow { |
| 172 |
# attribute [Supplemented] attr1; // This line will be removed after all build scripts support the [SupplementalL. |
| 173 |
# attribute [Supplemented] attr2; // This line will be removed after all build scripts support the [SupplementalL. |
| 174 |
# attribute attr3; |
| 175 |
# attribute attr4; |
| 176 |
# }; |
| 177 |
# |
| 178 |
# Assuming these IDL files, the below code is doing the following logic: |
| 179 |
# |
| 180 |
# - If a given build script supports the [Supplemental] IDL (i.e. --supplementalDependencyFile is specified), |
| 181 |
# we ignore all attributes with the [Supplemented] IDL. |
| 182 |
# - Otherwise (i.e. --supplementalDependencyFile is not specified), |
| 183 |
# we treat all attributes with the [Supplemented] IDL as normal attributes |
| 184 |
# and instead ignore all attributes with the [Supplemental] IDL |
| 185 |
# (i.e. we generate nothing from the idl file with the [Supplemental] IDL). |
| 186 |
if ($supplementalDependencyFile) { |
| 187 |
foreach my $dataNode (@{$targetDocument->classes}) { |
| 188 |
my @nonSupplementedAttributes; |
| 189 |
foreach my $attribute (@{$dataNode->attributes}) { |
| 190 |
if (!$attribute->signature->extendedAttributes->{"Supplemented"}) { |
| 191 |
push(@nonSupplementedAttributes, $attribute); |
| 192 |
} |
| 193 |
} |
| 194 |
$dataNode->attributes(\@nonSupplementedAttributes); |
| 195 |
} |
| 196 |
} else { |
| 197 |
foreach my $dataNode (@{$targetDocument->classes}) { |
| 198 |
if ($dataNode->extendedAttributes->{"Supplemental"}) { |
| 199 |
exit 0; |
| 200 |
} |
| 201 |
} |
| 202 |
} |
| 203 |
# Temporary if-else statement until here. |
| 204 |
|
| 115 |
foreach my $idlFile (@supplementedIdlFiles) { |
205 |
foreach my $idlFile (@supplementedIdlFiles) { |
| 116 |
next if $idlFile eq $targetIdlFile; |
206 |
next if $idlFile eq $targetIdlFile; |
| 117 |
|
207 |
|