Mercurial > hg > graal-jvmci-8
comparison mxtool/mx.py @ 16849:0d987db807df
do not generate IDE configurations for distributions auto-generated for projects that define annotation processors
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Sun, 17 Aug 2014 14:20:11 +0200 |
parents | 043575a99815 |
children | 73d994651fcd |
comparison
equal
deleted
inserted
replaced
16848:518559db79c6 | 16849:0d987db807df |
---|---|
95 def add_update_listener(self, listener): | 95 def add_update_listener(self, listener): |
96 self.update_listeners.add(listener) | 96 self.update_listeners.add(listener) |
97 | 97 |
98 """ | 98 """ |
99 Gets the directory in which the IDE project configuration | 99 Gets the directory in which the IDE project configuration |
100 for this distribution is generated. | 100 for this distribution is generated. If this is a distribution |
101 derived from a project defining an annotation processor, then | |
102 None is return to indicate no IDE configuration should be | |
103 created for this distribution. | |
101 """ | 104 """ |
102 def get_ide_project_dir(self): | 105 def get_ide_project_dir(self): |
106 if hasattr(self, 'definingProject') and self.definingProject.definedAnnotationProcessorsDist == self: | |
107 return None | |
103 if hasattr(self, 'subDir'): | 108 if hasattr(self, 'subDir'): |
104 return join(self.suite.dir, self.subDir, self.name + '.dist') | 109 return join(self.suite.dir, self.subDir, self.name + '.dist') |
105 else: | 110 else: |
106 return join(self.suite.dir, self.name + '.dist') | 111 return join(self.suite.dir, self.name + '.dist') |
107 | 112 |
3470 out.open('buildCommand') | 3475 out.open('buildCommand') |
3471 out.element('name', data=buildCommand) | 3476 out.element('name', data=buildCommand) |
3472 out.element('arguments', data='') | 3477 out.element('arguments', data='') |
3473 out.close('buildCommand') | 3478 out.close('buildCommand') |
3474 | 3479 |
3480 if p.definedAnnotationProcessorsDist: | |
3481 # Create a launcher that will (re)build the annotation processor | |
3482 # jar any time one of its sources is modified. | |
3483 dist = p.definedAnnotationProcessorsDist | |
3484 | |
3485 distProjects = [d for d in dist.sorted_deps(transitive=True) if d.isProject()] | |
3486 relevantResources = [] | |
3487 for p in distProjects: | |
3488 for srcDir in p.source_dirs(): | |
3489 relevantResources.append(join(p.name, os.path.relpath(srcDir, p.dir))) | |
3490 relevantResources.append(join(p.name, os.path.relpath(p.output_dir(), p.dir))) | |
3491 | |
3492 # The path should always be p.name/dir independent of where the workspace actually is. | |
3493 # So we use the parent folder of the project, whatever that is, to generate such a relative path. | |
3494 logicalWorkspaceRoot = os.path.dirname(p.dir) | |
3495 refreshFile = os.path.relpath(p.definedAnnotationProcessorsDist.path, logicalWorkspaceRoot) | |
3496 _genEclipseBuilder(out, p, 'CreateAnnotationProcessorJar', 'archive @' + dist.name, refresh=True, refreshFile=refreshFile, relevantResources=relevantResources, async=True, xmlIndent='', xmlStandalone='no') | |
3497 | |
3475 out.close('buildSpec') | 3498 out.close('buildSpec') |
3476 out.open('natures') | 3499 out.open('natures') |
3477 out.element('nature', data='org.eclipse.jdt.core.javanature') | 3500 out.element('nature', data='org.eclipse.jdt.core.javanature') |
3478 if exists(csConfig): | 3501 if exists(csConfig): |
3479 out.element('nature', data='net.sf.eclipsecs.core.CheckstyleNature') | 3502 out.element('nature', data='net.sf.eclipsecs.core.CheckstyleNature') |
3565 # Create an Eclipse project for each distribution that will create/update the archive | 3588 # Create an Eclipse project for each distribution that will create/update the archive |
3566 # for the distribution whenever any (transitively) dependent project of the | 3589 # for the distribution whenever any (transitively) dependent project of the |
3567 # distribution is updated. | 3590 # distribution is updated. |
3568 for dist in suite.dists: | 3591 for dist in suite.dists: |
3569 projectDir = dist.get_ide_project_dir() | 3592 projectDir = dist.get_ide_project_dir() |
3593 if not projectDir: | |
3594 continue | |
3570 if not exists(projectDir): | 3595 if not exists(projectDir): |
3571 os.makedirs(projectDir) | 3596 os.makedirs(projectDir) |
3572 distProjects = [d for d in dist.sorted_deps(transitive=True) if d.isProject()] | 3597 distProjects = [d for d in dist.sorted_deps(transitive=True) if d.isProject()] |
3573 relevantResources = [] | 3598 relevantResources = [] |
3574 for p in distProjects: | 3599 for p in distProjects: |
4313 rm(join(p.dir, p.name + '.jar')) | 4338 rm(join(p.dir, p.name + '.jar')) |
4314 except: | 4339 except: |
4315 log("Error removing {0}".format(p.name + '.jar')) | 4340 log("Error removing {0}".format(p.name + '.jar')) |
4316 | 4341 |
4317 for d in _dists.itervalues(): | 4342 for d in _dists.itervalues(): |
4318 shutil.rmtree(d.get_ide_project_dir(), ignore_errors=True) | 4343 if d.get_ide_project_dir(): |
4344 shutil.rmtree(d.get_ide_project_dir(), ignore_errors=True) | |
4319 | 4345 |
4320 def ideinit(args, refreshOnly=False, buildProcessorJars=True): | 4346 def ideinit(args, refreshOnly=False, buildProcessorJars=True): |
4321 """(re)generate Eclipse, NetBeans and Intellij project configurations""" | 4347 """(re)generate Eclipse, NetBeans and Intellij project configurations""" |
4322 eclipseinit(args, refreshOnly=refreshOnly, buildProcessorJars=buildProcessorJars) | 4348 eclipseinit(args, refreshOnly=refreshOnly, buildProcessorJars=buildProcessorJars) |
4323 netbeansinit(args, refreshOnly=refreshOnly, buildProcessorJars=buildProcessorJars) | 4349 netbeansinit(args, refreshOnly=refreshOnly, buildProcessorJars=buildProcessorJars) |