Skip to content

Commit

Permalink
[GR-46708] Env files can specify build --dependencies.
Browse files Browse the repository at this point in the history
PullRequest: mx/1620
  • Loading branch information
ansalond committed Jun 16, 2023
2 parents 8774a10 + 2571d00 commit dc422de
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions mx.py
Original file line number Diff line number Diff line change
Expand Up @@ -4416,8 +4416,9 @@ def clean(args, parser=None):
parser = parser if suppliedParser else ArgumentParser(prog='mx clean')
parser.add_argument('--no-native', action='store_false', dest='native', help='do not clean native projects')
parser.add_argument('--no-java', action='store_false', dest='java', help='do not clean Java projects')
parser.add_argument('--dependencies', '--projects', action='store',
help='comma separated projects to clean (omit to clean all projects)')
parser.add_argument('--dependencies', '--projects', '--targets', action='store',
help='comma separated projects to clean (omit to clean all projects)',
default=get_env('BUILD_TARGETS'))
parser.add_argument('--no-dist', action='store_false', dest='dist', help='do not delete distributions')
parser.add_argument('--all', action='store_true', help='clear all dependencies (not just default targets)')
parser.add_argument('--aggressive', action='store_true', help='clear all suite output')
Expand All @@ -4439,7 +4440,7 @@ def _collect_clean_dependencies():
return _dependencies_opt_limit_to_suites(res)

if args.dependencies is not None:
deps = [dependency(name) for name in args.dependencies.split(',')]
deps = [dependency(mx_subst.string_substitutions.substitute(name)) for name in args.dependencies.split(',')]
else:
deps = _collect_clean_dependencies()

Expand Down Expand Up @@ -14632,8 +14633,8 @@ def build(cmd_args, parser=None):
parser.add_argument('--source', dest='compliance', help='Java compliance level for projects without an explicit one')
parser.add_argument('--Wapi', action='store_true', dest='warnAPI', help='show warnings about using internal APIs')
dependencies_group = parser.add_mutually_exclusive_group()
dependencies_group.add_argument('--dependencies', '--projects', action='store', help='comma separated dependencies to build (omit to build all dependencies)', metavar='<names>')
dependencies_group.add_argument('--only', action='store', help='comma separated dependencies to build, without checking their dependencies (omit to build all dependencies)')
dependencies_group.add_argument('--dependencies', '--projects', '--targets', action='store', help='comma separated dependencies to build (omit to build all dependencies)', metavar='<names>', default=get_env('BUILD_TARGETS'))
dependencies_group.add_argument('--only', action='store', help='comma separated dependencies to build, without checking their dependencies (omit to build all dependencies)', default=get_env('BUILD_ONLY'))
parser.add_argument('--no-java', action='store_false', dest='java', help='do not build Java projects')
parser.add_argument('--no-native', action='store_false', dest='native', help='do not build native projects')
parser.add_argument('--no-javac-crosscompile', action='store_false', dest='javac_crosscompile', help="does nothing as cross compilation is no longer supported (preserved for compatibility)")
Expand Down Expand Up @@ -14690,12 +14691,12 @@ def build(cmd_args, parser=None):
if args.only is not None:
# N.B. This build will not respect any dependencies (including annotation processor dependencies)
onlyDeps = set(args.only.split(','))
roots = [dependency(name) for name in onlyDeps]
roots = [dependency(mx_subst.string_substitutions.substitute(name)) for name in onlyDeps]
elif args.dependencies is not None:
if len(args.dependencies) == 0:
abort('The value of the --dependencies argument cannot be the empty string')
names = args.dependencies.split(',')
roots = [dependency(name) for name in names]
roots = [dependency(mx_subst.string_substitutions.substitute(name)) for name in names]
else:
def _describe_jdk_path(p):
if not isabs(p):
Expand Down Expand Up @@ -17575,7 +17576,7 @@ def show_paths(args):
parser.add_argument('--output', action='store_true', help='Show output location rather than archivable result (only for distributions).')
parser.add_argument('spec', help='Dependency specification in the same format as `dependency:` sources in a layout distribution.', metavar='dependency-spec')
args = parser.parse_args(args)
spec = args.spec
spec = mx_subst.string_substitutions.substitute(args.spec)
spec_dict = LayoutDistribution._as_source_dict('dependency:' + spec, 'NO_DIST', 'NO_DEST')
d = dependency(spec_dict['dependency'])
if args.download:
Expand Down Expand Up @@ -18376,7 +18377,7 @@ def alarm_handler(signum, frame):
abort(1, killsig=signal.SIGINT)

# The version must be updated for every PR (checked in CI) and the comment should reflect the PR's issue
version = VersionSpec("6.27.2") # GR-44866 - Add proftool support for Native Image
version = VersionSpec("6.27.3") # env files can specify build --dependencies

_mx_start_datetime = datetime.utcnow()
_last_timestamp = _mx_start_datetime
Expand Down

0 comments on commit dc422de

Please sign in to comment.