# HG changeset patch # User Doug Simon # Date 1342086903 -7200 # Node ID 0cd337450409afda00b523bd542d552bc3ebb415 # Parent ade4014aa89589fd630804806307190ff3cb8dbc added support to mx for ignoring (broken) projects diff -r ade4014aa895 -r 0cd337450409 mxtool/mx.py --- a/mxtool/mx.py Wed Jul 11 15:38:28 2012 +0200 +++ b/mxtool/mx.py Thu Jul 12 11:55:03 2012 +0200 @@ -57,7 +57,8 @@ env A set of environment variable definitions. These override any - existing environment variables. + existing environment variables. Common properties set here + include JAVA_HOME and IGNORED_PROJECTS. The includes and env files are typically not put under version control as they usually contain local file-system paths. @@ -194,7 +195,11 @@ if includeLibs and not dep in deps: deps.append(dep) else: - dep = project(name) + dep = _projects.get(name, None) + if dep is None: + if name in _opts.ignored_projects: + abort('project named ' + name + ' required by ' + self.name + ' is ignored') + abort('dependency named ' + name + ' required by ' + self.name + ' is not found') if not dep in deps: dep.all_deps(deps, includeLibs) if not self in deps and includeSelf: @@ -449,7 +454,8 @@ existing = _projects.get(p.name) if existing is not None: abort('cannot override project ' + p.name + ' in ' + p.dir + " with project of the same name in " + existing.dir) - _projects[p.name] = p + if not p.name in _opts.ignored_projects: + _projects[p.name] = p for l in self.libs: existing = _libs.get(l.name) if existing is not None: @@ -566,6 +572,8 @@ """ p = _projects.get(name) if p is None and fatalIfMissing: + if name in _opts.ignored_projects: + abort('project named ' + name + ' is ignored') abort('project named ' + name + ' not found') return p @@ -671,6 +679,7 @@ self.add_argument('--Ja', action='append', dest='java_args_sfx', help='suffix Java VM arguments (e.g. --Ja @-dsa)', metavar='@', default=[]) self.add_argument('--user-home', help='users home directory', metavar='', default=os.path.expanduser('~')) self.add_argument('--java-home', help='JDK installation directory (must be JDK 6 or later)', metavar='') + self.add_argument('--ignore-project', action='append', dest='ignored_projects', help='name of project to ignore', metavar='', default=[]) if get_os() != 'windows': # Time outs are (currently) implemented with Unix specific functionality self.add_argument('--timeout', help='Timeout (in seconds) for command', type=int, default=0, metavar='') @@ -703,6 +712,8 @@ os.environ['JAVA_HOME'] = opts.java_home os.environ['HOME'] = opts.user_home + opts.ignored_projects = opts.ignored_projects + os.environ.get('IGNORED_PROJECTS', '').split(',') + commandAndArgs = opts.__dict__.pop('commandAndArgs') return opts, commandAndArgs