Mercurial > hg > truffle
comparison mxtool/mx.py @ 16667:1d4313c3ab38
mx: distribution should (also) be rebuilt when a transitive project dependency is updated
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 31 Jul 2014 17:52:13 +0200 |
parents | be59a1d39281 |
children | 4ae1d1ed5cc1 |
comparison
equal
deleted
inserted
replaced
16665:2f4487a0b588 | 16667:1d4313c3ab38 |
---|---|
74 self.update_listeners = set() | 74 self.update_listeners = set() |
75 self.mainClass = mainClass | 75 self.mainClass = mainClass |
76 self.excludedDependencies = excludedDependencies | 76 self.excludedDependencies = excludedDependencies |
77 self.distDependencies = distDependencies | 77 self.distDependencies = distDependencies |
78 | 78 |
79 def sorted_deps(self, includeLibs=False): | 79 def sorted_deps(self, includeLibs=False, transitive=False): |
80 deps = [] | |
81 if transitive: | |
82 for depDist in [distribution(name) for name in self.distDependencies]: | |
83 for d in depDist.sorted_deps(includeLibs=includeLibs, transitive=True): | |
84 if d not in deps: | |
85 deps.append(d) | |
80 try: | 86 try: |
81 excl = [dependency(d) for d in self.excludedDependencies] | 87 excl = [dependency(d) for d in self.excludedDependencies] |
82 except SystemExit as e: | 88 except SystemExit as e: |
83 abort('invalid excluded dependency for {} distribution: {}'.format(self.name, e)) | 89 abort('invalid excluded dependency for {} distribution: {}'.format(self.name, e)) |
84 return [d for d in sorted_deps(self.deps, includeLibs=includeLibs) if d not in excl] | 90 return deps + [d for d in sorted_deps(self.deps, includeLibs=includeLibs) if d not in excl] |
85 | 91 |
86 def __str__(self): | 92 def __str__(self): |
87 return self.name | 93 return self.name |
88 | 94 |
89 def add_update_listener(self, listener): | 95 def add_update_listener(self, listener): |
3484 | 3490 |
3485 _zip_files(files, suite.dir, configZip.path) | 3491 _zip_files(files, suite.dir, configZip.path) |
3486 _zip_files(libFiles, suite.dir, configLibsZip) | 3492 _zip_files(libFiles, suite.dir, configLibsZip) |
3487 | 3493 |
3488 # Create an Eclipse project for each distribution that will create/update the archive | 3494 # Create an Eclipse project for each distribution that will create/update the archive |
3489 # for the distribution whenever any project of the distribution is updated. | 3495 # for the distribution whenever any (transitively) dependent project of the |
3496 # distribution is updated. | |
3490 for dist in suite.dists: | 3497 for dist in suite.dists: |
3491 if hasattr(dist, 'subDir'): | 3498 if hasattr(dist, 'subDir'): |
3492 projectDir = join(suite.dir, dist.subDir, dist.name + '.dist') | 3499 projectDir = join(suite.dir, dist.subDir, dist.name + '.dist') |
3493 else: | 3500 else: |
3494 projectDir = join(suite.dir, dist.name + '.dist') | 3501 projectDir = join(suite.dir, dist.name + '.dist') |
3495 if not exists(projectDir): | 3502 if not exists(projectDir): |
3496 os.makedirs(projectDir) | 3503 os.makedirs(projectDir) |
3497 distProjects = [d for d in dist.sorted_deps() if d.isProject()] | 3504 distProjects = [d for d in dist.sorted_deps(transitive=True) if d.isProject()] |
3498 relevantResources = [] | 3505 relevantResources = [] |
3499 for p in distProjects: | 3506 for p in distProjects: |
3500 for srcDir in p.source_dirs(): | 3507 for srcDir in p.source_dirs(): |
3501 relevantResources.append(join(p.name, os.path.relpath(srcDir, p.dir))) | 3508 relevantResources.append(join(p.name, os.path.relpath(srcDir, p.dir))) |
3502 relevantResources.append(join(p.name, os.path.relpath(p.output_dir(), p.dir))) | 3509 relevantResources.append(join(p.name, os.path.relpath(p.output_dir(), p.dir))) |
3510 for d in dist.distDependencies: | 3517 for d in dist.distDependencies: |
3511 out.element('project', data=d) | 3518 out.element('project', data=d) |
3512 out.close('projects') | 3519 out.close('projects') |
3513 out.open('buildSpec') | 3520 out.open('buildSpec') |
3514 dist.dir = projectDir | 3521 dist.dir = projectDir |
3515 dist.javaCompliance = max([p.javaCompliance for p in distProjects] + [JavaCompliance('1.8')]) | 3522 dist.javaCompliance = max([p.javaCompliance for p in distProjects]) |
3516 _genEclipseBuilder(out, dist, 'Create' + dist.name + 'Dist', 'archive @' + dist.name, relevantResources=relevantResources, logToFile=True, refresh=False, async=True) | 3523 _genEclipseBuilder(out, dist, 'Create' + dist.name + 'Dist', 'archive @' + dist.name, relevantResources=relevantResources, logToFile=True, refresh=False, async=True) |
3517 out.close('buildSpec') | 3524 out.close('buildSpec') |
3518 out.open('natures') | 3525 out.open('natures') |
3519 out.element('nature', data='org.eclipse.jdt.core.javanature') | 3526 out.element('nature', data='org.eclipse.jdt.core.javanature') |
3520 out.close('natures') | 3527 out.close('natures') |