Mercurial > hg > truffle
comparison mxtool/mx.py @ 16629:be59a1d39281
respect dependency order between distributions when building them
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 31 Jul 2014 14:43:37 +0200 |
parents | addc0564e5b5 |
children | 1d4313c3ab38 |
comparison
equal
deleted
inserted
replaced
16628:d3fec84757ed | 16629:be59a1d39281 |
---|---|
1004 abort('JRE library {} required by {} not found'.format(jreLib, d)) | 1004 abort('JRE library {} required by {} not found'.format(jreLib, d)) |
1005 elif not dependency(name, fatalIfMissing=False): | 1005 elif not dependency(name, fatalIfMissing=False): |
1006 logv('[omitting project {} as dependency {} is missing]'.format(d, name)) | 1006 logv('[omitting project {} as dependency {} is missing]'.format(d, name)) |
1007 del _projects[d.name] | 1007 del _projects[d.name] |
1008 self.projects.remove(d) | 1008 self.projects.remove(d) |
1009 for dist in _dists.values(): | 1009 for dist in _dists.itervalues(): |
1010 for name in list(dist.deps): | 1010 for name in list(dist.deps): |
1011 if not dependency(name, fatalIfMissing=False): | 1011 if not dependency(name, fatalIfMissing=False): |
1012 logv('[omitting {} from distribution {}]'.format(name, dist)) | 1012 logv('[omitting {} from distribution {}]'.format(name, dist)) |
1013 dist.deps.remove(name) | 1013 dist.deps.remove(name) |
1014 | 1014 |
1312 true, libraries are omitted from the result. | 1312 true, libraries are omitted from the result. |
1313 """ | 1313 """ |
1314 projects = projects_from_names(projectNames) | 1314 projects = projects_from_names(projectNames) |
1315 | 1315 |
1316 return sorted_project_deps(projects, includeLibs=includeLibs, includeJreLibs=includeJreLibs, includeAnnotationProcessors=includeAnnotationProcessors) | 1316 return sorted_project_deps(projects, includeLibs=includeLibs, includeJreLibs=includeJreLibs, includeAnnotationProcessors=includeAnnotationProcessors) |
1317 | |
1318 def sorted_dists(): | |
1319 """ | |
1320 Gets distributions sorted such that each distribution comes after | |
1321 any distributions it depends upon. | |
1322 """ | |
1323 dists = [] | |
1324 def add_dist(dist): | |
1325 if not dist in dists: | |
1326 for depDist in [distribution(name) for name in dist.distDependencies]: | |
1327 add_dist(depDist) | |
1328 if not dist in dists: | |
1329 dists.append(dist) | |
1330 | |
1331 for d in _dists.itervalues(): | |
1332 add_dist(d) | |
1333 return dists | |
1317 | 1334 |
1318 def sorted_project_deps(projects, includeLibs=False, includeJreLibs=False, includeAnnotationProcessors=False): | 1335 def sorted_project_deps(projects, includeLibs=False, includeJreLibs=False, includeAnnotationProcessors=False): |
1319 deps = [] | 1336 deps = [] |
1320 for p in projects: | 1337 for p in projects: |
1321 p.all_deps(deps, includeLibs=includeLibs, includeJreLibs=includeJreLibs, includeAnnotationProcessors=includeAnnotationProcessors) | 1338 p.all_deps(deps, includeLibs=includeLibs, includeJreLibs=includeJreLibs, includeAnnotationProcessors=includeAnnotationProcessors) |
2390 if len(failed): | 2407 if len(failed): |
2391 for t in failed: | 2408 for t in failed: |
2392 log('Compiling {} failed'.format(t.proj.name)) | 2409 log('Compiling {} failed'.format(t.proj.name)) |
2393 abort('{} Java compilation tasks failed'.format(len(failed))) | 2410 abort('{} Java compilation tasks failed'.format(len(failed))) |
2394 | 2411 |
2395 for dist in _dists.values(): | 2412 for dist in sorted_dists(): |
2396 archive(['@' + dist.name]) | 2413 archive(['@' + dist.name]) |
2397 | 2414 |
2398 if suppliedParser: | 2415 if suppliedParser: |
2399 return args | 2416 return args |
2400 return None | 2417 return None |
3454 | 3471 |
3455 files = [] | 3472 files = [] |
3456 libFiles = [] | 3473 libFiles = [] |
3457 if buildProcessorJars: | 3474 if buildProcessorJars: |
3458 files += _processorjars_suite(suite) | 3475 files += _processorjars_suite(suite) |
3459 | |
3460 projToDist = dict() | |
3461 for dist in _dists.values(): | |
3462 distDeps = dist.sorted_deps() | |
3463 for p in distDeps: | |
3464 projToDist[p.name] = (dist, [dep.name for dep in distDeps]) | |
3465 | 3476 |
3466 for p in suite.projects: | 3477 for p in suite.projects: |
3467 if p.native: | 3478 if p.native: |
3468 continue | 3479 continue |
3469 _eclipseinit_project(p) | 3480 _eclipseinit_project(p) |