changeset 22042:db48a62aba36

only (re)make archives from build command if at least one compilation occurred
author Doug Simon <doug.simon@oracle.com>
date Sun, 21 Jun 2015 21:43:13 +0200
parents 56c50504d60d
children 770fdbe70bb3
files mx.graal/mx_graal.py mxtool/mx.py
diffstat 2 files changed, 16 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/mx.graal/mx_graal.py	Sat Jun 20 12:37:01 2015 +0200
+++ b/mx.graal/mx_graal.py	Sun Jun 21 21:43:13 2015 +0200
@@ -2370,7 +2370,6 @@
             optionsOwner = arcname[len('META-INF/jvmci.options/'):]
             provider = optionsOwner + '_Options'
             self.expectedOptionsProviders.add(provider.replace('.', '/') + '.class')
-            #assert exists(providerClassfile), 'missing generated Options provider ' + providerClassfile
             self.services.setdefault('com.oracle.jvmci.options.Options', []).append(provider)
         return False
 
@@ -2382,7 +2381,8 @@
         assert len(self.expectedOptionsProviders) == 0, 'missing generated Options providers:\n  ' + '\n  '.join(self.expectedOptionsProviders)
         for service, providers in self.jvmciServices.iteritems():
             arcname = 'META-INF/jvmci.services/' + service
-            self.arc.zf.writestr(arcname, '\n'.join(providers))
+            # Convert providers to a set before printing to remove duplicates
+            self.arc.zf.writestr(arcname, '\n'.join(frozenset(providers)))
 
 def mx_post_parse_cmd_line(opts):  #
     # TODO _minVersion check could probably be part of a Suite in mx?
--- a/mxtool/mx.py	Sat Jun 20 12:37:01 2015 +0200
+++ b/mxtool/mx.py	Sun Jun 21 21:43:13 2015 +0200
@@ -316,7 +316,8 @@
 
                 for service, providers in services.iteritems():
                     arcname = 'META-INF/services/' + service
-                    arc.zf.writestr(arcname, '\n'.join(providers))
+                    # Convert providers to a set before printing to remove duplicates
+                    arc.zf.writestr(arcname, '\n'.join(frozenset(providers)))
 
         self.notify_updated()
 
@@ -3119,17 +3120,18 @@
                 log('Compiling {0} failed'.format(t.proj.name))
             abort('{0} Java compilation tasks failed'.format(len(failed)))
 
-    if args.java and not args.only:
-        files = []
-        for dist in sorted_dists():
-            if dist not in updatedAnnotationProcessorDists:
-                archive(['@' + dist.name])
-            if args.check_distributions and not dist.isProcessorDistribution:
-                with zipfile.ZipFile(dist.path, 'r') as zf:
-                    files.extend([member for member in zf.namelist() if not member.startswith('META-INF')])
-        dups = set([x for x in files if files.count(x) > 1])
-        if len(dups) > 0:
-            abort('Distributions overlap! duplicates: ' + str(dups))
+    if len(tasks) != 0:
+        if args.java and not args.only:
+            files = []
+            for dist in sorted_dists():
+                if dist not in updatedAnnotationProcessorDists:
+                    archive(['@' + dist.name])
+                if args.check_distributions and not dist.isProcessorDistribution:
+                    with zipfile.ZipFile(dist.path, 'r') as zf:
+                        files.extend([member for member in zf.namelist() if not member.startswith('META-INF')])
+            dups = set([x for x in files if files.count(x) > 1])
+            if len(dups) > 0:
+                abort('Distributions overlap! duplicates: ' + str(dups))
 
     if suppliedParser:
         return args