Mercurial > hg > truffle
comparison mxtool/mx.py @ 4219:47f7d91d34cf
Fix javac build issues with classpath
WIP for benchmarks
author | Gilles Duboscq <gilles.m.duboscq@gmail.com> |
---|---|
date | Wed, 04 Jan 2012 22:54:27 +0100 |
parents | a2caa019ba3a |
children | 339cf8d4904d |
comparison
equal
deleted
inserted
replaced
4218:03eaec130ed1 | 4219:47f7d91d34cf |
---|---|
132 self.deps = deps | 132 self.deps = deps |
133 self.checkstyleProj = name | 133 self.checkstyleProj = name |
134 self.native = False | 134 self.native = False |
135 self.dir = dir | 135 self.dir = dir |
136 | 136 |
137 def all_deps(self, deps, includeLibs): | 137 def all_deps(self, deps, includeLibs, includeSelf=True): |
138 """ | 138 """ |
139 Add the transitive set of dependencies for this project, including | 139 Add the transitive set of dependencies for this project, including |
140 libraries if 'includeLibs' is true, to the 'deps' list. | 140 libraries if 'includeLibs' is true, to the 'deps' list. |
141 """ | 141 """ |
142 if self in deps: | 142 if self in deps: |
149 deps.append(dep) | 149 deps.append(dep) |
150 else: | 150 else: |
151 dep = project(name) | 151 dep = project(name) |
152 if not dep in deps: | 152 if not dep in deps: |
153 dep.all_deps(deps, includeLibs) | 153 dep.all_deps(deps, includeLibs) |
154 if not self in deps: | 154 if not self in deps and includeSelf: |
155 deps.append(self) | 155 deps.append(self) |
156 return deps | 156 return deps |
157 | 157 |
158 def _compute_max_dep_distances(self, name, distances, dist): | 158 def _compute_max_dep_distances(self, name, distances, dist): |
159 currentDist = distances.get(name); | 159 currentDist = distances.get(name); |
414 d.append_to_classpath(cp, resolve) | 414 d.append_to_classpath(cp, resolve) |
415 if _opts.cp_suffix is not None: | 415 if _opts.cp_suffix is not None: |
416 cp += [_opts.cp_suffix] | 416 cp += [_opts.cp_suffix] |
417 return os.pathsep.join(cp) | 417 return os.pathsep.join(cp) |
418 | 418 |
419 def classpath(names=None, resolve=True): | 419 def classpath(names=None, resolve=True, includeSelf=True): |
420 """ | 420 """ |
421 Get the class path for a list of given projects, resolving each entry in the | 421 Get the class path for a list of given projects, resolving each entry in the |
422 path (e.g. downloading a missing library) if 'resolve' is true. | 422 path (e.g. downloading a missing library) if 'resolve' is true. |
423 """ | 423 """ |
424 if names is None: | 424 if names is None: |
425 return _as_classpath(sorted_deps(True), resolve) | 425 return _as_classpath(sorted_deps(True), resolve) |
426 deps = [] | 426 deps = [] |
427 if isinstance(names, types.StringTypes): | 427 if isinstance(names, types.StringTypes): |
428 project(names).all_deps(deps, True) | 428 project(names).all_deps(deps, True, includeSelf) |
429 else: | 429 else: |
430 for n in names: | 430 for n in names: |
431 project(n).all_deps(deps, True) | 431 project(n).all_deps(deps, True, includeSelf) |
432 return _as_classpath(deps, resolve) | 432 return _as_classpath(deps, resolve) |
433 | 433 |
434 def sorted_deps(includeLibs=False): | 434 def sorted_deps(includeLibs=False): |
435 """ | 435 """ |
436 Gets the loaded projects and libraries sorted such that dependencies | 436 Gets the loaded projects and libraries sorted such that dependencies |
831 shutil.rmtree(outputDir) | 831 shutil.rmtree(outputDir) |
832 os.mkdir(outputDir) | 832 os.mkdir(outputDir) |
833 else: | 833 else: |
834 os.mkdir(outputDir) | 834 os.mkdir(outputDir) |
835 | 835 |
836 cp = classpath(p.name) | 836 cp = classpath(p.name, includeSelf=False) |
837 sourceDirs = p.source_dirs() | 837 sourceDirs = p.source_dirs() |
838 mustBuild = args.force | 838 mustBuild = args.force |
839 if not mustBuild: | 839 if not mustBuild: |
840 for dep in p.all_deps([], False): | 840 for dep in p.all_deps([], False): |
841 if dep.name in built: | 841 if dep.name in built: |
888 if 'proprietary API': | 888 if 'proprietary API': |
889 self.c = 2 | 889 self.c = 2 |
890 elif self.c != 0: | 890 elif self.c != 0: |
891 self.c -= 1 | 891 self.c -= 1 |
892 else: | 892 else: |
893 print line.rstrip() | 893 log(line.rstrip()) |
894 errFilt=Filter().eat | 894 errFilt=Filter().eat |
895 | 895 |
896 run([java().javac, '-g', '-J-Xmx1g', '-source', args.compliance, '-classpath', cp, '-d', outputDir, '@' + argfile.name], err=errFilt) | 896 run([java().javac, '-g', '-J-Xmx1g', '-source', args.compliance, '-classpath', cp, '-d', outputDir, '@' + argfile.name], err=errFilt) |
897 else: | 897 else: |
898 log('Compiling Java sources in {0} with JDT...'.format(sourceDir)) | 898 log('Compiling Java sources in {0} with JDT...'.format(sourceDir)) |