WebKit Bugzilla
Attachment 348040 Details for
Bug 188932
: Improve unified source generator script logging and error messages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188932-20180824144447.patch (text/plain), 6.21 KB, created by
Tim Horton
on 2018-08-24 14:44:48 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tim Horton
Created:
2018-08-24 14:44:48 PDT
Size:
6.21 KB
patch
obsolete
>Subversion Revision: 235331 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index d6a8cc98f14c0362101fe0d4665d1a050037b29a..48e8c4b14906b24d2173f6b7570f6fb848d76174 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,14 @@ >+2018-08-24 Tim Horton <timothy_horton@apple.com> >+ >+ Improve unified source generator script logging and error messages >+ https://bugs.webkit.org/show_bug.cgi?id=188932 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Scripts/generate-unified-source-bundles.rb: >+ Add the ability to explain why you're getting usage() instead of just printing it. >+ Capitalize log messages, and improve the wording in a few places. >+ > 2018-08-24 Antti Koivisto <antti@apple.com> > > Allow creating WeakPtrs to const objects >diff --git a/Source/WTF/Scripts/generate-unified-source-bundles.rb b/Source/WTF/Scripts/generate-unified-source-bundles.rb >index 8db785671589bb443184bf6910ed935dad0568ff..1ef90813098dce9a96adbfec3f2ffc6785bc3ec2 100644 >--- a/Source/WTF/Scripts/generate-unified-source-bundles.rb >+++ b/Source/WTF/Scripts/generate-unified-source-bundles.rb >@@ -28,7 +28,12 @@ require 'getoptlong' > SCRIPT_NAME = File.basename($0) > COMMENT_REGEXP = /\/\// > >-def usage >+def usage(message) >+ if message >+ puts "Error: #{message}" >+ puts >+ end >+ > puts "usage: #{SCRIPT_NAME} [options] <sources-list-file>..." > puts "<sources-list-file> may be separate arguments or one semicolon separated string" > puts "--help (-h) Print this message" >@@ -72,7 +77,7 @@ GetoptLong.new(['--help', '-h', GetoptLong::NO_ARGUMENT], > | opt, arg | > case opt > when '--help' >- usage >+ usage(nil) > when '--verbose' > $verbose = true > when '--derived-sources-path' >@@ -81,7 +86,7 @@ GetoptLong.new(['--help', '-h', GetoptLong::NO_ARGUMENT], > FileUtils.mkpath($unifiedSourceOutputPath) if !$unifiedSourceOutputPath.exist? > when '--source-tree-path' > $sourceTreePath = Pathname.new(arg) >- usage if !$sourceTreePath.exist? >+ usage("Source tree #{arg} does not exist.") if !$sourceTreePath.exist? > when '--feature-flags' > arg.gsub(/\s+/, ";").split(";").map { |x| $featureFlags[x] = true } > when '--print-bundled-sources' >@@ -93,14 +98,15 @@ GetoptLong.new(['--help', '-h', GetoptLong::NO_ARGUMENT], > end > } > >-usage if !$unifiedSourceOutputPath || !$sourceTreePath >-log("putting unified sources in #{$unifiedSourceOutputPath}") >+usage("--derived-sources-path must be specified.") if !$unifiedSourceOutputPath >+usage("--source-tree-path must be specified.") if !$sourceTreePath >+log("Putting unified sources in #{$unifiedSourceOutputPath}") > log("Active Feature flags: #{$featureFlags.keys.inspect}") > >-usage if ARGV.length == 0 >+usage("At least one source list file must be specified.") if ARGV.length == 0 > # Even though CMake will only pass us a single semicolon separated arguemnts, we separate all the arguments for simplicity. > sourceListFiles = ARGV.to_a.map { | sourceFileList | sourceFileList.split(";") }.flatten >-log("source files: #{sourceListFiles}") >+log("Source files: #{sourceListFiles}") > $generatedSources = [] > > class SourceFile >@@ -162,7 +168,7 @@ class BundleManager > def writeFile(file, text) > bundleFile = $unifiedSourceOutputPath + file > if (!bundleFile.exist? || IO::read(bundleFile) != @currentBundleText) >- log("writing bundle #{bundleFile} with: \n#{@currentBundleText}") >+ log("Writing bundle #{bundleFile} with: \n#{@currentBundleText}") > IO::write(bundleFile, @currentBundleText) > end > end >@@ -196,7 +202,7 @@ class BundleManager > path = sourceFile.path > raise "wrong extension: #{path.extname} expected #{@extension}" unless path.extname == ".#{@extension}" > if @fileCount == MAX_BUNDLE_SIZE >- log("flushing because new bundle is full #{@fileCount}") >+ log("Flushing because new bundle is full (#{@fileCount} sources)") > flush > end > @currentBundleText += "#include \"#{sourceFile}\"\n" >@@ -207,14 +213,17 @@ end > def ProcessFileForUnifiedSourceGeneration(sourceFile) > path = sourceFile.path > if ($currentDirectory != path.dirname) >- log("flushing because new dirname old: #{$currentDirectory}, new: #{path.dirname}") >+ log("Flushing because new dirname; old: #{$currentDirectory}, new: #{path.dirname}") > $bundleManagers.each_value { |x| x.flush } > $currentDirectory = path.dirname > end > > bundle = $bundleManagers[path.extname] >- if !bundle || !sourceFile.unifiable >- log("No bundle for #{path.extname} files building #{path} standalone") >+ if !bundle >+ log("No bundle for #{path.extname} files, building #{path} standalone") >+ $generatedSources << sourceFile >+ elsif !sourceFile.unifiable >+ log("Not allowed to unify #{path}, building standalone") > $generatedSources << sourceFile > else > bundle.addFile(sourceFile) >@@ -231,16 +240,16 @@ sourceFiles = [] > > sourceListFiles.each_with_index { > | path, sourceFileIndex | >- log("reading #{path}") >+ log("Reading #{path}") > result = [] > inDisabledLines = false > File.read(path).lines.each { > | line | > commentStart = line =~ COMMENT_REGEXP >- log("before: #{line}") >+ log("Before: #{line}") > if commentStart != nil > line = line.slice(0, commentStart) >- log("after: #{line}") >+ log("After: #{line}") > end > line.strip! > if line == "#endif" >@@ -261,7 +270,7 @@ sourceListFiles.each_with_index { > } > raise "Couldn't find closing \"#endif\"" if inDisabledLines > >- log("found #{result.length} source files in #{path}") >+ log("Found #{result.length} source files in #{path}") > sourceFiles += result > } > >@@ -294,7 +303,7 @@ $bundleManagers.each_value { > } > > # We use stdout to report our unified source list to CMake. >-# Add trailing semicolon since CMake seems dislikes not having it. >+# Add trailing semicolon since CMake dislikes not having it. > # Also, make sure we use print instead of puts because CMake will think the \n is a source file and fail to build. > > log($generatedSources.join(";") + ";")
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
simon.fraser
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188932
: 348040