Skip to content

Commit 9e41cc0

Browse files
committed
[GR-19220] Cache JVMCI and Eclipse in the mx cache (#2049).
PullRequest: truffleruby/1781
2 parents 5c80912 + 59b845c commit 9e41cc0

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tool/jt.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
GRAAL_DIR = File.expand_path('../graal', TRUFFLERUBY_DIR)
3030
PROFILES_DIR = "#{TRUFFLERUBY_DIR}/profiles"
3131

32+
CACHE_EXTRA_DIR = File.expand_path('~/.mx/cache/truffleruby')
33+
FileUtils.mkdir_p(CACHE_EXTRA_DIR)
34+
3235
TRUFFLERUBY_GEM_TEST_PACK_VERSION = 'fe5cfa6d14ce50b154fafbc8551cb656d4a39d3d'
3336

3437
JDEBUG = '--vm.agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=y'
@@ -1841,14 +1844,13 @@ def install(name, *options)
18411844
raise 'Installing JVMCI is only available on Linux and macOS currently' unless linux? || darwin?
18421845

18431846
update, jvmci_version = jvmci_update_and_version
1844-
dir = File.expand_path('..', TRUFFLERUBY_DIR)
18451847
java_home = begin
1846-
dir_pattern = "#{dir}/openjdk1.8.0*#{jvmci_version}"
1848+
dir_pattern = "#{CACHE_EXTRA_DIR}/openjdk1.8.0*#{jvmci_version}"
18471849
if Dir[dir_pattern].empty?
18481850
STDERR.puts download_message
18491851
jvmci_releases = 'https://github.com/graalvm/graal-jvmci-8/releases/download'
18501852
filename = "openjdk-8u#{update}-#{jvmci_version}-#{mx_os}-amd64.tar.gz"
1851-
chdir(dir) do
1853+
chdir(CACHE_EXTRA_DIR) do
18521854
raw_sh 'curl', '-L', "#{jvmci_releases}/#{jvmci_version}/#{filename}", '-o', filename
18531855
raw_sh 'tar', 'xf', filename
18541856
end
@@ -1884,11 +1886,10 @@ def install(name, *options)
18841886

18851887
eclipse_tar = eclipse_url.split('/').last
18861888
eclipse_name = File.basename(eclipse_tar, '.tar.gz')
1887-
eclipse_path = File.expand_path("../#{eclipse_name}/#{eclipse_exe}", TRUFFLERUBY_DIR)
1889+
eclipse_path = "#{CACHE_EXTRA_DIR}/#{eclipse_name}/#{eclipse_exe}"
18881890
return eclipse_path if File.exist?(eclipse_path)
18891891

1890-
dir = File.expand_path('..', TRUFFLERUBY_DIR)
1891-
chdir(dir) do
1892+
chdir(CACHE_EXTRA_DIR) do
18921893
unless File.exist?(eclipse_tar)
18931894
raw_sh 'curl', '-L', eclipse_url, '-o', eclipse_tar
18941895
end

0 commit comments

Comments
 (0)