From b967bedafcfa22be4676ca6ba2c18bb9ab3060df Mon Sep 17 00:00:00 2001 From: Gilles Duboscq Date: Wed, 23 Aug 2023 16:44:28 +0200 Subject: [PATCH 1/8] Fix rebuild issues with hashEntry and fileListEntry changes --- mx.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/mx.py b/mx.py index eb00b661..6ec3114f 100755 --- a/mx.py +++ b/mx.py @@ -6449,6 +6449,7 @@ def make_archive(self): self._install_source(source, output, destination, arc) self._persist_layout() self._persist_linky_state() + self._persist_resource_entries_state() def getArchivableResults(self, use_relpath=True, single=False): for (p, n) in super(LayoutDistribution, self).getArchivableResults(use_relpath, single): @@ -6502,6 +6503,8 @@ def needsUpdate(self, newestInput): return "LINKY_LAYOUT has changed" if not self._check_resources_file_list(): return "fileListPurpose has changed" + if not self._check_resource_entries(): + return "hashEntry or fileListEntry has changed" return None def _persist_layout(self): @@ -6561,6 +6564,37 @@ def _check_linky_state(self): saved_pattern = fp.read() return saved_pattern == LayoutDistribution._linky.pattern + def _resource_entries_state_file(self): + return join(self.suite.get_mx_output_dir(self.platformDependent), 'resource_entries', self.name) + + def _resource_entries_state(self): + if self.hashEntry is None and self.fileListEntry is None: + return None + return f"{self.hashEntry}\n{self.fileListEntry}" + + def _persist_resource_entries_state(self): + state_file = self._resource_entries_state_file() + current_state = self._resource_entries_state() + if current_state is None: + if exists(state_file): + os.unlink(state_file) + return + ensure_dir_exists(dirname(state_file)) + with open(state_file, 'w') as fp: + fp.write(current_state) + + def _check_resource_entries(self): + state_file = self._resource_entries_state_file() + current_state = self._resource_entries_state() + if not exists(state_file): + return current_state is None + if current_state is None: + return False + with open(state_file) as fp: + saved_state = fp.read() + return saved_state == current_state + + def find_single_source_location(self, source, fatal_if_missing=True, abort_on_multiple=False): locations = self.find_source_location(source, fatal_if_missing=fatal_if_missing) unique_locations = set(locations) From 50a1b1c482f9beb42aa4c88e38210a744da6b35f Mon Sep 17 00:00:00 2001 From: Gilles Duboscq Date: Wed, 23 Aug 2023 18:55:00 +0200 Subject: [PATCH 2/8] Fix location of _linky_state_file --- mx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mx.py b/mx.py index 6ec3114f..b5c4bedd 100755 --- a/mx.py +++ b/mx.py @@ -6540,7 +6540,7 @@ def _check_persisted_layout(self): return False def _linky_state_file(self): - return join(self.suite.get_mx_output_dir(), 'linkyState', self.name) + return join(self.suite.get_mx_output_dir(self.platformDependent), 'linkyState', self.name) def _persist_linky_state(self): linky_state_file = self._linky_state_file() From 235e807809f8d0bf6d368614d2b50c51bc3c514b Mon Sep 17 00:00:00 2001 From: Gilles Duboscq Date: Fri, 25 Aug 2023 20:27:22 +0200 Subject: [PATCH 3/8] Add support for merging layout dir distributions from multiple platforms `mx archive-pd-layouts archive.tgz` can be used to create an archive containing the output of all platform-dependent layout dir directories currently built for the local platform. This archive can be sent to another platform and can be restored with `mx restore-pd-layouts archive.tgz`. This will add the files for the first platform into mx's build directory. This can be repeated for multiple platforms. Once all desired/necessary platforms have been restored on one machines, a build can be started with `mx --multi-platform-layout-directories=all build` which will cause the platform-dependent layout directories to logically produce the union of the files from all platforms. For this to work, the platform-dependent layout directories must list the platforms they support in their `platforms` attribute. When using `--multi-platform-layout-directories=all`, it is a build error if there are no files available on disk for a platform list by the `platforms` attribute. It is possible to limit the set of targetted platform by passing a comma-separated list of platforms to `--multi-platform-layout-directories=`. --- mx.py | 81 +++++++++++++++++++++++++++++++++++- mx_jardistribution.py | 14 +++---- mx_multiplatform.py | 95 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 182 insertions(+), 8 deletions(-) create mode 100644 mx_multiplatform.py diff --git a/mx.py b/mx.py index b5c4bedd..2399dd18 100755 --- a/mx.py +++ b/mx.py @@ -33,6 +33,8 @@ import uuid from abc import ABCMeta, abstractmethod, abstractproperty +import mx + if __name__ == '__main__': # Rename this module as 'mx' so it is not re-executed when imported by other modules. sys.modules['mx'] = sys.modules.pop('__main__') @@ -629,6 +631,8 @@ def __init__(self, parents=None): "be stored in the parent directory of the repository containing the primary suite. This option " "can also be configured using the MX_COMPDB environment variable. Use --compdb none to disable.") self.add_argument('--arch', action='store', dest='arch', help='force use of the specified architecture') + self.add_argument('--multi-platform-layout-directories', action='store', help="Causes platform-dependent layout dir distribution to contain the union of the files from their declared platforms. " + "Can be set to 'all' or to a comma-separated list of platforms.") if not is_windows(): # Time outs are (currently) implemented with Unix specific functionality @@ -6699,16 +6703,90 @@ def make_archive(self): os.makedirs(os.path.abspath(os.path.dirname(sentinel)), exist_ok=True) with open(sentinel, 'w'): pass + self._persist_platforms_state() + + def needsUpdate(self, newestInput): + reason = super().needsUpdate(newestInput) + if reason: + return reason + if not self._check_platforms(): + return "--multi-platform-layout-directories changed" + return None + + def _platforms_state_file(self): + return join(self.suite.get_mx_output_dir(self.platformDependent), 'platforms', self.name) + + def _platforms_state(self): + if _opts.multi_platform_layout_directories is None or not self.platformDependent: + return None + canonical_platforms = sorted(set(_opts.multi_platform_layout_directories.split(','))) + return ','.join(canonical_platforms) + + def _persist_platforms_state(self): + state_file = self._platforms_state_file() + current_state = self._platforms_state() + if current_state is None: + if exists(state_file): + os.unlink(state_file) + return + ensure_dir_exists(dirname(state_file)) + with open(state_file, 'w') as fp: + fp.write(current_state) + + def _check_platforms(self): + state_file = self._platforms_state_file() + current_state = self._platforms_state() + if not exists(state_file): + return current_state is None + if current_state is None: + return False + with open(state_file) as fp: + saved_state = fp.read() + return saved_state == current_state def getArchivableResults(self, use_relpath=True, single=False): if single: raise ValueError("{} only produces multiple output".format(self)) output_dir = self.get_output() + contents = {} for dirpath, _, filenames in os.walk(output_dir): for filename in filenames: file_path = join(dirpath, filename) archive_path = relpath(file_path, output_dir) if use_relpath else basename(file_path) + contents[archive_path] = file_path yield file_path, archive_path + if _opts.multi_platform_layout_directories and self.platformDependent: + if _opts.multi_platform_layout_directories == 'all': + requested_platforms = None + else: + requested_platforms = _opts.multi_platform_layout_directories.split(',') + local_os_arch = f"{get_os()}-{get_arch()}" + assert local_os_arch in output_dir + hashes = {} + def _hash(path): + if path not in hashes: + hashes[path] = mx.digest_of_file(path, 'sha1') + return hashes[path] + for platform in self.platforms: + if requested_platforms is not None and platform not in requested_platforms: + continue + if local_os_arch == platform: + continue + foreign_output = output_dir.replace(local_os_arch, platform) + if not isdir(foreign_output): + raise abort(f"Missing {platform} output directory for {self.name} ({foreign_output})") + for dirpath, _, filenames in os.walk(foreign_output): + for filename in filenames: + file_path = join(dirpath, filename) + archive_path = relpath(file_path, foreign_output) if use_relpath else basename(file_path) + if archive_path in contents: + if _hash(file_path) != _hash(contents[archive_path]): + raise abort(f"""File from alternative platfrom is located in the same path but has different contents: +- {contents[archive_path]} +- {file_path}""") + else: + contents[archive_path] = file_path + yield file_path, archive_path def remoteExtension(self): return 'sentinel' @@ -8626,7 +8704,7 @@ def _is_sane_name(m): def create(src): if src.endswith(".tar") or src.endswith(".tar.gz") or src.endswith(".tgz"): return TarExtractor(src) - if src.endswith(".zip"): + if src.endswith(".zip") or src.endswith(".jar"): return ZipExtractor(src) abort("Don't know how to extract the archive: " + src) @@ -18360,6 +18438,7 @@ def list_commands(l): import mx_fetchjdk # pylint: disable=unused-import import mx_bisect # pylint: disable=unused-import import mx_gc # pylint: disable=unused-import +import mx_multiplatform # pylint: disable=unused-import from mx_unittest import unittest from mx_jackpot import jackpot diff --git a/mx_jardistribution.py b/mx_jardistribution.py index 4c80537f..26da4018 100644 --- a/mx_jardistribution.py +++ b/mx_jardistribution.py @@ -875,14 +875,13 @@ def add_jar(self, dep, jar_path, is_sources_jar=False): if self.versioned_meta_inf_re.match(arcname): mx.warn(f"META-INF resources can not be versioned ({arcname} from {jar_path}). The resulting JAR will be invalid.") - def add_file(self, dep, base_dir, relpath, archivePrefix, arcnameCheck=None, includeServices=False): + def add_file(self, dep, filepath, relpath, archivePrefix, arcnameCheck=None, includeServices=False): """ - Adds the contents of the file `base_dir`/`relpath` to `self.bin_archive.staging_dir` + Adds the contents of the file `filepath` to `self.bin_archive.staging_dir` under the path formed by concatenating `archivePrefix` with `relpath`. :param Dependency dep: the Dependency owning the file """ - filepath = join(base_dir, relpath) arcname = join(archivePrefix, relpath).replace(os.sep, '/') assert arcname[-1] != '/' if arcnameCheck is not None and not arcnameCheck(arcname): @@ -1039,7 +1038,8 @@ def add_classes(archivePrefix, includeServices): self.bin_archive.entries[dirEntry] = dirEntry else: relpath = join(reldir, f) - self.add_file(dep, outputDir, relpath, archivePrefix, arcnameCheck=overlay_check, includeServices=includeServices) + filepath = join(root, f) + self.add_file(dep, filepath, relpath, archivePrefix, arcnameCheck=overlay_check, includeServices=includeServices) add_classes(archivePrefix, includeServices=True) sourceDirs = p.source_dirs() @@ -1066,12 +1066,12 @@ def add_classes(archivePrefix, includeServices): outputDir = dep.output_dir() for f in dep.getResults(): relpath = dep.get_relpath(f, outputDir) - self.add_file(dep, outputDir, relpath, archivePrefix) + self.add_file(dep, f, relpath, archivePrefix) elif dep.isLayoutDirDistribution(): mx.logv('[' + original_path + ': adding contents of layout dir distribution ' + dep.name + ']') output = realpath(dep.get_output()) - for _, p in dep.getArchivableResults(): - self.add_file(dep, output, p, '') + for file_path, arc_name in dep.getArchivableResults(): + self.add_file(dep, file_path, arc_name, '') elif dep.isClasspathDependency(): mx.logv('[' + original_path + ': adding classpath ' + dep.name + ']') jarPath = dep.classpath_repr(resolve=True) diff --git a/mx_multiplatform.py b/mx_multiplatform.py new file mode 100644 index 00000000..d7ba9fc5 --- /dev/null +++ b/mx_multiplatform.py @@ -0,0 +1,95 @@ +# +# ---------------------------------------------------------------------------------------------------- +# +# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ---------------------------------------------------------------------------------------------------- +# +import os +import shutil +from argparse import ArgumentParser +from os.path import join, exists, dirname + +import mx + + +def _local_os_arch(): + return f"{mx.get_os()}-{mx.get_arch()}" + + +@mx.command('mx', 'archive-pd-layouts', '') +def mx_archive_pd_layouts(args): + parser = ArgumentParser(prog='mx archive-pd-layouts', description="""Create an archive containing the output of platform-dependent layout directory distributions. +See mx restore-pd-layouts and --multi-platform-layout-directories.""") + parser.add_argument('path', help='path to archive') + args = parser.parse_args(args) + + ext = mx.get_file_extension(args.path) + if ext not in ('zip', 'jar', 'tar', 'tgz'): + raise mx.abort("Unsupported archive extension. Supported: .zip, .jar, .tar, .tgz") + + pd_layout_dirs = [d for d in mx.distributions(True) if isinstance(d, mx.LayoutDirDistribution) and d.platformDependent] + with mx.Archiver(args.path, kind=ext) as arc: + local_os_arch = _local_os_arch() + arc.add_str(local_os_arch, "os-arch", None) + for dist in pd_layout_dirs: + if local_os_arch not in dist.platforms: + raise mx.abort(f"{dist.name} doesn't list {local_os_arch} in its 'platforms' attribute") + mx.log(f"Adding {dist.name}...") + for file_path, arc_name in dist.getArchivableResults(): + arc.add(file_path, f"{dist.name}/{arc_name}", dist.name) + + +@mx.command('mx', 'restore-pd-layouts', '') +def mx_restore_pd_layouts(args): + parser = ArgumentParser(prog='mx restore-pd-layouts', description="""Restore the output of platform-dependent layout directory distributions. +See mx archive-pd-layouts and --multi-platform-layout-directories.""") + parser.add_argument('--ignore-unknown-distributions', action='store_true') + parser.add_argument('path', help='path to archive') + args = parser.parse_args(args) + + local_os_arch = _local_os_arch() + with mx.TempDir(parent_dir=mx.primary_suite().dir) as tmp: + mx.Extractor.create(args.path).extract(tmp) + with open(join(tmp, 'os-arch'), 'r') as f: + os_arch = f.read().strip() + if local_os_arch == os_arch: + mx.warn("Restoring archive from the current platform") + with os.scandir(tmp) as it: + for entry in it: + if entry.is_file(follow_symlinks=False) and entry.name == "os-arch": + continue + if not entry.is_dir(follow_symlinks=False): + raise mx.abort(f"Unexpected file in archive: {entry.name}") + dist = mx.distribution(entry.name, fatalIfMissing=not args.ignore_unknown_distributions) + if not dist: + continue + if not isinstance(dist, mx.LayoutDirDistribution) or not d.platformDependent: + raise mx.abort(f"{entry.name} is not a platform-dependent layout dir distribution") + local_output = dist.get_output() + assert local_os_arch in local_output + mx.log(f"Restoring {dist.name}...") + foreign_output = local_output.replace(local_os_arch, os_arch) + if exists(foreign_output): + mx.rmtree(foreign_output) + mx.ensure_dir_exists(dirname(foreign_output)) + shutil.move(join(tmp, entry.name), foreign_output) From 4d802d43929e31c8ba608d66296932f9f79d3724 Mon Sep 17 00:00:00 2001 From: Gilles Duboscq Date: Fri, 25 Aug 2023 22:51:48 +0200 Subject: [PATCH 4/8] Add support for special targets that can programatially expand Add `{PLATFORM_DEPENDENT_LAYOUT_DIR_DISTRIBUTIONS}` and `{MAVEN_TAG_DISTRIBUTIONS:tag}`. --- mx.py | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/mx.py b/mx.py index 2399dd18..2543bfd4 100755 --- a/mx.py +++ b/mx.py @@ -4454,7 +4454,7 @@ def _collect_clean_dependencies(): return _dependencies_opt_limit_to_suites(res) if args.dependencies is not None: - deps = [dependency(mx_subst.string_substitutions.substitute(name)) for name in args.dependencies.split(',')] + deps = resolve_targets(args.dependencies.split(',')) else: deps = _collect_clean_dependencies() @@ -14903,6 +14903,59 @@ def _resolve_ecj_jar(jdk, java_project_compliance, spec): 'from within the plugins/ directory of an Eclipse IDE installation.') return ecj + +_special_build_targets = {} + + +def register_special_build_target(name, target_enumerator, with_argument=False): + if name in _special_build_targets: + raise abort(f"Special build target {name} already registered") + _special_build_targets[name] = target_enumerator, with_argument + + +def _platform_dependent_layout_dir_distributions(): + for d in mx.distributions(True): + if isinstance(d, LayoutDirDistribution) and d.platformDependent: + yield d + + +def _maven_tag_distributions(tag): + for d in mx.distributions(True): + if getattr(d, 'maven', False) and _match_tags(d, [tag]) : + yield d + + +register_special_build_target('PLATFORM_DEPENDENT_LAYOUT_DIR_DISTRIBUTIONS', _platform_dependent_layout_dir_distributions) +register_special_build_target('MAVEN_TAG_DISTRIBUTIONS', _maven_tag_distributions, with_argument=True) + +def resolve_targets(names): + targets = [] + for name in names: + expanded_name = mx_subst.string_substitutions.substitute(name) + if expanded_name[0] == '{' and expanded_name[-1] == '}': + special_target = expanded_name[1:-1] + idx = special_target.find(':') + if idx >= 0: + arg = special_target[idx + 1:] + special_target = special_target[:idx] + else: + arg = None + if special_target not in _special_build_targets: + raise abort(f"Unknown special build target: {special_target}") + target_enumerator, with_arg = _special_build_targets[special_target] + if with_arg and arg is None: + raise abort(f"Special build target {special_target} requires an argument: {{{special_target}:argument}}") + if not with_arg and arg is not None: + raise abort(f"Special build target {special_target} doesn't accept an argument") + if arg is not None: + targets.extend(target_enumerator(arg)) + else: + targets.extend(target_enumerator()) + else: + targets.append(dependency(expanded_name)) + return targets + + def build(cmd_args, parser=None): """builds the artifacts of one or more dependencies""" global _gmake_cmd @@ -14987,12 +15040,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(mx_subst.string_substitutions.substitute(name)) for name in onlyDeps] + roots = resolve_targets(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(mx_subst.string_substitutions.substitute(name)) for name in names] + roots = resolve_targets(names) else: # This is the normal case for build (e.g. `mx build`) so be # clear about JDKs being used ... From 24847874398c65bc542ef14b450b5f6a8d191f2f Mon Sep 17 00:00:00 2001 From: Gilles Duboscq Date: Fri, 25 Aug 2023 22:57:51 +0200 Subject: [PATCH 5/8] Bump version --- mx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mx.py b/mx.py index 2543bfd4..f97a9f6d 100755 --- a/mx.py +++ b/mx.py @@ -18784,7 +18784,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.44.3") # GR-48250, Fix: disable -Werror for javac if lint overrides for given project are "none" +version = VersionSpec("6.45.0") # multi-arch layout dirs _mx_start_datetime = datetime.utcnow() _last_timestamp = _mx_start_datetime From 5fc7159bf0adadfb09dcfd3fc2f817c4cd5ef6bb Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Tue, 29 Aug 2023 13:53:27 +0200 Subject: [PATCH 6/8] Support `mx archive-pd-layouts archive.tgz`. --- mx_multiplatform.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mx_multiplatform.py b/mx_multiplatform.py index d7ba9fc5..edfa131f 100644 --- a/mx_multiplatform.py +++ b/mx_multiplatform.py @@ -42,13 +42,14 @@ def mx_archive_pd_layouts(args): See mx restore-pd-layouts and --multi-platform-layout-directories.""") parser.add_argument('path', help='path to archive') args = parser.parse_args(args) + archive_path = os.path.realpath(args.path) - ext = mx.get_file_extension(args.path) + ext = mx.get_file_extension(archive_path) if ext not in ('zip', 'jar', 'tar', 'tgz'): raise mx.abort("Unsupported archive extension. Supported: .zip, .jar, .tar, .tgz") pd_layout_dirs = [d for d in mx.distributions(True) if isinstance(d, mx.LayoutDirDistribution) and d.platformDependent] - with mx.Archiver(args.path, kind=ext) as arc: + with mx.Archiver(archive_path, kind=ext) as arc: local_os_arch = _local_os_arch() arc.add_str(local_os_arch, "os-arch", None) for dist in pd_layout_dirs: From 151ee1795170ab0aa91e3f7e45d87063ca0ebd4f Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Tue, 29 Aug 2023 13:54:12 +0200 Subject: [PATCH 7/8] Fix typo. --- mx_multiplatform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mx_multiplatform.py b/mx_multiplatform.py index edfa131f..ba0ddc01 100644 --- a/mx_multiplatform.py +++ b/mx_multiplatform.py @@ -84,7 +84,7 @@ def mx_restore_pd_layouts(args): dist = mx.distribution(entry.name, fatalIfMissing=not args.ignore_unknown_distributions) if not dist: continue - if not isinstance(dist, mx.LayoutDirDistribution) or not d.platformDependent: + if not isinstance(dist, mx.LayoutDirDistribution) or not dist.platformDependent: raise mx.abort(f"{entry.name} is not a platform-dependent layout dir distribution") local_output = dist.get_output() assert local_os_arch in local_output From 9cc1da7e200e49b48be0fb0b1891afe5b16643c0 Mon Sep 17 00:00:00 2001 From: Gilles Duboscq Date: Tue, 29 Aug 2023 19:50:14 +0200 Subject: [PATCH 8/8] Style fix --- mx.py | 11 +++++------ mx_jardistribution.py | 3 +-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/mx.py b/mx.py index f97a9f6d..dc58272a 100755 --- a/mx.py +++ b/mx.py @@ -33,8 +33,6 @@ import uuid from abc import ABCMeta, abstractmethod, abstractproperty -import mx - if __name__ == '__main__': # Rename this module as 'mx' so it is not re-executed when imported by other modules. sys.modules['mx'] = sys.modules.pop('__main__') @@ -6765,7 +6763,7 @@ def getArchivableResults(self, use_relpath=True, single=False): hashes = {} def _hash(path): if path not in hashes: - hashes[path] = mx.digest_of_file(path, 'sha1') + hashes[path] = digest_of_file(path, 'sha1') return hashes[path] for platform in self.platforms: if requested_platforms is not None and platform not in requested_platforms: @@ -14914,20 +14912,21 @@ def register_special_build_target(name, target_enumerator, with_argument=False): def _platform_dependent_layout_dir_distributions(): - for d in mx.distributions(True): + for d in distributions(True): if isinstance(d, LayoutDirDistribution) and d.platformDependent: yield d def _maven_tag_distributions(tag): - for d in mx.distributions(True): - if getattr(d, 'maven', False) and _match_tags(d, [tag]) : + for d in distributions(True): + if getattr(d, 'maven', False) and _match_tags(d, [tag]): yield d register_special_build_target('PLATFORM_DEPENDENT_LAYOUT_DIR_DISTRIBUTIONS', _platform_dependent_layout_dir_distributions) register_special_build_target('MAVEN_TAG_DISTRIBUTIONS', _maven_tag_distributions, with_argument=True) + def resolve_targets(names): targets = [] for name in names: diff --git a/mx_jardistribution.py b/mx_jardistribution.py index 26da4018..7578761a 100644 --- a/mx_jardistribution.py +++ b/mx_jardistribution.py @@ -32,7 +32,7 @@ import re import pickle -from os.path import join, exists, basename, dirname, isdir, islink, realpath +from os.path import join, exists, basename, dirname, isdir, islink from argparse import ArgumentTypeError from stat import S_IMODE @@ -1069,7 +1069,6 @@ def add_classes(archivePrefix, includeServices): self.add_file(dep, f, relpath, archivePrefix) elif dep.isLayoutDirDistribution(): mx.logv('[' + original_path + ': adding contents of layout dir distribution ' + dep.name + ']') - output = realpath(dep.get_output()) for file_path, arc_name in dep.getArchivableResults(): self.add_file(dep, file_path, arc_name, '') elif dep.isClasspathDependency():