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

Side by Side Diff: Source/core/scripts/make_names.pl

Issue 14456006: Fixes to make scripts generate includes with paths. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated to a newer chromium version Created 7 years, 7 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
« no previous file with comments | « Source/core/scripts/make_event_factory.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/perl -w 1 #!/usr/bin/perl -w
2 2
3 # Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. 3 # Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved.
4 # Copyright (C) 2009, Julien Chaffraix <jchaffraix@webkit.org> 4 # Copyright (C) 2009, Julien Chaffraix <jchaffraix@webkit.org>
5 # Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmob ile.com/) 5 # Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmob ile.com/)
6 # Copyright (C) 2011 Ericsson AB. All rights reserved. 6 # Copyright (C) 2011 Ericsson AB. All rights reserved.
7 # 7 #
8 # Redistribution and use in source and binary forms, with or without 8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions 9 # modification, are permitted provided that the following conditions
10 # are met: 10 # are met:
(...skipping 20 matching lines...) Expand all
31 31
32 use strict; 32 use strict;
33 33
34 use StaticString; 34 use StaticString;
35 use Config; 35 use Config;
36 use Getopt::Long; 36 use Getopt::Long;
37 use File::Path; 37 use File::Path;
38 use File::Spec; 38 use File::Spec;
39 use IO::File; 39 use IO::File;
40 use InFilesParser; 40 use InFilesParser;
41 use idltopath;
41 42
42 sub readTags($$); 43 sub readTags($$);
43 sub readAttrs($$); 44 sub readAttrs($$);
44 45
45 my $printFactory = 0; 46 my $printFactory = 0;
47 my $idlToPathFile = "";
46 my $fontNamesIn = ""; 48 my $fontNamesIn = "";
47 my $tagsFile = ""; 49 my $tagsFile = "";
48 my $attrsFile = ""; 50 my $attrsFile = "";
49 my $outputDir = "."; 51 my $outputDir = ".";
50 my %parsedTags = (); 52 my %parsedTags = ();
51 my %parsedAttrs = (); 53 my %parsedAttrs = ();
52 my %enabledTags = (); 54 my %enabledTags = ();
53 my %enabledAttrs = (); 55 my %enabledAttrs = ();
54 my %allTags = (); 56 my %allTags = ();
55 my %allAttrs = (); 57 my %allAttrs = ();
(...skipping 15 matching lines...) Expand all
71 } 73 }
72 my $preprocessor = $gccLocation . " -E -x c++"; 74 my $preprocessor = $gccLocation . " -E -x c++";
73 75
74 GetOptions( 76 GetOptions(
75 'tags=s' => \$tagsFile, 77 'tags=s' => \$tagsFile,
76 'attrs=s' => \$attrsFile, 78 'attrs=s' => \$attrsFile,
77 'factory' => \$printFactory, 79 'factory' => \$printFactory,
78 'outputDir=s' => \$outputDir, 80 'outputDir=s' => \$outputDir,
79 'extraDefines=s' => \$extraDefines, 81 'extraDefines=s' => \$extraDefines,
80 'preprocessor=s' => \$preprocessor, 82 'preprocessor=s' => \$preprocessor,
83 'idltopathfile=s' => \$idlToPathFile,
81 'fonts=s' => \$fontNamesIn 84 'fonts=s' => \$fontNamesIn
82 ); 85 );
83 86
87 initIdlToPath($idlToPathFile);
88
84 mkpath($outputDir); 89 mkpath($outputDir);
85 90
86 if (length($fontNamesIn)) { 91 if (length($fontNamesIn)) {
87 my $names = new IO::File; 92 my $names = new IO::File;
88 my $familyNamesFileBase = "WebKitFontFamily"; 93 my $familyNamesFileBase = "WebKitFontFamily";
89 94
90 open($names, $fontNamesIn) or die "Failed to open file: $fontNamesIn"; 95 open($names, $fontNamesIn) or die "Failed to open file: $fontNamesIn";
91 96
92 $initDefaults = 0; 97 $initDefaults = 0;
93 my $Parser = InFilesParser->new(); 98 my $Parser = InFilesParser->new();
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 { 536 {
532 my ($F, $prefix, $nsName, $usedNamespace) = @_; 537 my ($F, $prefix, $nsName, $usedNamespace) = @_;
533 538
534 print F "#include \"config.h\"\n\n"; 539 print F "#include \"config.h\"\n\n";
535 print F "#ifdef SKIP_STATIC_CONSTRUCTORS_ON_GCC\n"; 540 print F "#ifdef SKIP_STATIC_CONSTRUCTORS_ON_GCC\n";
536 print F "#define ${prefix}_${nsName}NAMES_HIDE_GLOBALS 1\n"; 541 print F "#define ${prefix}_${nsName}NAMES_HIDE_GLOBALS 1\n";
537 print F "#else\n"; 542 print F "#else\n";
538 print F "#define QNAME_DEFAULT_CONSTRUCTOR 1\n"; 543 print F "#define QNAME_DEFAULT_CONSTRUCTOR 1\n";
539 print F "#endif\n\n"; 544 print F "#endif\n\n";
540 545
541 print F "#include \"${nsName}Names.h\"\n\n"; 546 print F "#include \"./././${nsName}Names.h\"\n\n";
542 print F "#include <wtf/StaticConstructors.h>\n"; 547 print F "#include <wtf/StaticConstructors.h>\n";
543 548
544 print F "namespace WebCore {\n\n"; 549 print F "namespace WebCore {\n\n";
545 print F "namespace ${nsName}Names {\n\n"; 550 print F "namespace ${nsName}Names {\n\n";
546 print F "using namespace $usedNamespace;\n\n"; 551 print F "using namespace $usedNamespace;\n\n";
547 } 552 }
548 553
549 sub printInit 554 sub printInit
550 { 555 {
551 my ($F, $isDefinition) = @_; 556 my ($F, $isDefinition) = @_;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 my %tagsSeen; 723 my %tagsSeen;
719 for my $tagName (sort keys %enabledTags) { 724 for my $tagName (sort keys %enabledTags) {
720 my $JSInterfaceName = $enabledTags{$tagName}{JSInterfaceName}; 725 my $JSInterfaceName = $enabledTags{$tagName}{JSInterfaceName};
721 next if defined($tagsSeen{$JSInterfaceName}) || usesDefaultJSWrapper($ta gName); 726 next if defined($tagsSeen{$JSInterfaceName}) || usesDefaultJSWrapper($ta gName);
722 if ($enabledTags{$tagName}{conditional}) { 727 if ($enabledTags{$tagName}{conditional}) {
723 # We skip feature-define-specific #includes here since we handle the m separately. 728 # We skip feature-define-specific #includes here since we handle the m separately.
724 next; 729 next;
725 } 730 }
726 $tagsSeen{$JSInterfaceName} = 1; 731 $tagsSeen{$JSInterfaceName} = 1;
727 732
728 print F "#include \"V8${JSInterfaceName}.h\"\n"; 733 # V8HTMLElementWrapperFactory.cpp that uses this code is generated into "webkit" and for instance V8HTMLAnchorElement.h is in "webkit/bindings"
734 print F "#include \"bindings/V8${JSInterfaceName}.h\"\n";
729 } 735 }
730 print F "#include \"V8$parameters{fallbackInterfaceName}.h\"\n"; 736 print F "#include \"bindings/V8$parameters{fallbackInterfaceName}.h\"\n";
731 } 737 }
732 738
733 sub printElementIncludes 739 sub printElementIncludes
734 { 740 {
735 my $F = shift; 741 my $F = shift;
736 742
737 my %tagsSeen; 743 my %tagsSeen;
738 for my $tagName (sort keys %enabledTags) { 744 for my $tagName (sort keys %enabledTags) {
739 my $interfaceName = $enabledTags{$tagName}{interfaceName}; 745 my $interfaceName = $enabledTags{$tagName}{interfaceName};
740 next if defined($tagsSeen{$interfaceName}); 746 next if defined($tagsSeen{$interfaceName});
741 if ($enabledTags{$tagName}{conditional}) { 747 if ($enabledTags{$tagName}{conditional}) {
742 # We skip feature-define-specific #includes here since we handle the m separately. 748 # We skip feature-define-specific #includes here since we handle the m separately.
743 next; 749 next;
744 } 750 }
745 $tagsSeen{$interfaceName} = 1; 751 $tagsSeen{$interfaceName} = 1;
746 752
747 print F "#include \"${interfaceName}.h\"\n"; 753 my $includepath = idlToPath($interfaceName);
754 print F "#include \"$includepath${interfaceName}.h\"\n";
748 } 755 }
749 print F "#include \"$parameters{fallbackInterfaceName}.h\"\n"; 756 my $fallbackInterface = $parameters{fallbackInterfaceName};
757 if ($fallbackInterface) {
758 my $fallbackInterfacePath = idlToPath($fallbackInterface);
759 print F "#include \"$fallbackInterfacePath$fallbackInterface.h\"\n";
760 }
750 } 761 }
751 762
752 sub printConditionalElementIncludes 763 sub printConditionalElementIncludes
753 { 764 {
754 my ($F, $shouldIncludeV8Headers) = @_; 765 my ($F, $shouldIncludeV8Headers) = @_;
755 766
756 my %conditionals; 767 my %conditionals;
757 my %unconditionalElementIncludes; 768 my %unconditionalElementIncludes;
758 my %unconditionalJSElementIncludes; 769 my %unconditionalJSElementIncludes;
759 770
760 for my $tagName (keys %enabledTags) { 771 for my $tagName (keys %enabledTags) {
761 my $conditional = $enabledTags{$tagName}{conditional}; 772 my $conditional = $enabledTags{$tagName}{conditional};
762 my $interfaceName = $enabledTags{$tagName}{interfaceName}; 773 my $interfaceName = $enabledTags{$tagName}{interfaceName};
763 my $JSInterfaceName = $enabledTags{$tagName}{JSInterfaceName}; 774 my $JSInterfaceName = $enabledTags{$tagName}{JSInterfaceName};
764 775
765 if ($conditional) { 776 if ($conditional) {
766 $conditionals{$conditional}{interfaceNames}{$interfaceName} = 1; 777 $conditionals{$conditional}{interfaceNames}{$interfaceName} = 1;
767 $conditionals{$conditional}{JSInterfaceNames}{$JSInterfaceName} = 1; 778 $conditionals{$conditional}{JSInterfaceNames}{$JSInterfaceName} = 1;
768 } else { 779 } else {
769 $unconditionalElementIncludes{$interfaceName} = 1; 780 $unconditionalElementIncludes{$interfaceName} = 1;
770 $unconditionalJSElementIncludes{$JSInterfaceName} = 1; 781 $unconditionalJSElementIncludes{$JSInterfaceName} = 1;
771 } 782 }
772 } 783 }
773 784
774 for my $conditional (sort keys %conditionals) { 785 for my $conditional (sort keys %conditionals) {
775 print F "\n#if ENABLE($conditional)\n"; 786 print F "\n#if ENABLE($conditional)\n";
776 for my $interfaceName (sort keys %{$conditionals{$conditional}{interface Names}}) { 787 for my $interfaceName (sort keys %{$conditionals{$conditional}{interface Names}}) {
777 next if $unconditionalElementIncludes{$interfaceName}; 788 next if $unconditionalElementIncludes{$interfaceName};
778 print F "#include \"$interfaceName.h\"\n"; 789 my $interfacePath = idlToPath($interfaceName);
790 print F "#include \"$interfacePath/$interfaceName.h\"\n";
779 } 791 }
780 if ($shouldIncludeV8Headers) { 792 if ($shouldIncludeV8Headers) {
781 for my $JSInterfaceName (sort keys %{$conditionals{$conditional}{JSI nterfaceNames}}) { 793 for my $JSInterfaceName (sort keys %{$conditionals{$conditional}{JSI nterfaceNames}}) {
782 next if $unconditionalJSElementIncludes{$JSInterfaceName}; 794 next if $unconditionalJSElementIncludes{$JSInterfaceName};
783 print F "#include \"V8$JSInterfaceName.h\"\n"; 795 print F "#include \"V8$JSInterfaceName.h\"\n";
784 } 796 }
785 } 797 }
786 print F "#endif\n"; 798 print F "#endif\n";
787 } 799 }
788 } 800 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 ; 843 ;
832 844
833 printElementIncludes($F); 845 printElementIncludes($F);
834 846
835 print F "\n#include <wtf/HashMap.h>\n"; 847 print F "\n#include <wtf/HashMap.h>\n";
836 848
837 printConditionalElementIncludes($F); 849 printConditionalElementIncludes($F);
838 850
839 print F <<END 851 print F <<END
840 852
841 #include "ContextFeatures.h" 853 #include "core/dom/ContextFeatures.h"
842 #include "Document.h" 854 #include "core/dom/Document.h"
855 #include "core/page/Settings.h"
843 #include "RuntimeEnabledFeatures.h" 856 #include "RuntimeEnabledFeatures.h"
844 #include "Settings.h"
845 857
846 #include "CustomElementRegistry.h" 858 #include "CustomElementRegistry.h"
847 859
848 namespace WebCore { 860 namespace WebCore {
849 861
850 using namespace $parameters{namespace}Names; 862 using namespace $parameters{namespace}Names;
851 863
852 END 864 END
853 ; 865 ;
854 866
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 print F "\n#include \"$parameters{namespace}Names.h\"\n\n"; 1106 print F "\n#include \"$parameters{namespace}Names.h\"\n\n";
1095 1107
1096 printElementIncludes($F); 1108 printElementIncludes($F);
1097 1109
1098 print F "\n#include <wtf/StdLibExtras.h>\n"; 1110 print F "\n#include <wtf/StdLibExtras.h>\n";
1099 1111
1100 printConditionalElementIncludes($F, 1); 1112 printConditionalElementIncludes($F, 1);
1101 1113
1102 print F <<END 1114 print F <<END
1103 1115
1104 #include "ContextFeatures.h" 1116 #include "core/dom/ContextFeatures.h"
1105 #include "Document.h" 1117 #include "core/dom/Document.h"
1118 #include "core/page/Settings.h"
1106 #include "RuntimeEnabledFeatures.h" 1119 #include "RuntimeEnabledFeatures.h"
1107 #include "Settings.h"
1108 1120
1109 #include "V8$parameters{namespace}Element.h" 1121 #include "V8$parameters{namespace}Element.h"
1110 1122
1111 #include "bindings/v8/CustomElementHelpers.h" 1123 #include "bindings/v8/CustomElementHelpers.h"
1112 1124
1113 #include <v8.h> 1125 #include <v8.h>
1114 1126
1115 namespace WebCore { 1127 namespace WebCore {
1116 1128
1117 using namespace $parameters{namespace}Names; 1129 using namespace $parameters{namespace}Names;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 open F, ">" . $outputDir . "/V8" . $wrapperFactoryFileName . ".h"; 1245 open F, ">" . $outputDir . "/V8" . $wrapperFactoryFileName . ".h";
1234 1246
1235 printLicenseHeader($F); 1247 printLicenseHeader($F);
1236 1248
1237 print F "#ifndef V8$parameters{namespace}ElementWrapperFactory_h\n"; 1249 print F "#ifndef V8$parameters{namespace}ElementWrapperFactory_h\n";
1238 print F "#define V8$parameters{namespace}ElementWrapperFactory_h\n\n"; 1250 print F "#define V8$parameters{namespace}ElementWrapperFactory_h\n\n";
1239 1251
1240 print F "#if $parameters{guardFactoryWith}\n" if $parameters{guardFactoryWit h}; 1252 print F "#if $parameters{guardFactoryWith}\n" if $parameters{guardFactoryWit h};
1241 1253
1242 print F <<END 1254 print F <<END
1243 #include <V8$parameters{namespace}Element.h> 1255 #include "bindings/V8$parameters{namespace}Element.h"
1244 #include <V8$parameters{fallbackInterfaceName}.h> 1256 #include "bindings/V8$parameters{fallbackInterfaceName}.h"
1245 #include <v8.h> 1257 #include <v8.h>
1246 1258
1247 namespace WebCore { 1259 namespace WebCore {
1248 1260
1249 class $parameters{namespace}Element; 1261 class $parameters{namespace}Element;
1250 1262
1251 const QualifiedName* find$parameters{namespace}TagNameOfV8Type(const Wrapper TypeInfo*); 1263 const QualifiedName* find$parameters{namespace}TagNameOfV8Type(const Wrapper TypeInfo*);
1252 v8::Handle<v8::Object> createV8$parameters{namespace}Wrapper($parameters{nam espace}Element*, v8::Handle<v8::Object> creationContext, v8::Isolate*); 1264 v8::Handle<v8::Object> createV8$parameters{namespace}Wrapper($parameters{nam espace}Element*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
1253 inline v8::Handle<v8::Object> createV8$parameters{namespace}DirectWrapper($p arameters{namespace}Element* element, v8::Handle<v8::Object> creationContext, v8 ::Isolate* isolate) 1265 inline v8::Handle<v8::Object> createV8$parameters{namespace}DirectWrapper($p arameters{namespace}Element* element, v8::Handle<v8::Object> creationContext, v8 ::Isolate* isolate)
1254 { 1266 {
1255 return V8$parameters{namespace}Element::createWrapper(element, creationC ontext, isolate); 1267 return V8$parameters{namespace}Element::createWrapper(element, creationC ontext, isolate);
1256 } 1268 }
1257 inline v8::Handle<v8::Object> createV8$parameters{namespace}FallbackWrapper( $parameters{fallbackInterfaceName}* element, v8::Handle<v8::Object> creationCont ext, v8::Isolate* isolate) 1269 inline v8::Handle<v8::Object> createV8$parameters{namespace}FallbackWrapper( $parameters{fallbackInterfaceName}* element, v8::Handle<v8::Object> creationCont ext, v8::Isolate* isolate)
1258 { 1270 {
1259 return V8$parameters{fallbackInterfaceName}::createWrapper(element, crea tionContext, isolate); 1271 return V8$parameters{fallbackInterfaceName}::createWrapper(element, crea tionContext, isolate);
1260 } 1272 }
1261 } 1273 }
1262 END 1274 END
1263 ; 1275 ;
1264 print F "#endif // $parameters{guardFactoryWith}\n\n" if $parameters{guardFa ctoryWith}; 1276 print F "#endif // $parameters{guardFactoryWith}\n\n" if $parameters{guardFa ctoryWith};
1265 1277
1266 print F "#endif // V8$parameters{namespace}ElementWrapperFactory_h\n"; 1278 print F "#endif // V8$parameters{namespace}ElementWrapperFactory_h\n";
1267 1279
1268 close F; 1280 close F;
1269 } 1281 }
OLDNEW
« no previous file with comments | « Source/core/scripts/make_event_factory.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698