changeset 10568:070b4a3c56f3

disabled "noisy" log statements unless -v option (i.e. verbose) is specified to mx
author Doug Simon <doug.simon@oracle.com>
date Fri, 28 Jun 2013 11:02:37 +0200
parents 7cd21876c116
children 6b9ebfcf5fc5
files mx/commands.py mxtool/mx.py
diffstat 2 files changed, 18 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mx/commands.py	Thu Jun 27 22:18:52 2013 -0700
+++ b/mx/commands.py	Fri Jun 28 11:02:37 2013 +0200
@@ -495,7 +495,7 @@
         if build == 'ide-build-target':
             build = os.environ.get('IDE_BUILD_TARGET', 'product')
             if len(build) == 0:
-                mx.log('[skipping build from IDE as IDE_BUILD_TARGET environment variable is ""]')
+                mx.logv('[skipping build from IDE as IDE_BUILD_TARGET environment variable is ""]')
                 continue
 
         jdk = _jdk(build, create=True)
@@ -536,7 +536,7 @@
                     break
 
         if not mustBuild:
-            mx.log('[all files in src and make directories are older than ' + timestampFile[len(_graal_home) + 1:] + ' - skipping native build]')
+            mx.logv('[all files in src and make directories are older than ' + timestampFile[len(_graal_home) + 1:] + ' - skipping native build]')
             continue
 
         if platform.system() == 'Windows':
@@ -1034,17 +1034,17 @@
 def gv(args):
     """run the Graal Visualizer"""
     with open(join(_graal_home, '.graal_visualizer.log'), 'w') as fp:
-        mx.log('[Graal Visualizer log is in ' + fp.name + ']')
+        mx.logv('[Graal Visualizer log is in ' + fp.name + ']')
         if not exists(join(_graal_home, 'visualizer', 'build.xml')):
-            mx.log('[This initial execution may take a while as the NetBeans platform needs to be downloaded]')
+            mx.logv('[This initial execution may take a while as the NetBeans platform needs to be downloaded]')
         mx.run(['ant', '-f', join(_graal_home, 'visualizer', 'build.xml'), '-l', fp.name, 'run'])
 
 def igv(args):
     """run the Ideal Graph Visualizer"""
     with open(join(_graal_home, '.ideal_graph_visualizer.log'), 'w') as fp:
-        mx.log('[Ideal Graph Visualizer log is in ' + fp.name + ']')
+        mx.logv('[Ideal Graph Visualizer log is in ' + fp.name + ']')
         if not exists(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'nbplatform')):
-            mx.log('[This initial execution may take a while as the NetBeans platform needs to be downloaded]')
+            mx.logv('[This initial execution may take a while as the NetBeans platform needs to be downloaded]')
         mx.run(['ant', '-f', join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml'), '-l', fp.name, 'run'])
 
 def bench(args):
--- a/mxtool/mx.py	Thu Jun 27 22:18:52 2013 -0700
+++ b/mxtool/mx.py	Fri Jun 28 11:02:37 2013 +0200
@@ -1226,6 +1226,10 @@
     value = os.environ.get(key, default)
     return value
 
+def logv(msg=None):
+    if _opts.verbose:
+        log(msg)
+    
 def log(msg=None):
     """
     Write a message to the console.
@@ -1528,11 +1532,11 @@
                             break
 
         if not mustBuild:
-            log('[all class files for {0} are up to date - skipping]'.format(p.name))
+            logv('[all class files for {0} are up to date - skipping]'.format(p.name))
             continue
 
         if len(javafilelist) == 0:
-            log('[no Java sources for {0} - skipping]'.format(p.name))
+            logv('[no Java sources for {0} - skipping]'.format(p.name))
             continue
 
         built.add(p.name)
@@ -1668,7 +1672,8 @@
         batch = Batch(join(p.dir, '.settings', 'org.eclipse.jdt.core.prefs'))
 
         if not exists(batch.path):
-            log('[no Eclipse Code Formatter preferences at {0} - skipping]'.format(batch.path))
+            if _opts.verbose:
+                log('[no Eclipse Code Formatter preferences at {0} - skipping]'.format(batch.path))
             continue
 
         for sourceDir in sourceDirs:
@@ -1676,7 +1681,7 @@
                 for f in [join(root, name) for name in files if name.endswith('.java')]:
                     batch.javafiles.append(FileInfo(f))
         if len(batch.javafiles) == 0:
-            log('[no Java sources in {0} - skipping]'.format(p.name))
+            logv('[no Java sources in {0} - skipping]'.format(p.name))
             continue
 
         res = batches.setdefault(batch.settings(), batch)
@@ -1880,7 +1885,7 @@
             for root, _, files in os.walk(sourceDir):
                 javafilelist += [join(root, name) for name in files if name.endswith('.java') and name != 'package-info.java']
             if len(javafilelist) == 0:
-                log('[no Java sources in {0} - skipping]'.format(sourceDir))
+                logv('[no Java sources in {0} - skipping]'.format(sourceDir))
                 continue
 
             timestampFile = join(p.suite.dir, 'mx', 'checkstyle-timestamps', sourceDir[len(p.suite.dir) + 1:].replace(os.sep, '_') + '.timestamp')
@@ -1916,7 +1921,7 @@
                 else:
                     config = join(p.dir, configLocation)
             else:
-                log('[unknown Checkstyle configuration type "' + configType + '" in {0} - skipping]'.format(sourceDir))
+                logv('[unknown Checkstyle configuration type "' + configType + '" in {0} - skipping]'.format(sourceDir))
                 continue
 
             exclude = join(p.dir, '.checkstyle.exclude')
@@ -2875,7 +2880,7 @@
                 for d in deps:
                     assess_candidate(d, projects)
             if not assess_candidate(p, projects):
-                log('[package-list file exists - skipping {0}]'.format(p.name))
+                logv('[package-list file exists - skipping {0}]'.format(p.name))
 
 
     def find_packages(sourceDirs, pkgs=set()):