@@ -1858,7 +1858,7 @@ def verify_native_bin!
1858
1858
raise "Could not find native image -- either build with 'jt build native' or set AOT_BIN to an image location"
1859
1859
end
1860
1860
end
1861
-
1861
+
1862
1862
def docker ( *args )
1863
1863
command = args . shift
1864
1864
case command
@@ -1874,7 +1874,7 @@ def docker(*args)
1874
1874
abort "Unkown jt docker command #{ command } "
1875
1875
end
1876
1876
end
1877
-
1877
+
1878
1878
def docker_build ( *args )
1879
1879
if args . first . nil? || args . first . start_with? ( '--' )
1880
1880
image_name = 'truffleruby-test'
@@ -1885,25 +1885,25 @@ def docker_build(*args)
1885
1885
File . write ( File . join ( docker_dir , 'Dockerfile' ) , dockerfile ( *args ) )
1886
1886
sh 'docker' , 'build' , '-t' , image_name , '.' , chdir : docker_dir
1887
1887
end
1888
-
1888
+
1889
1889
def docker_test ( *args )
1890
1890
distros = [ '--ol7' , '--ubuntu1604' , '--fedora25' ]
1891
1891
managers = [ '--no-manager' , '--rbenv' , '--chruby' , '--rvm' ]
1892
-
1892
+
1893
1893
distros . each do |distro |
1894
1894
managers . each do |manager |
1895
1895
docker 'build' , distro , manager , *args
1896
1896
end
1897
1897
end
1898
1898
end
1899
-
1899
+
1900
1900
def docker_print ( *args )
1901
1901
puts dockerfile ( *args )
1902
1902
end
1903
-
1903
+
1904
1904
def dockerfile ( *args )
1905
1905
config = @config ||= YAML . load_file ( File . join ( TRUFFLERUBY_DIR , 'tool' , 'docker-configs.yaml' ) )
1906
-
1906
+
1907
1907
truffleruby_repo = 'https://github.com/oracle/truffleruby.git'
1908
1908
distro = 'ubuntu1604'
1909
1909
install_method = :public
@@ -1913,7 +1913,7 @@ def dockerfile(*args)
1913
1913
manager = :none
1914
1914
basic_test = false
1915
1915
full_test = false
1916
-
1916
+
1917
1917
until args . empty?
1918
1918
arg = args . shift
1919
1919
case arg
@@ -1951,47 +1951,47 @@ def dockerfile(*args)
1951
1951
abort "unknown option #{ arg } "
1952
1952
end
1953
1953
end
1954
-
1954
+
1955
1955
distro = config . fetch ( distro )
1956
1956
run_post_install_hook = rebuild_openssl && distro . fetch ( 'post-install' )
1957
1957
1958
1958
lines = [ ]
1959
-
1959
+
1960
1960
lines . push "FROM #{ distro . fetch ( 'base' ) } "
1961
-
1961
+
1962
1962
lines . push *distro . fetch ( 'setup' )
1963
-
1963
+
1964
1964
lines . push *distro . fetch ( 'locale' )
1965
-
1965
+
1966
1966
lines . push *distro . fetch ( 'curl' ) if install_method == :public
1967
1967
lines . push *distro . fetch ( 'git' ) if install_method == :source || manager != :none || full_test
1968
1968
lines . push *distro . fetch ( 'which' ) if manager == :rvm || full_test
1969
1969
lines . push *distro . fetch ( 'find' ) if full_test
1970
1970
lines . push *distro . fetch ( 'rvm' ) if manager == :rvm
1971
1971
lines . push *distro . fetch ( 'source' ) if install_method == :source
1972
1972
lines . push *distro . fetch ( 'images' ) if rebuild_images
1973
-
1973
+
1974
1974
lines . push *distro . fetch ( 'openssl' )
1975
1975
lines . push *distro . fetch ( 'cext' )
1976
1976
lines . push *distro . fetch ( 'cppext' )
1977
-
1977
+
1978
1978
lines . push "WORKDIR /test"
1979
1979
lines . push "RUN useradd -ms /bin/bash test"
1980
1980
lines . push "RUN chown test /test"
1981
1981
lines . push "USER test"
1982
-
1982
+
1983
1983
docker_dir = File . join ( TRUFFLERUBY_DIR , 'tool' , 'docker' )
1984
-
1984
+
1985
1985
case install_method
1986
1986
when :graalvm
1987
1987
tarball = graalvm_tarball
1988
1988
when :standalone
1989
1989
tarball = standalone_tarball
1990
1990
end
1991
-
1991
+
1992
1992
if defined? ( tarball )
1993
1993
graalvm_version = /([ce]e-)?\d +(\. \d +)*(-rc\d +)?(\- dev)?(-\h +)?/ . match ( tarball ) . to_s
1994
-
1994
+
1995
1995
# Test build tarballs may have a -bn suffix, which isn't really part of the version string but matches the hex part in some cases
1996
1996
graalvm_version = graalvm_version . gsub ( /-b\d +\Z / , '' )
1997
1997
end
@@ -2050,19 +2050,19 @@ def dockerfile(*args)
2050
2050
lines . push "ENV D_RUBY_BASE=/test/truffleruby"
2051
2051
lines . push "ENV D_RUBY_BIN=$D_RUBY_BASE/bin"
2052
2052
end
2053
-
2053
+
2054
2054
if rebuild_images
2055
2055
if [ :public , :graalvm ] . include? ( install_method )
2056
2056
lines . push "RUN $D_GRAALVM_BASE/bin/gu rebuild-images ruby"
2057
2057
else
2058
2058
abort "can't rebuild images for a build not from public or from local GraalVM components"
2059
2059
end
2060
2060
end
2061
-
2061
+
2062
2062
case manager
2063
2063
when :none
2064
2064
lines . push "ENV PATH=$D_RUBY_BASE/bin:$PATH"
2065
-
2065
+
2066
2066
setup_env = lambda do |command |
2067
2067
command
2068
2068
end
@@ -2074,9 +2074,9 @@ def dockerfile(*args)
2074
2074
2075
2075
lines . push "RUN ln -s $D_RUBY_BASE /home/test/.rbenv/versions/truffleruby"
2076
2076
lines . push "RUN rbenv versions"
2077
-
2077
+
2078
2078
prefix = 'eval "$(rbenv init -)" && rbenv shell truffleruby'
2079
-
2079
+
2080
2080
setup_env = lambda do |command |
2081
2081
"eval \" $(rbenv init -)\" && rbenv shell truffleruby && #{ command } "
2082
2082
end
@@ -2104,25 +2104,25 @@ def dockerfile(*args)
2104
2104
"bash -c 'source $RVM_SCRIPT && rvm use ext-truffleruby && #{ command . gsub ( "'" , "'\\ \\ ''" ) } '"
2105
2105
end
2106
2106
end
2107
-
2107
+
2108
2108
configs = [ '' ]
2109
2109
configs += [ '--jvm' ] if [ :public , :graalvm ] . include? ( install_method )
2110
2110
configs += [ '--native' ] if [ :public , :graalvm , :standalone ] . include? ( install_method )
2111
-
2111
+
2112
2112
configs . each do |config |
2113
2113
lines . push "RUN " + setup_env [ "ruby #{ config } --version" ]
2114
2114
end
2115
-
2115
+
2116
2116
if basic_test || full_test
2117
2117
configs . each do |config |
2118
2118
lines . push "RUN cp -r $D_RUBY_BASE/lib/ruby/gems /test/clean-gems"
2119
-
2119
+
2120
2120
if config == '' && install_method != :source
2121
2121
gem = "gem"
2122
2122
else
2123
2123
gem = "ruby #{ config } -Sgem"
2124
2124
end
2125
-
2125
+
2126
2126
lines . push "RUN " + setup_env [ "#{ gem } install color" ]
2127
2127
lines . push "RUN " + setup_env [ "ruby #{ config } -rcolor -e 'raise unless defined?(Color)'" ]
2128
2128
@@ -2131,46 +2131,46 @@ def dockerfile(*args)
2131
2131
2132
2132
lines . push "RUN " + setup_env [ "#{ gem } install unf" ]
2133
2133
lines . push "RUN " + setup_env [ "ruby #{ config } -runf -e 'raise unless defined?(UNF)'" ]
2134
-
2134
+
2135
2135
lines . push "RUN rm -rf $D_RUBY_BASE/lib/ruby/gems"
2136
2136
lines . push "RUN mv /test/clean-gems $D_RUBY_BASE/lib/ruby/gems"
2137
2137
end
2138
2138
end
2139
-
2139
+
2140
2140
if full_test
2141
2141
lines . push "RUN git clone --depth 1 --branch #{ test_branch } #{ truffleruby_repo } truffleruby-tests"
2142
2142
lines . push "RUN cp -r truffleruby-tests/spec ."
2143
2143
lines . push "RUN cp -r truffleruby-tests/test/truffle/compiler/pe ."
2144
2144
lines . push "RUN rm -rf truffleruby-tests"
2145
-
2145
+
2146
2146
configs . each do |config |
2147
2147
excludes = [ 'fails' , 'slow' , 'ci' ]
2148
2148
excludes += [ 'graalvm' ] if [ :public , :graalvm ] . include? ( install_method )
2149
2149
excludes += [ 'aot' ] if [ '' , '--native' ] . include? ( config )
2150
-
2150
+
2151
2151
[ ':command_line' , ':security' , ':language' , ':core' , ':library' , ':capi' , ':library_cext' , ':truffle' ] . each do |set |
2152
2152
t_config = config . empty? ? '' : '-T' + config
2153
2153
t_excludes = excludes . map { |e | '--excl-tag ' + e } . join ( ' ' )
2154
2154
lines . push "RUN " + setup_env [ "ruby spec/mspec/bin/mspec --config spec/truffle.mspec -t $D_RUBY_BIN/ruby #{ t_config } #{ t_excludes } #{ set } " ]
2155
2155
end
2156
2156
end
2157
-
2157
+
2158
2158
configs . each do |config |
2159
2159
if config == '--jvm'
2160
2160
d = '-J-'
2161
2161
else
2162
2162
d = '--native.'
2163
2163
end
2164
-
2164
+
2165
2165
lines . push "RUN " + setup_env [ "ruby #{ config } #{ d } Dgraal.TruffleCompilationExceptionsAreThrown=true #{ d } Dgraal.TruffleIterativePartialEscape=true -Xbasic_ops.inline=false pe/pe.rb" ]
2166
2166
end
2167
2167
end
2168
-
2168
+
2169
2169
lines . push "CMD " + setup_env [ "bash" ]
2170
-
2170
+
2171
2171
lines . join ( "\n " ) + "\n "
2172
2172
end
2173
-
2173
+
2174
2174
def docker_extract_standalone ( *args )
2175
2175
graalvm_component = args . shift
2176
2176
version = args . shift
0 commit comments