Mercurial > hg > truffle
comparison mxtool/mx.py @ 15899:e065b9746246
mx: create Eclipse projects for distributions
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 26 May 2014 13:02:29 +0200 |
parents | c102edf38127 |
children | a9781031ecf1 |
comparison
equal
deleted
inserted
replaced
15898:c102edf38127 | 15899:e065b9746246 |
---|---|
3341 | 3341 |
3342 if _isAnnotationProcessorDependency(p): | 3342 if _isAnnotationProcessorDependency(p): |
3343 refreshFile = os.path.relpath(join(p.dir, p.name + '.jar'), logicalWorkspaceRoot) | 3343 refreshFile = os.path.relpath(join(p.dir, p.name + '.jar'), logicalWorkspaceRoot) |
3344 _genEclipseBuilder(out, p, 'Jar', 'archive ' + p.name, refresh=True, refreshFile=refreshFile, relevantResources=[binFolder], async=True, xmlIndent='', xmlStandalone='no') | 3344 _genEclipseBuilder(out, p, 'Jar', 'archive ' + p.name, refresh=True, refreshFile=refreshFile, relevantResources=[binFolder], async=True, xmlIndent='', xmlStandalone='no') |
3345 | 3345 |
3346 if projToDist.has_key(p.name): | |
3347 dist, distDeps = projToDist[p.name] | |
3348 _genEclipseBuilder(out, p, 'Create' + dist.name + 'Dist', 'archive @' + dist.name, relevantResources=[binFolder], logToFile=True, refresh=False, async=True) | |
3349 | |
3350 out.close('buildSpec') | 3346 out.close('buildSpec') |
3351 out.open('natures') | 3347 out.open('natures') |
3352 out.element('nature', data='org.eclipse.jdt.core.javanature') | 3348 out.element('nature', data='org.eclipse.jdt.core.javanature') |
3353 if exists(csConfig): | 3349 if exists(csConfig): |
3354 out.element('nature', data='net.sf.eclipsecs.core.CheckstyleNature') | 3350 out.element('nature', data='net.sf.eclipsecs.core.CheckstyleNature') |
3422 _, launchFile = make_eclipse_attach(suite, 'localhost', '8000', deps=sorted_deps(projectNames=None, includeLibs=True)) | 3418 _, launchFile = make_eclipse_attach(suite, 'localhost', '8000', deps=sorted_deps(projectNames=None, includeLibs=True)) |
3423 files.append(launchFile) | 3419 files.append(launchFile) |
3424 | 3420 |
3425 _zip_files(files, suite.dir, configZip.path) | 3421 _zip_files(files, suite.dir, configZip.path) |
3426 _zip_files(libFiles, suite.dir, configLibsZip) | 3422 _zip_files(libFiles, suite.dir, configLibsZip) |
3423 | |
3424 # Create an Eclipse project for each distribution that will create/update the archive | |
3425 # for the distribution whenever any project of the distribution is updated. | |
3426 for dist in suite.dists: | |
3427 name = dist.name | |
3428 if hasattr(dist, 'subDir'): | |
3429 projectDir = join(suite.dir, dist.subDir, dist.name + '.dist') | |
3430 else: | |
3431 projectDir = join(suite.dir, dist.name + '.dist') | |
3432 if not exists(projectDir): | |
3433 os.makedirs(projectDir) | |
3434 distProjects = [d for d in dist.sorted_deps() if d.isProject()] | |
3435 relevantResources = [] | |
3436 for p in distProjects: | |
3437 for srcDir in p.source_dirs(): | |
3438 relevantResources.append(join(p.name, os.path.relpath(srcDir, p.dir))) | |
3439 relevantResources.append(join(p.name, os.path.relpath(p.output_dir(), p.dir))) | |
3440 out = XMLDoc() | |
3441 out.open('projectDescription') | |
3442 out.element('name', data=dist.name) | |
3443 out.element('comment', data='Updates ' + dist.path + ' if a project dependency of ' + dist.name + ' is updated') | |
3444 out.open('projects') | |
3445 for p in distProjects: | |
3446 out.element('project', data=p.name) | |
3447 out.close('projects') | |
3448 out.open('buildSpec') | |
3449 dist.dir = projectDir | |
3450 dist.javaCompliance = max([p.javaCompliance for p in distProjects]) | |
3451 _genEclipseBuilder(out, dist, 'Create' + dist.name + 'Dist', 'archive @' + dist.name, relevantResources=relevantResources, logToFile=True, refresh=False, async=True) | |
3452 out.close('buildSpec') | |
3453 out.open('natures') | |
3454 out.element('nature', data='org.eclipse.jdt.core.javanature') | |
3455 out.close('natures') | |
3456 out.close('projectDescription') | |
3457 projectFile = join(projectDir, '.project') | |
3458 update_file(projectFile, out.xml(indent='\t', newl='\n')) | |
3459 files.append(projectFile) | |
3427 | 3460 |
3428 def _zip_files(files, baseDir, zipPath): | 3461 def _zip_files(files, baseDir, zipPath): |
3429 fd, tmp = tempfile.mkstemp(suffix='', prefix=basename(zipPath), dir=baseDir) | 3462 fd, tmp = tempfile.mkstemp(suffix='', prefix=basename(zipPath), dir=baseDir) |
3430 try: | 3463 try: |
3431 zf = zipfile.ZipFile(tmp, 'w') | 3464 zf = zipfile.ZipFile(tmp, 'w') |