comparison mxtool/mx.py @ 5821:0cd337450409

added support to mx for ignoring (broken) projects
author Doug Simon <doug.simon@oracle.com>
date Thu, 12 Jul 2012 11:55:03 +0200
parents 488864d5069a
children b1dc8fbebb48
comparison
equal deleted inserted replaced
5818:ade4014aa895 5821:0cd337450409
55 Other suites to be loaded. This is recursive. Each 55 Other suites to be loaded. This is recursive. Each
56 line in an includes file is a path to a suite directory. 56 line in an includes file is a path to a suite directory.
57 57
58 env 58 env
59 A set of environment variable definitions. These override any 59 A set of environment variable definitions. These override any
60 existing environment variables. 60 existing environment variables. Common properties set here
61 include JAVA_HOME and IGNORED_PROJECTS.
61 62
62 The includes and env files are typically not put under version control 63 The includes and env files are typically not put under version control
63 as they usually contain local file-system paths. 64 as they usually contain local file-system paths.
64 65
65 The projects file is like the pom.xml file from Maven except that 66 The projects file is like the pom.xml file from Maven except that
192 dep = _libs.get(name, None) 193 dep = _libs.get(name, None)
193 if dep is not None: 194 if dep is not None:
194 if includeLibs and not dep in deps: 195 if includeLibs and not dep in deps:
195 deps.append(dep) 196 deps.append(dep)
196 else: 197 else:
197 dep = project(name) 198 dep = _projects.get(name, None)
199 if dep is None:
200 if name in _opts.ignored_projects:
201 abort('project named ' + name + ' required by ' + self.name + ' is ignored')
202 abort('dependency named ' + name + ' required by ' + self.name + ' is not found')
198 if not dep in deps: 203 if not dep in deps:
199 dep.all_deps(deps, includeLibs) 204 dep.all_deps(deps, includeLibs)
200 if not self in deps and includeSelf: 205 if not self in deps and includeSelf:
201 deps.append(self) 206 deps.append(self)
202 return deps 207 return deps
447 self.mx_post_parse_cmd_line(opts) 452 self.mx_post_parse_cmd_line(opts)
448 for p in self.projects: 453 for p in self.projects:
449 existing = _projects.get(p.name) 454 existing = _projects.get(p.name)
450 if existing is not None: 455 if existing is not None:
451 abort('cannot override project ' + p.name + ' in ' + p.dir + " with project of the same name in " + existing.dir) 456 abort('cannot override project ' + p.name + ' in ' + p.dir + " with project of the same name in " + existing.dir)
452 _projects[p.name] = p 457 if not p.name in _opts.ignored_projects:
458 _projects[p.name] = p
453 for l in self.libs: 459 for l in self.libs:
454 existing = _libs.get(l.name) 460 existing = _libs.get(l.name)
455 if existing is not None: 461 if existing is not None:
456 abort('cannot redefine library ' + l.name) 462 abort('cannot redefine library ' + l.name)
457 _libs[l.name] = l 463 _libs[l.name] = l
564 Get the project for a given name. This will abort if the named project does 570 Get the project for a given name. This will abort if the named project does
565 not exist and 'fatalIfMissing' is true. 571 not exist and 'fatalIfMissing' is true.
566 """ 572 """
567 p = _projects.get(name) 573 p = _projects.get(name)
568 if p is None and fatalIfMissing: 574 if p is None and fatalIfMissing:
575 if name in _opts.ignored_projects:
576 abort('project named ' + name + ' is ignored')
569 abort('project named ' + name + ' not found') 577 abort('project named ' + name + ' not found')
570 return p 578 return p
571 579
572 def library(name, fatalIfMissing=True): 580 def library(name, fatalIfMissing=True):
573 """ 581 """
669 self.add_argument('--J', dest='java_args', help='Java VM arguments (e.g. --J @-dsa)', metavar='@<args>', default=DEFAULT_JAVA_ARGS) 677 self.add_argument('--J', dest='java_args', help='Java VM arguments (e.g. --J @-dsa)', metavar='@<args>', default=DEFAULT_JAVA_ARGS)
670 self.add_argument('--Jp', action='append', dest='java_args_pfx', help='prefix Java VM arguments (e.g. --Jp @-dsa)', metavar='@<args>', default=[]) 678 self.add_argument('--Jp', action='append', dest='java_args_pfx', help='prefix Java VM arguments (e.g. --Jp @-dsa)', metavar='@<args>', default=[])
671 self.add_argument('--Ja', action='append', dest='java_args_sfx', help='suffix Java VM arguments (e.g. --Ja @-dsa)', metavar='@<args>', default=[]) 679 self.add_argument('--Ja', action='append', dest='java_args_sfx', help='suffix Java VM arguments (e.g. --Ja @-dsa)', metavar='@<args>', default=[])
672 self.add_argument('--user-home', help='users home directory', metavar='<path>', default=os.path.expanduser('~')) 680 self.add_argument('--user-home', help='users home directory', metavar='<path>', default=os.path.expanduser('~'))
673 self.add_argument('--java-home', help='JDK installation directory (must be JDK 6 or later)', metavar='<path>') 681 self.add_argument('--java-home', help='JDK installation directory (must be JDK 6 or later)', metavar='<path>')
682 self.add_argument('--ignore-project', action='append', dest='ignored_projects', help='name of project to ignore', metavar='<name>', default=[])
674 if get_os() != 'windows': 683 if get_os() != 'windows':
675 # Time outs are (currently) implemented with Unix specific functionality 684 # Time outs are (currently) implemented with Unix specific functionality
676 self.add_argument('--timeout', help='Timeout (in seconds) for command', type=int, default=0, metavar='<secs>') 685 self.add_argument('--timeout', help='Timeout (in seconds) for command', type=int, default=0, metavar='<secs>')
677 self.add_argument('--ptimeout', help='Timeout (in seconds) for subprocesses', type=int, default=0, metavar='<secs>') 686 self.add_argument('--ptimeout', help='Timeout (in seconds) for subprocesses', type=int, default=0, metavar='<secs>')
678 687
700 if opts.user_home is None or opts.user_home == '': 709 if opts.user_home is None or opts.user_home == '':
701 abort('Could not find user home. Use --user-home option or ensure HOME environment variable is set.') 710 abort('Could not find user home. Use --user-home option or ensure HOME environment variable is set.')
702 711
703 os.environ['JAVA_HOME'] = opts.java_home 712 os.environ['JAVA_HOME'] = opts.java_home
704 os.environ['HOME'] = opts.user_home 713 os.environ['HOME'] = opts.user_home
714
715 opts.ignored_projects = opts.ignored_projects + os.environ.get('IGNORED_PROJECTS', '').split(',')
705 716
706 commandAndArgs = opts.__dict__.pop('commandAndArgs') 717 commandAndArgs = opts.__dict__.pop('commandAndArgs')
707 return opts, commandAndArgs 718 return opts, commandAndArgs
708 719
709 def _format_commands(): 720 def _format_commands():