Mercurial > hg > graal-jvmci-8
comparison mxtool/mx.py @ 14775:40aa1eb176db
mx: added support for excluding dependencies from distributions
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 26 Mar 2014 22:18:44 +0100 |
parents | 5823c399e28f |
children | d2038d372cd2 |
comparison
equal
deleted
inserted
replaced
14774:8594b26fc5d8 | 14775:40aa1eb176db |
---|---|
59 | 59 |
60 """ | 60 """ |
61 A distribution is a jar or zip file containing the output from one or more Java projects. | 61 A distribution is a jar or zip file containing the output from one or more Java projects. |
62 """ | 62 """ |
63 class Distribution: | 63 class Distribution: |
64 def __init__(self, suite, name, path, deps): | 64 def __init__(self, suite, name, path, deps, exclDeps): |
65 self.suite = suite | 65 self.suite = suite |
66 self.name = name | 66 self.name = name |
67 self.path = path.replace('/', os.sep) | 67 self.path = path.replace('/', os.sep) |
68 if not isabs(self.path): | 68 if not isabs(self.path): |
69 self.path = join(suite.dir, self.path) | 69 self.path = join(suite.dir, self.path) |
70 self.deps = deps | 70 self.deps = deps |
71 self.update_listeners = set() | 71 self.update_listeners = set() |
72 self.exclDeps = exclDeps | |
73 | |
74 def sorted_deps(self, includeLibs=False): | |
75 excl = [dependency(d) for d in self.exclDeps] | |
76 return [d for d in sorted_deps(self.deps, includeLibs=includeLibs) if d not in excl] | |
72 | 77 |
73 def __str__(self): | 78 def __str__(self): |
74 return self.name | 79 return self.name |
75 | 80 |
76 def add_update_listener(self, listener): | 81 def add_update_listener(self, listener): |
612 self.libs.append(l) | 617 self.libs.append(l) |
613 | 618 |
614 for name, attrs in distsMap.iteritems(): | 619 for name, attrs in distsMap.iteritems(): |
615 path = attrs.pop('path') | 620 path = attrs.pop('path') |
616 deps = pop_list(attrs, 'dependencies') | 621 deps = pop_list(attrs, 'dependencies') |
617 d = Distribution(self, name, path, deps) | 622 exclDeps = pop_list(attrs, 'excludeDependencies') |
623 d = Distribution(self, name, path, deps, exclDeps) | |
618 d.__dict__.update(attrs) | 624 d.__dict__.update(attrs) |
619 self.dists.append(d) | 625 self.dists.append(d) |
620 | 626 |
621 if self.name is None: | 627 if self.name is None: |
622 abort('Missing "suite=<name>" in ' + projectsFile) | 628 abort('Missing "suite=<name>" in ' + projectsFile) |
2126 if arcname in zf.namelist(): | 2132 if arcname in zf.namelist(): |
2127 log('warning: ' + d.path + ': overwriting ' + arcname + ' [source: ' + source + ']') | 2133 log('warning: ' + d.path + ': overwriting ' + arcname + ' [source: ' + source + ']') |
2128 | 2134 |
2129 try: | 2135 try: |
2130 zf = zipfile.ZipFile(tmp, 'w') | 2136 zf = zipfile.ZipFile(tmp, 'w') |
2131 for dep in sorted_deps(d.deps, includeLibs=True): | 2137 for dep in d.sorted_deps(includeLibs=True): |
2132 if dep.isLibrary(): | 2138 if dep.isLibrary(): |
2133 l = dep | 2139 l = dep |
2134 # merge library jar into distribution jar | 2140 # merge library jar into distribution jar |
2135 logv('[' + d.path + ': adding library ' + l.name + ']') | 2141 logv('[' + d.path + ': adding library ' + l.name + ']') |
2136 lpath = l.get_path(resolve=True) | 2142 lpath = l.get_path(resolve=True) |
2745 if buildProcessorJars: | 2751 if buildProcessorJars: |
2746 files += _processorjars_suite(suite) | 2752 files += _processorjars_suite(suite) |
2747 | 2753 |
2748 projToDist = dict() | 2754 projToDist = dict() |
2749 for dist in _dists.values(): | 2755 for dist in _dists.values(): |
2750 distDeps = sorted_deps(dist.deps) | 2756 distDeps = dist.sorted_deps() |
2751 for p in distDeps: | 2757 for p in distDeps: |
2752 projToDist[p.name] = (dist, [dep.name for dep in distDeps]) | 2758 projToDist[p.name] = (dist, [dep.name for dep in distDeps]) |
2753 | 2759 |
2754 for p in suite.projects: | 2760 for p in suite.projects: |
2755 if p.native: | 2761 if p.native: |