From 6dec2c88d04e4eeb31beda785c6f4c2c76073e8f Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Tue, 11 Apr 2023 12:38:55 +0200 Subject: [PATCH 1/5] spotbugs: fix --strict-mode help message --- mx_spotbugs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mx_spotbugs.py b/mx_spotbugs.py index a042710c..ac587e0b 100644 --- a/mx_spotbugs.py +++ b/mx_spotbugs.py @@ -113,7 +113,7 @@ def spotbugs(args, fbArgs=None, suite=None, projects=None, jarFileName='spotbugs def _spotbugs(all_args, fbArgs, suite, projectsToTest, spotbugsVersion): """run FindBugs against non-test Java projects""" parser = ArgumentParser(prog='mx spotbugs') - parser.add_argument('--strict-mode', action='store_true', help='abort if a spotbugs cannot be executed due some reason (e.g., unsupported JDK version)') + parser.add_argument('--strict-mode', action='store_true', help='abort if SpotBugs cannot be executed for some reason (e.g., unsupported JDK version)') parsed_args, args = parser.parse_known_args(all_args) findBugsHome = mx.get_env('SPOTBUGS_HOME', mx.get_env('FINDBUGS_HOME', None)) From 75d623faa48d08de0be4790a4f9770afbf896e03 Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Mon, 28 Jun 2021 14:34:05 +0200 Subject: [PATCH 2/5] add mx foreach-repo --- mx.py | 1 + mx_foreach.py | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 mx_foreach.py diff --git a/mx.py b/mx.py index 45407584..fa17d640 100755 --- a/mx.py +++ b/mx.py @@ -18495,6 +18495,7 @@ def list_commands(l): import mx_bisect # pylint: disable=unused-import import mx_gc # pylint: disable=unused-import import mx_multiplatform # pylint: disable=unused-import +import mx_foreach # pylint: disable=unused-import from mx_unittest import unittest from mx_jackpot import jackpot diff --git a/mx_foreach.py b/mx_foreach.py new file mode 100644 index 00000000..3834f688 --- /dev/null +++ b/mx_foreach.py @@ -0,0 +1,73 @@ +# +# ---------------------------------------------------------------------------------------------------- +# +# Copyright (c) 2021, 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 argparse +import mx + + +@mx.command('mx', 'foreach-repo') +def foreach_repo(args): + """Run a command in the root of all repos of imported suites.""" + + parser = argparse.ArgumentParser(prog='mx foreach-repo', + description='''Run a command in the root of all repos of imported suites.''', + usage='%(prog)s [options] [--] command...') + parser.add_argument('-n', '--dry-run', action='store_true', help='show what would be removed without actually doing anything') + + try: + sep_idx = args.index('--') + parsed_args = parser.parse_args(args[:sep_idx]) + remaining_args = args[(sep_idx + 1):] + except ValueError: + parsed_args, remaining_args = parser.parse_known_args(args) + + p = mx.primary_suite() + suites = [p] + [mx.suite(i.name) for i in p.suite_imports] + vc_dirs = [] + # ensure that we preserve the order + for x in suites: + if x.vc_dir not in vc_dirs: + vc_dirs.append(x.vc_dir) + + def _log_cwd(msg): + mx.log(mx.colorize(msg, color='cyan')) + + def _log_exec(msg): + mx.log(mx.colorize(msg, color='green')) + + cmd = remaining_args + if len(cmd) == 0: + mx.abort(f'{parser.prog} requires a command...\n\n{parser.format_usage()}') + for vc_dir in vc_dirs: + _log_cwd('Entering directory `{}`'.format(vc_dir)) + try: + if parsed_args.dry_run: + _log_exec('Would run: {}'.format(' '.join(cmd))) + else: + _log_exec('Running: {}'.format(' '.join(cmd))) + mx.run(cmd, cwd=vc_dir) + finally: + _log_cwd('Leaving directory `{}`'.format(vc_dir)) From 374cc2022566eb03b7460dd16946b364361e3fc2 Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Mon, 11 Sep 2023 10:33:44 +0200 Subject: [PATCH 3/5] Bump version --- mx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mx.py b/mx.py index fa17d640..22039c22 100755 --- a/mx.py +++ b/mx.py @@ -18788,7 +18788,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.46.1") # GR-48450: Read the value of the right argument. +version = VersionSpec("6.47.0") # for each repo _mx_start_datetime = datetime.utcnow() _last_timestamp = _mx_start_datetime From 5ca8203921d7b39210d47517efb94573c6fcfa52 Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Mon, 11 Sep 2023 10:53:22 +0200 Subject: [PATCH 4/5] sync common.json --- common.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common.json b/common.json index 56e5ef00..e2af625d 100644 --- a/common.json +++ b/common.json @@ -4,7 +4,7 @@ "Jsonnet files should not include this file directly but use ci/common.jsonnet instead." ], - "mx_version": "6.45.0", + "mx_version": "6.46.1", "COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet", "jdks": { @@ -35,12 +35,12 @@ "labsjdk-ee-20-llvm": {"name": "labsjdk", "version": "ee-20.0.2+2-jvmci-23.1-b02-sulong", "platformspecific": true }, "oraclejdk21": {"name": "jpg-jdk", "version": "21", "build_id": "33", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]}, - "labsjdk-ce-21": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b14", "platformspecific": true }, - "labsjdk-ce-21Debug": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b14-debug", "platformspecific": true }, - "labsjdk-ce-21-llvm": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b14-sulong", "platformspecific": true }, - "labsjdk-ee-21": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b14", "platformspecific": true }, - "labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b14-debug", "platformspecific": true }, - "labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b14-sulong", "platformspecific": true }, + "labsjdk-ce-21": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b15", "platformspecific": true }, + "labsjdk-ce-21Debug": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b15-debug", "platformspecific": true }, + "labsjdk-ce-21-llvm": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b15-sulong", "platformspecific": true }, + "labsjdk-ee-21": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b15", "platformspecific": true }, + "labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b15-debug", "platformspecific": true }, + "labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b15-sulong", "platformspecific": true }, "oraclejdk22": {"name": "jpg-jdk", "version": "22", "build_id": "11", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]} }, From a8e895b0314e5b345f83b3bb841775bfae9f636e Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Mon, 11 Sep 2023 11:15:41 +0200 Subject: [PATCH 5/5] foreach-repo: add example to description --- mx_foreach.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/mx_foreach.py b/mx_foreach.py index 3834f688..6ed17c9e 100644 --- a/mx_foreach.py +++ b/mx_foreach.py @@ -25,15 +25,30 @@ # ---------------------------------------------------------------------------------------------------- # import argparse +import textwrap + import mx @mx.command('mx', 'foreach-repo') def foreach_repo(args): - """Run a command in the root of all repos of imported suites.""" parser = argparse.ArgumentParser(prog='mx foreach-repo', - description='''Run a command in the root of all repos of imported suites.''', + formatter_class=argparse.RawDescriptionHelpFormatter, + description=textwrap.dedent(''' + Run a command in the root of all repos of imported suites. + + Example: + $ mx foreach-repo pwd + Entering directory + Running: pwd + .../path/to/graalpython + Leaving directory + Entering directory + Running: pwd + .../path/to/graal + Leaving directory + '''.rstrip()), usage='%(prog)s [options] [--] command...') parser.add_argument('-n', '--dry-run', action='store_true', help='show what would be removed without actually doing anything')