@@ -788,6 +788,8 @@ def help
788
788
by default it is the name of the mx env file,
789
789
the named build stays until it is rebuilt or deleted manually
790
790
--new-hash update the git commit hash in RUBY_DESCRIPTION
791
+ --install PATH move the build to the specified directory
792
+ by default, builds will remain localized to the source tree
791
793
mx options: options passed directly to mx
792
794
-d start the Java debugger and enables assertions when running truffleruby to configure C extensions
793
795
mx build options options passed to the 'build' command of mx
@@ -2518,6 +2520,12 @@ def bootstrap_toolchain
2518
2520
env
2519
2521
end
2520
2522
2523
+ install_path = if ( i = options . index ( '--install' ) || options . index ( '-i' ) )
2524
+ options . delete_at i
2525
+ options . delete_at i
2526
+ end
2527
+ raise 'Installation path already exists' if File . exist? ( install_path . to_s )
2528
+
2521
2529
name = "truffleruby-#{ @ruby_name } "
2522
2530
mx_base_args = [ '--env' , env ]
2523
2531
@@ -2557,26 +2565,30 @@ def bootstrap_toolchain
2557
2565
File . symlink ( build_dir , dest )
2558
2566
end
2559
2567
2560
- # Symlink builds into version manager
2561
- rbenv_root = ENV [ 'RBENV_ROOT' ]
2562
- rubies_dir = File . join ( rbenv_root , 'versions' ) if rbenv_root && File . directory? ( rbenv_root )
2563
-
2564
- chruby_versions = File . expand_path ( '~/.rubies' )
2565
- rubies_dir = chruby_versions if File . directory? ( chruby_versions )
2568
+ if install_path
2569
+ File . rename build_dir , install_path
2570
+ else
2571
+ # Symlink builds into version manager
2572
+ rbenv_root = ENV [ 'RBENV_ROOT' ]
2573
+ rubies_dir = File . join ( rbenv_root , 'versions' ) if rbenv_root && File . directory? ( rbenv_root )
2574
+
2575
+ chruby_versions = File . expand_path ( '~/.rubies' )
2576
+ rubies_dir = chruby_versions if File . directory? ( chruby_versions )
2577
+
2578
+ if rubies_dir
2579
+ Dir . glob ( rubies_dir + '/truffleruby-*' ) . each do |link |
2580
+ next unless File . symlink? ( link )
2581
+ next if File . exist? ( link )
2582
+ target = File . readlink ( link )
2583
+ next unless target . start_with? ( "#{ TRUFFLERUBY_DIR } /mxbuild" )
2584
+ File . delete link
2585
+ puts "Deleted broken link: #{ link } -> #{ target } "
2586
+ end
2566
2587
2567
- if rubies_dir
2568
- Dir . glob ( rubies_dir + '/truffleruby-*' ) . each do |link |
2569
- next unless File . symlink? ( link )
2570
- next if File . exist? ( link )
2571
- target = File . readlink ( link )
2572
- next unless target . start_with? ( "#{ TRUFFLERUBY_DIR } /mxbuild" )
2573
- File . delete link
2574
- puts "Deleted broken link: #{ link } -> #{ target } "
2588
+ link_path = "#{ rubies_dir } /#{ name } "
2589
+ File . delete link_path if File . symlink? link_path or File . exist? link_path
2590
+ File . symlink dest_ruby , link_path
2575
2591
end
2576
-
2577
- link_path = "#{ rubies_dir } /#{ name } "
2578
- File . delete link_path if File . symlink? link_path or File . exist? link_path
2579
- File . symlink dest_ruby , link_path
2580
2592
end
2581
2593
end
2582
2594
0 commit comments