Mercurial > hg > graal-compiler
diff mxtool/mx.py @ 16417:9fe3cb463079
mx: classpath function now accepts distributions as well (which are prepend to the class path)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 07 Jul 2014 14:51:53 +0200 |
parents | f5437f2db322 |
children | 59fdea1f9e36 |
line wrap: on
line diff
--- a/mxtool/mx.py Mon Jul 07 12:16:36 2014 +0200 +++ b/mxtool/mx.py Mon Jul 07 14:51:53 2014 +0200 @@ -1203,18 +1203,45 @@ def classpath(names=None, resolve=True, includeSelf=True, includeBootClasspath=False): """ - Get the class path for a list of given dependencies, resolving each entry in the + Get the class path for a list of given dependencies and distributions, resolving each entry in the path (e.g. downloading a missing library) if 'resolve' is true. """ if names is None: - result = _as_classpath(sorted_deps(includeLibs=True), resolve) + deps = sorted_deps(includeLibs=True) + dists = list(_dists.values()) else: deps = [] + dists = [] if isinstance(names, types.StringTypes): names = [names] for n in names: - dependency(n).all_deps(deps, True, includeSelf) - result = _as_classpath(deps, resolve) + dep = dependency(n, fatalIfMissing=False) + if dep: + dep.all_deps(deps, True, includeSelf) + else: + dist = distribution(n) + if not dist: + abort('project, library or distribution named ' + n + ' not found') + dists.append(dist) + + if len(dists): + distsDeps = set() + for d in dists: + distsDeps.update(d.sorted_deps()) + + # remove deps covered by a dist that will be on the class path + deps = [d for d in deps if d not in distsDeps] + + result = _as_classpath(deps, resolve) + + # prepend distributions + if len(dists): + distsCp = os.pathsep.join(dist.path for dist in dists) + if len(result): + result = distsCp + os.pathsep + result + else: + result = distsCp + if includeBootClasspath: result = os.pathsep.join([java().bootclasspath(), result]) return result