|
31 | 31 | import shutil
|
32 | 32 | import sys
|
33 | 33 | import tempfile
|
| 34 | +import time |
34 | 35 | from argparse import ArgumentParser
|
35 | 36 |
|
36 | 37 | import mx
|
@@ -147,7 +148,9 @@ def do_run_python(args, extra_vm_args=None, env=None, jdk=None, **kwargs):
|
147 | 148 | def punittest(args):
|
148 | 149 | if '--regex' not in args:
|
149 | 150 | args += ['--regex', r'(graal\.python)|(com\.oracle\.truffle\.tck\.tests)']
|
150 |
| - args += ["-Dgraal.TraceTruffleCompilation=true", "-Dgraal.TruffleCompilationExceptionsAreFatal=false", "-Dgraal.TrufflePerformanceWarningsAreFatal=false"] |
| 151 | + args += ["-Dgraal.TruffleCompilationExceptionsAreFatal=false", |
| 152 | + "-Dgraal.TruffleCompilationExceptionsArePrinted=true", |
| 153 | + "-Dgraal.TrufflePerformanceWarningsAreFatal=false"] |
151 | 154 | mx_unittest.unittest(args)
|
152 | 155 |
|
153 | 156 |
|
@@ -1019,12 +1022,52 @@ def python_coverage(args):
|
1019 | 1022 | mx.command_function("jacocoreport")(["--omit-excluded", "--format=html"])
|
1020 | 1023 |
|
1021 | 1024 |
|
| 1025 | +def python_build_watch(args): |
| 1026 | + """ |
| 1027 | + Watch the suite and on any changes to .class, .jar, .h, or .c files rebuild. |
| 1028 | + By default, rebuilds only the archives and non-Java projects. |
| 1029 | + """ |
| 1030 | + parser = ArgumentParser(prog='mx python-build-watch') |
| 1031 | + parser.add_argument('--full', action='store_true', help='Run a full mx build', required=False) |
| 1032 | + parser.add_argument('--graalvm', action='store_true', help='Build a graalvm', required=False) |
| 1033 | + parser.add_argument('--no-java', action='store_true', help='Build only archives and native projects [default]', required=False) |
| 1034 | + args = parser.parse_args(args) |
| 1035 | + if sum([args.full, args.graalvm, args.no_java]) > 1: |
| 1036 | + mx.abort("Only one of --full, --graalvm, --no-java can be specified") |
| 1037 | + while True: |
| 1038 | + out = mx.OutputCapture() |
| 1039 | + mx.run([ |
| 1040 | + "inotifywait", "-q", "-e", "close_write,moved_to", "-r", "--format=%f", |
| 1041 | + "--exclude", ".*\\.py$", |
| 1042 | + "@%s" % os.path.join(SUITE.dir, ".git"), |
| 1043 | + SUITE.dir |
| 1044 | + ], out=out) |
| 1045 | + changed_file = out.data.strip() |
| 1046 | + mx.logv(changed_file) |
| 1047 | + suffixes = [".c", ".h", ".class", ".jar"] |
| 1048 | + if args.full: |
| 1049 | + suffixes.append(".java") |
| 1050 | + elif args.graalvm: |
| 1051 | + suffixes.extend([".java", ".py"]) |
| 1052 | + if any(changed_file.endswith(ext) for ext in [".c", ".h", ".class", ".jar"]): |
| 1053 | + mx.log("Build needed ...") |
| 1054 | + time.sleep(2) |
| 1055 | + if args.full: |
| 1056 | + mx.command_function("build")() |
| 1057 | + elif args.graalvm: |
| 1058 | + mx.log(python_gvm()) |
| 1059 | + else: |
| 1060 | + nativebuild([]) |
| 1061 | + break |
| 1062 | + |
| 1063 | + |
1022 | 1064 | # ----------------------------------------------------------------------------------------------------------------------
|
1023 | 1065 | #
|
1024 | 1066 | # register the suite commands (if any)
|
1025 | 1067 | #
|
1026 | 1068 | # ----------------------------------------------------------------------------------------------------------------------
|
1027 | 1069 | mx.update_commands(SUITE, {
|
| 1070 | + 'python-build-watch': [python_build_watch, ''], |
1028 | 1071 | 'python': [python, '[Python args|@VM options]'],
|
1029 | 1072 | 'python3': [python, '[Python args|@VM options]'],
|
1030 | 1073 | 'deploy-binary-if-master': [deploy_binary_if_master, ''],
|
|
0 commit comments