# HG changeset patch # User Doug Simon # Date 1401102149 -7200 # Node ID e065b97462466a83b11e22b656bcd5d0fcc7e839 # Parent c102edf3812701558834c267bef776c7a402250d mx: create Eclipse projects for distributions diff -r c102edf38127 -r e065b9746246 mx/projects --- a/mx/projects Mon May 26 12:55:17 2014 +0200 +++ b/mx/projects Mon May 26 13:02:29 2014 +0200 @@ -66,6 +66,7 @@ library@VECMATH@sha1=a0ae4f51da409fa0c20fa0ca59e6bbc9413ae71d distribution@GRAAL@path=graal.jar +distribution@GRAAL@subDir=graal distribution@GRAAL@sourcesPath=graal.src.zip distribution@GRAAL@dependencies=\ com.oracle.graal.hotspot.amd64,\ @@ -79,11 +80,13 @@ distribution@GRAAL@exclude=FINDBUGS distribution@TRUFFLE@path=truffle.jar +distribution@TRUFFLE@subDir=graal distribution@TRUFFLE@sourcesPath=truffle-sources.jar distribution@TRUFFLE@dependencies=\ com.oracle.truffle.api.dsl distribution@TRUFFLE-DSL-PROCESSOR@path=truffle-dsl-processor.jar +distribution@TRUFFLE-DSL-PROCESSOR@subDir=graal distribution@TRUFFLE-DSL-PROCESSOR@sourcesPath=truffle-dsl-processor-sources.jar distribution@TRUFFLE-DSL-PROCESSOR@dependencies=\ com.oracle.truffle.dsl.processor diff -r c102edf38127 -r e065b9746246 mxtool/mx.py --- a/mxtool/mx.py Mon May 26 12:55:17 2014 +0200 +++ b/mxtool/mx.py Mon May 26 13:02:29 2014 +0200 @@ -3343,10 +3343,6 @@ refreshFile = os.path.relpath(join(p.dir, p.name + '.jar'), logicalWorkspaceRoot) _genEclipseBuilder(out, p, 'Jar', 'archive ' + p.name, refresh=True, refreshFile=refreshFile, relevantResources=[binFolder], async=True, xmlIndent='', xmlStandalone='no') - if projToDist.has_key(p.name): - dist, distDeps = projToDist[p.name] - _genEclipseBuilder(out, p, 'Create' + dist.name + 'Dist', 'archive @' + dist.name, relevantResources=[binFolder], logToFile=True, refresh=False, async=True) - out.close('buildSpec') out.open('natures') out.element('nature', data='org.eclipse.jdt.core.javanature') @@ -3425,6 +3421,43 @@ _zip_files(files, suite.dir, configZip.path) _zip_files(libFiles, suite.dir, configLibsZip) + # Create an Eclipse project for each distribution that will create/update the archive + # for the distribution whenever any project of the distribution is updated. + for dist in suite.dists: + name = dist.name + if hasattr(dist, 'subDir'): + projectDir = join(suite.dir, dist.subDir, dist.name + '.dist') + else: + projectDir = join(suite.dir, dist.name + '.dist') + if not exists(projectDir): + os.makedirs(projectDir) + distProjects = [d for d in dist.sorted_deps() if d.isProject()] + relevantResources = [] + for p in distProjects: + for srcDir in p.source_dirs(): + relevantResources.append(join(p.name, os.path.relpath(srcDir, p.dir))) + relevantResources.append(join(p.name, os.path.relpath(p.output_dir(), p.dir))) + out = XMLDoc() + out.open('projectDescription') + out.element('name', data=dist.name) + out.element('comment', data='Updates ' + dist.path + ' if a project dependency of ' + dist.name + ' is updated') + out.open('projects') + for p in distProjects: + out.element('project', data=p.name) + out.close('projects') + out.open('buildSpec') + dist.dir = projectDir + dist.javaCompliance = max([p.javaCompliance for p in distProjects]) + _genEclipseBuilder(out, dist, 'Create' + dist.name + 'Dist', 'archive @' + dist.name, relevantResources=relevantResources, logToFile=True, refresh=False, async=True) + out.close('buildSpec') + out.open('natures') + out.element('nature', data='org.eclipse.jdt.core.javanature') + out.close('natures') + out.close('projectDescription') + projectFile = join(projectDir, '.project') + update_file(projectFile, out.xml(indent='\t', newl='\n')) + files.append(projectFile) + def _zip_files(files, baseDir, zipPath): fd, tmp = tempfile.mkstemp(suffix='', prefix=basename(zipPath), dir=baseDir) try: