Commit 047953e1 by Mislav Marohnić

Simplify Java 7 detection and error message

parent 88968339
......@@ -65,6 +65,12 @@ sanitize() {
printf "%s" "$1" | sed "s/[^A-Za-z0-9.-]/_/g; s/__*/_/g"
}
colorize() {
if [ -t 1 ]; then printf "\e[%sm%s\e[m" "$1" "$2"
else echo -n "$2"
fi
}
build_failed() {
{ echo
echo "BUILD FAILED"
......@@ -577,18 +583,10 @@ fix_rbx_irb() {
}
require_java7() {
local version=`java -version 2>&1`
if [ $? -eq 0 ]
then
if [[ $version == *1.[78]* ]]
then
return 0
else
echo "jruby-9000-dev requires Java 7 - please install a 1.7 compatible JRE, or ensure it is on your path"
return 1
fi
else
echo "Couldn't execute Java - please install a 1.7 compatible JRE, or ensure it is on your path"
local version="$(java -version 2>/dev/null | head -1)"
if [[ $version != *1.[789]* ]]; then
colorize 1 "ERROR" >&3
echo ": Java 7 required. Please install a 1.7-compatible JRE." >&3
return 1
fi
}
......
......@@ -421,6 +421,46 @@ nice gem things
OUT
}
@test "JRuby Java 7 missing" {
cached_tarball "jruby-9000.dev" bin/jruby
stub java false
run_inline_definition <<DEF
require_java7
install_package "jruby-9000.dev" "http://ci.jruby.org/jruby-dist-9000.dev-bin.tar.gz" jruby
DEF
assert_failure <<OUT
ERROR: Java 7 required. Please install a 1.7-compatible JRE.
OUT
}
@test "JRuby Java is outdated" {
cached_tarball "jruby-9000.dev" bin/jruby
stub java '-version : echo java version "1.6.0_21"'
run_inline_definition <<DEF
require_java7
install_package "jruby-9000.dev" "http://ci.jruby.org/jruby-dist-9000.dev-bin.tar.gz" jruby
DEF
assert_failure <<OUT
ERROR: Java 7 required. Please install a 1.7-compatible JRE.
OUT
}
@test "JRuby Java 7 up-to-date" {
cached_tarball "jruby-9000.dev" bin/jruby
stub java '-version : echo java version "1.7.0_21"'
run_inline_definition <<DEF
require_java7
install_package "jruby-9000.dev" "http://ci.jruby.org/jruby-dist-9000.dev-bin.tar.gz" jruby
DEF
assert_success
}
@test "non-writable TMPDIR aborts build" {
export TMPDIR="${TMP}/build"
mkdir -p "$TMPDIR"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment