changeset 16087:64e172733061

mx clean: delete distributions
author Bernhard Urban <bernhard.urban@jku.at>
date Thu, 12 Jun 2014 11:40:33 +0200
parents 6eef506c173d
children 32ddc8096f4c
files mx/mx_graal.py mxtool/mx.py
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mx/mx_graal.py	Thu Jun 12 11:39:53 2014 +0200
+++ b/mx/mx_graal.py	Thu Jun 12 11:40:33 2014 +0200
@@ -168,7 +168,6 @@
         rmIfExists(join(_graal_home, 'build'))
         rmIfExists(join(_graal_home, 'build-nograal'))
         rmIfExists(_jdksDir())
-        rmIfExists(mx.distribution('GRAAL').path)
 
 def export(args):
     """create archives of builds split by vmbuild and vm"""
--- a/mxtool/mx.py	Thu Jun 12 11:39:53 2014 +0200
+++ b/mxtool/mx.py	Thu Jun 12 11:40:33 2014 +0200
@@ -2849,6 +2849,7 @@
     parser = parser if suppliedParser else ArgumentParser(prog='mx clean')
     parser.add_argument('--no-native', action='store_false', dest='native', help='do not clean native projects')
     parser.add_argument('--no-java', action='store_false', dest='java', help='do not clean Java projects')
+    parser.add_argument('--no-dist', action='store_false', dest='dist', help='do not delete distributions')
 
     args = parser.parse_args(args)
 
@@ -2858,6 +2859,10 @@
             path = unicode("\\\\?\\" + dirPath)
         shutil.rmtree(path)
 
+    def _rmIfExists(name):
+        if os.path.isfile(name):
+            os.unlink(name)
+
     for p in projects_opt_limit_to_suites():
         if p.native:
             if args.native:
@@ -2881,6 +2886,12 @@
                 if config.exists():
                     os.unlink(config.path)
 
+    if args.dist:
+        for d in _dists.keys():
+            log('Removing distribution {0}...'.format(d))
+            _rmIfExists(distribution(d).path)
+            _rmIfExists(distribution(d).sourcesPath)
+
     if suppliedParser:
         return args