comparison mxtool/mx.py @ 21395:f9883cab4580

mx: Allow disabling of package prefix check
author Christian Wimmer <christian.wimmer@oracle.com>
date Thu, 14 May 2015 16:20:12 -0700
parents 2b8fb2b8b586
children e3438899928c
comparison
equal deleted inserted replaced
21394:706ffad4d773 21395:f9883cab4580
620 base = basename(path) 620 base = basename(path)
621 cachePath = join(cacheDir, base + '_' + sha1) 621 cachePath = join(cacheDir, base + '_' + sha1)
622 622
623 if not exists(cachePath) or sha1OfFile(cachePath) != sha1: 623 if not exists(cachePath) or sha1OfFile(cachePath) != sha1:
624 if exists(cachePath): 624 if exists(cachePath):
625 log('SHA1 of ' + cachePath + ' does not match expected value (' + sha1 + ') - re-downloading') 625 log('SHA1 of ' + cachePath + ' does not match expected value (' + sha1 + ') - found ' + sha1OfFile(cachePath) + ' - re-downloading')
626 print 'Downloading ' + ("sources " if sources else "") + name + ' from ' + str(urls) 626 print 'Downloading ' + ("sources " if sources else "") + name + ' from ' + str(urls)
627 download(cachePath, urls) 627 download(cachePath, urls)
628 628
629 d = dirname(path) 629 d = dirname(path)
630 if d != '' and not exists(d): 630 if d != '' and not exists(d):
1017 d = join(self.dir, subDir, name) 1017 d = join(self.dir, subDir, name)
1018 workingSets = attrs.pop('workingSets', None) 1018 workingSets = attrs.pop('workingSets', None)
1019 p = Project(self, name, srcDirs, deps, javaCompliance, workingSets, d) 1019 p = Project(self, name, srcDirs, deps, javaCompliance, workingSets, d)
1020 p.checkstyleProj = attrs.pop('checkstyle', name) 1020 p.checkstyleProj = attrs.pop('checkstyle', name)
1021 p.native = attrs.pop('native', '') == 'true' 1021 p.native = attrs.pop('native', '') == 'true'
1022 p.checkPackagePrefix = attrs.pop('checkPackagePrefix', 'true') == 'true'
1022 if not p.native and p.javaCompliance is None: 1023 if not p.native and p.javaCompliance is None:
1023 abort('javaCompliance property required for non-native project ' + name) 1024 abort('javaCompliance property required for non-native project ' + name)
1024 if len(ap) > 0: 1025 if len(ap) > 0:
1025 p._declaredAnnotationProcessors = ap 1026 p._declaredAnnotationProcessors = ap
1026 p.__dict__.update(attrs) 1027 p.__dict__.update(attrs)
3353 The exit code of this command reflects how many projects have non-canonical dependencies.""" 3354 The exit code of this command reflects how many projects have non-canonical dependencies."""
3354 3355
3355 nonCanonical = [] 3356 nonCanonical = []
3356 for s in suites(True): 3357 for s in suites(True):
3357 for p in s.projects: 3358 for p in s.projects:
3358 for pkg in p.defined_java_packages(): 3359 if p.checkPackagePrefix:
3359 if not pkg.startswith(p.name): 3360 for pkg in p.defined_java_packages():
3360 abort('package in {0} does not have prefix matching project name: {1}'.format(p, pkg)) 3361 if not pkg.startswith(p.name):
3362 abort('package in {0} does not have prefix matching project name: {1}'.format(p, pkg))
3361 3363
3362 ignoredDeps = set([name for name in p.deps if project(name, False) is not None]) 3364 ignoredDeps = set([name for name in p.deps if project(name, False) is not None])
3363 for pkg in p.imported_java_packages(): 3365 for pkg in p.imported_java_packages():
3364 for name in p.deps: 3366 for name in p.deps:
3365 dep = project(name, False) 3367 dep = project(name, False)
3449 continue 3451 continue
3450 sourceDirs = p.source_dirs() 3452 sourceDirs = p.source_dirs()
3451 3453
3452 config = join(project(p.checkstyleProj).dir, '.checkstyle_checks.xml') 3454 config = join(project(p.checkstyleProj).dir, '.checkstyle_checks.xml')
3453 if not exists(config): 3455 if not exists(config):
3454 logv('[No Checkstyle configuration foudn for {0} - skipping]'.format(p)) 3456 logv('[No Checkstyle configuration found for {0} - skipping]'.format(p))
3455 continue 3457 continue
3456 3458
3457 # skip checking this Java project if its Java compliance level is "higher" than the configured JDK 3459 # skip checking this Java project if its Java compliance level is "higher" than the configured JDK
3458 jdk = java(p.javaCompliance) 3460 jdk = java(p.javaCompliance)
3459 assert jdk 3461 assert jdk