Mercurial > hg > truffle
diff mxtool/mx.py @ 8439:39c7142e7aef
added support for projects that extend a package defined in another project when canonicalizing projects
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 22 Mar 2013 11:48:42 +0100 |
parents | d1d486c03e8a |
children | b6b9ab1fde62 |
line wrap: on
line diff
--- a/mxtool/mx.py Fri Mar 22 11:26:08 2013 +0100 +++ b/mxtool/mx.py Fri Mar 22 11:48:42 2013 +0100 @@ -350,6 +350,7 @@ def _init_packages_and_imports(self): if not hasattr(self, '_defined_java_packages'): packages = set() + extendedPackages = set() depPackages = set() for d in self.all_deps([], includeLibs=False, includeSelf=False): depPackages.update(d.defined_java_packages()) @@ -363,7 +364,8 @@ if not pkg in depPackages: packages.add(pkg) else: - # A project imports a package already defined by one of it dependencies + # A project extends a package already defined by one of it dependencies + extendedPackages.add(pkg) imports.add(pkg) for n in javaSources: @@ -371,6 +373,7 @@ content = fp.read() imports.update(importRe.findall(content)) self._defined_java_packages = frozenset(packages) + self._extended_java_packages = frozenset(extendedPackages) importedPackages = set() for imp in imports: @@ -390,6 +393,11 @@ self._init_packages_and_imports() return self._defined_java_packages + def extended_java_packages(self): + """Get the immutable set of Java packages extended by the Java sources of this project""" + self._init_packages_and_imports() + return self._extended_java_packages + def imported_java_packages(self): """Get the immutable set of Java packages defined by other Java projects that are imported by the Java sources of this project.""" @@ -1720,6 +1728,8 @@ else: if pkg in dep.defined_java_packages(): ignoredDeps.discard(name) + if pkg in dep.extended_java_packages(): + ignoredDeps.discard(name) if len(ignoredDeps) != 0: candidates = set(); # Compute dependencies based on projects required by p