build: use 'Compiling foo.c' and 'Linking foo' like old build system
authorAndrew Tridgell <tridge@samba.org>
Sun, 28 Mar 2010 21:30:29 +0000 (08:30 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 6 Apr 2010 10:27:15 +0000 (20:27 +1000)
When -p is not used, display compilation messages similarly to the old
build system, but with a progress indicator

buildtools/wafsamba/wafsamba.py

index 9db21a466d3ef0e3394206767b04e3cb9bbc02ec..afe900befd295e52e311df4c04f24075971253ef 100644 (file)
@@ -751,3 +751,22 @@ def PKG_CONFIG_FILES(bld, pc_files):
                             target=f)
         INSTALL_FILES(bld, dest, f, flat=True, destname=base)
 Build.BuildContext.PKG_CONFIG_FILES = PKG_CONFIG_FILES
+
+
+# override the display of the compilation and linking messages
+def progress(self):
+    return "[%d/%d]" % (self.position[0], self.position[1])
+
+def cc_display(self):
+    if Options.options.progress_bar != 0:
+        return Task.Task.display(self)
+    fname = self.inputs[0].bldpath(self.env)[3:]
+    return "%s Compiling %s\n" % (progress(self), fname)
+Task.TaskBase.classes['cc'].display = cc_display
+
+def link_display(self):
+    if Options.options.progress_bar != 0:
+        return Task.Task.display(self)
+    fname = self.outputs[0].bldpath(self.env)
+    return "%s Linking %s\n" % (progress(self), fname)
+Task.TaskBase.classes['cc_link'].display = link_display