Skip to content

Commit

Permalink
Use $JAVA_HOME/bin/java for JUnit test
Browse files Browse the repository at this point in the history
'java' in $PATH was used. Hope it won't break CI env. We can expect
JAVA_HOME is set, right?

OT: I realized that our current Rake build system depends on
'default.build.properties' not 'build.properties'.
  • Loading branch information
Hiroshi Nakamura committed Jun 7, 2011
1 parent ae29f92 commit e59aff3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.xml
Expand Up @@ -7,6 +7,7 @@

<property name="jruby.gem.home.1.8" location="${basedir}/lib/ruby/gems/1.8"/>

<property environment="env"/>
<!-- First try to load machine-specific properties. -->
<property file="build.properties"/>

Expand Down Expand Up @@ -97,7 +98,6 @@
</condition>

<tstamp><format property="build.date" pattern="yyyy-MM-dd"/></tstamp>
<property environment="env"/>

<!-- Use JAVA_OPTS env var if set, -ea (supported by all JVMs) otherwise -->
<condition property="java.opts" value="${env.JAVA_OPTS}"><isset property="env.JAVA_OPTS"/></condition>
Expand Down
2 changes: 1 addition & 1 deletion default.build.properties
Expand Up @@ -58,7 +58,7 @@ javac.version=1.5
jruby.compile.memory=256M
jruby.launch.memory=512M
jruby.test.memory=512M
jruby.test.jvm=java
jruby.test.jvm=${env.JAVA_HOME}/bin/java
rake.args=
ruby.executable=/usr/bin/ruby
install4j.executable=/Applications/install4j 4/bin/install4jc
Expand Down
13 changes: 11 additions & 2 deletions rakelib/helpers.rake
Expand Up @@ -15,8 +15,17 @@ def load_build_properties_into_constants

# two-pass so substitutions can appear above where the var is defined
constant_names.each do |name|
Object.const_get(name).chop!.gsub!(/\$\{([^}]+)\}/) do |embed|
Object.const_get($1.gsub!(".", "_").upcase!)
Object.const_get(name).chop!.gsub!(/\$\{([^}]+)\}/) do
embed = $1
const = embed.gsub(".", "_").upcase
if Object.constants.include?(const)
Object.const_get(const)
elsif /^env\.(.*)$/ =~ embed # for ${env.JAVA_HOME}
ENV[$1]
else
warn("no definition for #{const} in default.build.properties")
const
end
end
puts "#{name} = #{Object.const_get(name)}" if Rake.application.options.trace
end
Expand Down

0 comments on commit e59aff3

Please sign in to comment.