Title: [208220] trunk
Revision
208220
Author
commit-qu...@webkit.org
Date
2016-11-01 05:20:47 -0700 (Tue, 01 Nov 2016)

Log Message

[CMake] generate-bindings-all.pl uses USES_TERMINAL which leaves a noisy line in interactive Ninja build
https://bugs.webkit.org/show_bug.cgi?id=163868

Patch by Fujii Hironori <hironori.fu...@sony.com> on 2016-11-01
Reviewed by Michael Catanzaro.

It takes long time for generate-bindings-all.pl to generate all
bindings.  So, it shows the progress while running and
USES_TERMINAL option of add_custom_target have been used to invoke
the command.  However, USES_TERMINAL leaves a noisy line in
Ninja's neat build log of interactive build.

A new CMake option SHOW_BINDINGS_GENERATION_PROGRESS is added to
stop using USES_TERMINAL only in case of interactive Ninja build.

.:

* Source/cmake/WebKitMacros.cmake: Added a new option
SHOW_BINDINGS_GENERATION_PROGRESS.  Apended --showProgress switch
of generate-bindings-all.pl and used USES_TERMINAL only if
SHOW_BINDINGS_GENERATION_PROGRESS is enabled.

Source/WebCore:

* bindings/scripts/generate-bindings-all.pl: Added a new switch
--showProgress.  Removed $terminalWidth and getTerminalWidth which
are mainly for interactive Ninja build.  Added printProgress.

Tools:

* Scripts/webkitdirs.pm:
(generateBuildSystemFromCMakeProject): Enable
SHOW_BINDINGS_GENERATION_PROGRESS not in case of interactive
Ninja build.

Modified Paths

Diff

Modified: trunk/ChangeLog (208219 => 208220)


--- trunk/ChangeLog	2016-11-01 08:38:36 UTC (rev 208219)
+++ trunk/ChangeLog	2016-11-01 12:20:47 UTC (rev 208220)
@@ -1,3 +1,24 @@
+2016-11-01  Fujii Hironori  <hironori.fu...@sony.com>
+
+        [CMake] generate-bindings-all.pl uses USES_TERMINAL which leaves a noisy line in interactive Ninja build
+        https://bugs.webkit.org/show_bug.cgi?id=163868
+
+        Reviewed by Michael Catanzaro.
+
+        It takes long time for generate-bindings-all.pl to generate all
+        bindings.  So, it shows the progress while running and
+        USES_TERMINAL option of add_custom_target have been used to invoke
+        the command.  However, USES_TERMINAL leaves a noisy line in
+        Ninja's neat build log of interactive build.
+
+        A new CMake option SHOW_BINDINGS_GENERATION_PROGRESS is added to
+        stop using USES_TERMINAL only in case of interactive Ninja build.
+
+        * Source/cmake/WebKitMacros.cmake: Added a new option
+        SHOW_BINDINGS_GENERATION_PROGRESS.  Apended --showProgress switch
+        of generate-bindings-all.pl and used USES_TERMINAL only if
+        SHOW_BINDINGS_GENERATION_PROGRESS is enabled.
+
 2016-10-31  Ryosuke Niwa  <rn...@webkit.org>
 
         Enable custom elements by default everywhere

Modified: trunk/Source/WebCore/ChangeLog (208219 => 208220)


--- trunk/Source/WebCore/ChangeLog	2016-11-01 08:38:36 UTC (rev 208219)
+++ trunk/Source/WebCore/ChangeLog	2016-11-01 12:20:47 UTC (rev 208220)
@@ -1,3 +1,23 @@
+2016-11-01  Fujii Hironori  <hironori.fu...@sony.com>
+
+        [CMake] generate-bindings-all.pl uses USES_TERMINAL which leaves a noisy line in interactive Ninja build
+        https://bugs.webkit.org/show_bug.cgi?id=163868
+
+        Reviewed by Michael Catanzaro.
+
+        It takes long time for generate-bindings-all.pl to generate all
+        bindings.  So, it shows the progress while running and
+        USES_TERMINAL option of add_custom_target have been used to invoke
+        the command.  However, USES_TERMINAL leaves a noisy line in
+        Ninja's neat build log of interactive build.
+
+        A new CMake option SHOW_BINDINGS_GENERATION_PROGRESS is added to
+        stop using USES_TERMINAL only in case of interactive Ninja build.
+
+        * bindings/scripts/generate-bindings-all.pl: Added a new switch
+        --showProgress.  Removed $terminalWidth and getTerminalWidth which
+        are mainly for interactive Ninja build.  Added printProgress.
+
 2016-11-01  Ryosuke Niwa  <rn...@webkit.org>
 
         Web Inspector: Add the support for custom elements

Modified: trunk/Source/WebCore/bindings/scripts/generate-bindings-all.pl (208219 => 208220)


--- trunk/Source/WebCore/bindings/scripts/generate-bindings-all.pl	2016-11-01 08:38:36 UTC (rev 208219)
+++ trunk/Source/WebCore/bindings/scripts/generate-bindings-all.pl	2016-11-01 12:20:47 UTC (rev 208220)
@@ -50,6 +50,7 @@
 my @ppExtraArgs;
 my $numOfJobs = 1;
 my $idlAttributesFile;
+my $showProgress;
 
 GetOptions('include=s@' => \@idlDirectories,
            'outputDir=s' => \$outputDirectory,
@@ -62,7 +63,8 @@
            'ppExtraOutput=s@' => \@ppExtraOutput,
            'ppExtraArgs=s@' => \@ppExtraArgs,
            'idlAttributesFile=s' => \$idlAttributesFile,
-           'numOfJobs=i' => \$numOfJobs);
+           'numOfJobs=i' => \$numOfJobs,
+           'showProgress' => \$showProgress);
 
 $| = 1;
 my @idlFiles;
@@ -82,7 +84,7 @@
                     '--idlFilesList', $idlFilesList,
                     '--supplementalDependencyFile', $supplementalDependencyFile,
                     @ppExtraArgs);
-        print("Preprocess IDL\n");
+        printProgress("Preprocess IDL");
         executeCommand($perl, @args) == 0 or die;
     }
     readSupplementalDependencyFile($supplementalDependencyFile, \%newSupplements);
@@ -121,7 +123,6 @@
 }}, @idlFiles;
 my $queue = Thread::Queue->new(@idlFilesToUpdate);
 my $abort :shared = 0;
-my $terminalWidth = getTerminalWidth();
 my $totalCount = @idlFilesToUpdate;
 my $currentCount :shared = 0;
 
@@ -162,12 +163,7 @@
         eval {
             $currentCount++;
             my $basename = basename($file);
-            if ($terminalWidth) {
-                my $w = $terminalWidth - 1;
-                print sprintf("%-*.*s\r", $w, $w, "[$currentCount/$totalCount] $basename");
-            } else {
-                print "[$currentCount/$totalCount] $basename\n";
-            }
+            printProgress("[$currentCount/$totalCount] $basename");
             executeCommand($perl, @args, $file) == 0 or die;
         };
         if ($@) {
@@ -230,13 +226,6 @@
     return $path;
 }
 
-sub getTerminalWidth
-{
-    return 0 unless -t STDOUT;
-    return 80 if $^O eq 'MSWin32';
-    return `stty size` =~ /\d+\s+(\d+)/ ? $1 : 80;
-}
-
 sub readSupplementalDependencyFile
 {
     my $filename = shift;
@@ -248,3 +237,10 @@
     }
     close($fh) or die;
 }
+
+sub printProgress
+{
+    return unless $showProgress;
+    my $msg = shift;
+    print "$msg\n";
+}

Modified: trunk/Source/cmake/WebKitMacros.cmake (208219 => 208220)


--- trunk/Source/cmake/WebKitMacros.cmake	2016-11-01 08:38:36 UTC (rev 208219)
+++ trunk/Source/cmake/WebKitMacros.cmake	2016-11-01 12:20:47 UTC (rev 208220)
@@ -45,6 +45,8 @@
     #FIXME: Add support for Xcode.
 endmacro()
 
+option(SHOW_BINDINGS_GENERATION_PROGRESS "Show progress of generating bindings" OFF)
+
 # Helper macro which wraps generate-bindings-all.pl script.
 #   target is a new target name to be added
 #   OUTPUT_SOURCE is a list name which will contain generated sources.(eg. WebCore_SOURCES)
@@ -129,13 +131,16 @@
     endforeach ()
     set(${arg_OUTPUT_SOURCE} ${${arg_OUTPUT_SOURCE}} ${gen_sources} PARENT_SCOPE)
     set(act_args)
+    if (SHOW_BINDINGS_GENERATION_PROGRESS)
+        list(APPEND args --showProgress)
+    endif ()
     if (${CMAKE_VERSION} VERSION_LESS 3.2)
         set_source_files_properties(${gen_sources} ${gen_headers} PROPERTIES GENERATED 1)
     else ()
-        list(APPEND act_args
-            BYPRODUCTS ${gen_sources} ${gen_headers}
-            USES_TERMINAL
-        )
+        list(APPEND act_args BYPRODUCTS ${gen_sources} ${gen_headers})
+        if (SHOW_BINDINGS_GENERATION_PROGRESS)
+            list(APPEND act_args USES_TERMINAL)
+        endif ()
     endif ()
     add_custom_target(${target}
         COMMAND ${PERL_EXECUTABLE} ${binding_generator} ${args}

Modified: trunk/Tools/ChangeLog (208219 => 208220)


--- trunk/Tools/ChangeLog	2016-11-01 08:38:36 UTC (rev 208219)
+++ trunk/Tools/ChangeLog	2016-11-01 12:20:47 UTC (rev 208220)
@@ -1,3 +1,24 @@
+2016-11-01  Fujii Hironori  <hironori.fu...@sony.com>
+
+        [CMake] generate-bindings-all.pl uses USES_TERMINAL which leaves a noisy line in interactive Ninja build
+        https://bugs.webkit.org/show_bug.cgi?id=163868
+
+        Reviewed by Michael Catanzaro.
+
+        It takes long time for generate-bindings-all.pl to generate all
+        bindings.  So, it shows the progress while running and
+        USES_TERMINAL option of add_custom_target have been used to invoke
+        the command.  However, USES_TERMINAL leaves a noisy line in
+        Ninja's neat build log of interactive build.
+
+        A new CMake option SHOW_BINDINGS_GENERATION_PROGRESS is added to
+        stop using USES_TERMINAL only in case of interactive Ninja build.
+
+        * Scripts/webkitdirs.pm:
+        (generateBuildSystemFromCMakeProject): Enable
+        SHOW_BINDINGS_GENERATION_PROGRESS not in case of interactive
+        Ninja build.
+
 2016-10-31  Simon Fraser  <simon.fra...@apple.com>
 
         Add basic visual/layout viewport support for fixed position layout

Modified: trunk/Tools/Scripts/webkitdirs.pm (208219 => 208220)


--- trunk/Tools/Scripts/webkitdirs.pm	2016-11-01 08:38:36 UTC (rev 208219)
+++ trunk/Tools/Scripts/webkitdirs.pm	2016-11-01 12:20:47 UTC (rev 208220)
@@ -1964,6 +1964,8 @@
     } elsif (isAnyWindows() && isWin64()) {
         push @args, '-G "Visual Studio 14 2015 Win64"';
     }
+    # Do not show progress of generating bindings in interactive Ninja build not to leave noisy lines on tty
+    push @args, '-DSHOW_BINDINGS_GENERATION_PROGRESS=1' unless ($willUseNinja && -t STDOUT);
 
     # Some ports have production mode, but build-webkit should always use developer mode.
     push @args, "-DDEVELOPER_MODE=ON" if isEfl() || isGtk() || isJSCOnly();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to