@@ -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
@@ -2504,6 +2506,12 @@ def bootstrap_toolchain
2504
2506
env
2505
2507
end
2506
2508
2509
+ install_path = if ( i = options . index ( '--install' ) || options . index ( '-i' ) )
2510
+ options . delete_at i
2511
+ options . delete_at i
2512
+ end
2513
+ raise 'Installation path already exists' if File . exist? ( install_path . to_s )
2514
+
2507
2515
name = "truffleruby-#{ @ruby_name } "
2508
2516
mx_base_args = [ '--env' , env ]
2509
2517
@@ -2543,26 +2551,30 @@ def bootstrap_toolchain
2543
2551
File . symlink ( build_dir , dest )
2544
2552
end
2545
2553
2546
- # Symlink builds into version manager
2547
- rbenv_root = ENV [ 'RBENV_ROOT' ]
2548
- rubies_dir = File . join ( rbenv_root , 'versions' ) if rbenv_root && File . directory? ( rbenv_root )
2549
-
2550
- chruby_versions = File . expand_path ( '~/.rubies' )
2551
- rubies_dir = chruby_versions if File . directory? ( chruby_versions )
2554
+ if install_path
2555
+ File . rename build_dir , install_path
2556
+ else
2557
+ # Symlink builds into version manager
2558
+ rbenv_root = ENV [ 'RBENV_ROOT' ]
2559
+ rubies_dir = File . join ( rbenv_root , 'versions' ) if rbenv_root && File . directory? ( rbenv_root )
2560
+
2561
+ chruby_versions = File . expand_path ( '~/.rubies' )
2562
+ rubies_dir = chruby_versions if File . directory? ( chruby_versions )
2563
+
2564
+ if rubies_dir
2565
+ Dir . glob ( rubies_dir + '/truffleruby-*' ) . each do |link |
2566
+ next unless File . symlink? ( link )
2567
+ next if File . exist? ( link )
2568
+ target = File . readlink ( link )
2569
+ next unless target . start_with? ( "#{ TRUFFLERUBY_DIR } /mxbuild" )
2570
+ File . delete link
2571
+ puts "Deleted broken link: #{ link } -> #{ target } "
2572
+ end
2552
2573
2553
- if rubies_dir
2554
- Dir . glob ( rubies_dir + '/truffleruby-*' ) . each do |link |
2555
- next unless File . symlink? ( link )
2556
- next if File . exist? ( link )
2557
- target = File . readlink ( link )
2558
- next unless target . start_with? ( "#{ TRUFFLERUBY_DIR } /mxbuild" )
2559
- File . delete link
2560
- puts "Deleted broken link: #{ link } -> #{ target } "
2574
+ link_path = "#{ rubies_dir } /#{ name } "
2575
+ File . delete link_path if File . symlink? link_path or File . exist? link_path
2576
+ File . symlink dest_ruby , link_path
2561
2577
end
2562
-
2563
- link_path = "#{ rubies_dir } /#{ name } "
2564
- File . delete link_path if File . symlink? link_path or File . exist? link_path
2565
- File . symlink dest_ruby , link_path
2566
2578
end
2567
2579
end
2568
2580
0 commit comments