Skip to content

Commit 4b1e416

Browse files
committed
[GR-52853] Enhance mx slnative to enable overriding the default target folder.
PullRequest: graal/17315
2 parents 6591802 + ca78ecd commit 4b1e416

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

truffle/mx.truffle/mx_truffle.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,11 @@ def _sl_command(jdk, vm_args, sl_args, use_optimized_runtime=True, use_enterpris
351351

352352
def slnative(args):
353353
"""build a native image of an SL program"""
354+
parser = ArgumentParser(prog='mx slnative', description='Builds and executes native SL image.', usage='mx slnative [--target-folder <folder>|SL args|@VM options]')
355+
parser.add_argument('--target-folder', help='Folder where the SL executable will be generated.', default=None)
356+
parsed_args, args = parser.parse_known_args(args)
354357
vm_args, sl_args = mx.extract_VM_args(args)
355-
target_dir = tempfile.mkdtemp()
358+
target_dir = parsed_args.target_folder if parsed_args.target_folder else tempfile.mkdtemp()
356359
jdk = mx.get_jdk(tag='graalvm')
357360
image = _native_image_sl(jdk, vm_args, target_dir, use_optimized_runtime=True, force_cp=False, hosted_assertions=False)
358361
mx.log("Image build completed. Running {}".format(" ".join([image] + sl_args)))
@@ -807,7 +810,7 @@ def _truffle_gate_state_bitwidth_tests():
807810
mx.update_commands(_suite, {
808811
'javadoc' : [javadoc, '[SL args|@VM options]'],
809812
'sl' : [sl, '[SL args|@VM options]'],
810-
'slnative' : [slnative, '[SL args|@VM options]'],
813+
'slnative': [slnative, '[--target-folder <folder>|SL args|@VM options]'],
811814
})
812815

813816
def _is_graalvm(jdk):

0 commit comments

Comments
 (0)