Mercurial > hg > truffle
diff mxtool/mx.py @ 16629:be59a1d39281
respect dependency order between distributions when building them
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 31 Jul 2014 14:43:37 +0200 |
parents | addc0564e5b5 |
children | 1d4313c3ab38 |
line wrap: on
line diff
--- a/mxtool/mx.py Thu Jul 31 13:42:56 2014 +0200 +++ b/mxtool/mx.py Thu Jul 31 14:43:37 2014 +0200 @@ -1006,7 +1006,7 @@ logv('[omitting project {} as dependency {} is missing]'.format(d, name)) del _projects[d.name] self.projects.remove(d) - for dist in _dists.values(): + for dist in _dists.itervalues(): for name in list(dist.deps): if not dependency(name, fatalIfMissing=False): logv('[omitting {} from distribution {}]'.format(name, dist)) @@ -1315,6 +1315,23 @@ return sorted_project_deps(projects, includeLibs=includeLibs, includeJreLibs=includeJreLibs, includeAnnotationProcessors=includeAnnotationProcessors) +def sorted_dists(): + """ + Gets distributions sorted such that each distribution comes after + any distributions it depends upon. + """ + dists = [] + def add_dist(dist): + if not dist in dists: + for depDist in [distribution(name) for name in dist.distDependencies]: + add_dist(depDist) + if not dist in dists: + dists.append(dist) + + for d in _dists.itervalues(): + add_dist(d) + return dists + def sorted_project_deps(projects, includeLibs=False, includeJreLibs=False, includeAnnotationProcessors=False): deps = [] for p in projects: @@ -2392,7 +2409,7 @@ log('Compiling {} failed'.format(t.proj.name)) abort('{} Java compilation tasks failed'.format(len(failed))) - for dist in _dists.values(): + for dist in sorted_dists(): archive(['@' + dist.name]) if suppliedParser: @@ -3457,12 +3474,6 @@ if buildProcessorJars: files += _processorjars_suite(suite) - projToDist = dict() - for dist in _dists.values(): - distDeps = dist.sorted_deps() - for p in distDeps: - projToDist[p.name] = (dist, [dep.name for dep in distDeps]) - for p in suite.projects: if p.native: continue