diff --git a/src/mx/_impl/mx.py b/src/mx/_impl/mx.py index 55042df9..6068e259 100755 --- a/src/mx/_impl/mx.py +++ b/src/mx/_impl/mx.py @@ -7042,11 +7042,22 @@ def visit(dep, edge): parse_requiresConcealed_attribute(jdk, getattr(self, 'requiresConcealed', None), concealed, None, self) - # JVMCI is special as it not concealed in JDK 8 but is concealed in JDK 9+. + compat = self.suite.getMxCompatibility() if 'jdk.internal.vm.ci' in (jmd.name for jmd in jdk.get_modules()) and self.get_declaring_module_name() != 'jdk.internal.vm.ci': jvmci_packages = [p for p in self.imported_java_packages(projectDepsOnly=False) if p.startswith('jdk.vm.ci')] if jvmci_packages: - concealed.setdefault('jdk.internal.vm.ci', set()).update(jvmci_packages) + concealed_packages = concealed.setdefault('jdk.internal.vm.ci', set()) + missing = frozenset(jvmci_packages).difference(concealed_packages) + if missing: + if compat.automatically_export_jvmci_packages(): + concealed_packages.update(missing) + else: + nl = os.linesep + msg = f'As of mx {compat.version()}, JVMCI packages are not automatically exported to projects that import them. ' \ + f'Instead projects must use a "requiresConcealed" attribute:{nl}{nl}' + packages = '", "'.join(sorted(missing)) + msg += f' "requiresConcealed" : {{ "jdk.internal.vm.ci": ["{packages}"] }}' + self.abort(msg) concealed = {module : list(concealed[module]) for module in concealed} setattr(self, cache, concealed) @@ -18204,7 +18215,7 @@ def alarm_handler(signum, frame): _CACHE_DIR = get_env('MX_CACHE_DIR', join(dot_mx_dir(), 'cache')) # The version must be updated for every PR (checked in CI) and the comment should reflect the PR's issue -version = VersionSpec("7.32.4") # [GR-58295] Ignore commit info for foreign suites in mx benchmarks +version = VersionSpec("7.33.0") # [GR-58951] Do not automatically export JVMCI packages _mx_start_datetime = datetime.utcnow() diff --git a/src/mx/_impl/mx_compat.py b/src/mx/_impl/mx_compat.py index 20c8e71b..93c36e21 100644 --- a/src/mx/_impl/mx_compat.py +++ b/src/mx/_impl/mx_compat.py @@ -1,7 +1,7 @@ # # ---------------------------------------------------------------------------------------------------- # -# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, 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 @@ -307,6 +307,13 @@ def get_supported_hash_algorithms(self): """ return None + def automatically_export_jvmci_packages(self): + """ + JVMCI packages seen in import statements of a project's Java sources + will automatically result in an --add-exports option being added to the + javac command line for the project. + """ + return True class MxCompatibility520(MxCompatibility500): @staticmethod @@ -794,6 +801,15 @@ def proguard_libs(self): 'RETRACE': '7_5_0', } +class MxCompatibility733(MxCompatibility728): + + @staticmethod + def version(): + return mx.VersionSpec("7.33.0") + + def automatically_export_jvmci_packages(self): + return False + def minVersion(): _ensureCompatLoaded() return list(_versionsMap)[0]