comparison mxtool/mx.py @ 16720:ad19df13df14

mx: add support for Java agent libraries that use the Boot-Class-Path manifest attribute to ensure that are loaded by the boot class path loader
author Doug Simon <doug.simon@oracle.com>
date Thu, 07 Aug 2014 17:32:17 +0200
parents ff2b25002a58
children 22b2950a0613
comparison
equal deleted inserted replaced
16717:91e7d77cfb81 16720:ad19df13df14
501 if not buf: 501 if not buf:
502 break 502 break
503 d.update(buf) 503 d.update(buf)
504 return d.hexdigest() 504 return d.hexdigest()
505 505
506 def download_file_with_sha1(name, path, urls, sha1, sha1path, resolve, mustExist, sources=False): 506 def download_file_with_sha1(name, path, urls, sha1, sha1path, resolve, mustExist, sources=False, canSymlink=True):
507 def _download_lib(): 507 def _download_lib():
508 cacheDir = get_env('MX_CACHE_DIR', join(_opts.user_home, '.mx', 'cache')) 508 cacheDir = get_env('MX_CACHE_DIR', join(_opts.user_home, '.mx', 'cache'))
509 if not exists(cacheDir): 509 if not exists(cacheDir):
510 os.makedirs(cacheDir) 510 os.makedirs(cacheDir)
511 base = basename(path) 511 base = basename(path)
518 download(cachePath, urls) 518 download(cachePath, urls)
519 519
520 d = dirname(path) 520 d = dirname(path)
521 if d != '' and not exists(d): 521 if d != '' and not exists(d):
522 os.makedirs(d) 522 os.makedirs(d)
523 if 'symlink' in dir(os): 523
524 if canSymlink and 'symlink' in dir(os):
524 if exists(path): 525 if exists(path):
525 os.unlink(path) 526 os.unlink(path)
526 os.symlink(cachePath, path) 527 os.symlink(cachePath, path)
527 else: 528 else:
528 shutil.copy(cachePath, path) 529 shutil.copy(cachePath, path)
652 653
653 includedInJDK = getattr(self, 'includedInJDK', None) 654 includedInJDK = getattr(self, 'includedInJDK', None)
654 if includedInJDK and java().javaCompliance >= JavaCompliance(includedInJDK): 655 if includedInJDK and java().javaCompliance >= JavaCompliance(includedInJDK):
655 return None 656 return None
656 657
657 return download_file_with_sha1(self.name, path, self.urls, self.sha1, sha1path, resolve, not self.optional) 658 bootClassPathAgent = self.bootClassPathAgent.lower() == 'true' if hasattr(self, 'bootClassPathAgent') else False
659
660 return download_file_with_sha1(self.name, path, self.urls, self.sha1, sha1path, resolve, not self.optional, canSymlink=not bootClassPathAgent)
658 661
659 def get_source_path(self, resolve): 662 def get_source_path(self, resolve):
660 if self.sourcePath is None: 663 if self.sourcePath is None:
661 return None 664 return None
662 path = _make_absolute(self.sourcePath, self.suite.dir) 665 path = _make_absolute(self.sourcePath, self.suite.dir)