Permalink
Browse files

Too many changes to our build...Raking an ant file

  • Loading branch information...
1 parent a209be1 commit 01041980863d6fd5f2fb222eb22f1a3a24b97cbb @enebo enebo committed Feb 13, 2010
Showing with 256 additions and 152 deletions.
  1. +0 −25 Rakefile
  2. +14 −88 build.xml
  3. +8 −3 default.build.properties
  4. +20 −0 rakelib/bench.rake
  5. +7 −1 rakelib/git.rake
  6. +3 −3 rakelib/helpers.rake
  7. +104 −0 rakelib/jruby.rake
  8. +67 −0 rakelib/spec.rake
  9. +33 −32 rakelib/test.rake
View
@@ -36,28 +36,3 @@ task :gen do
system 'javac -cp lib/jruby.jar src_gen/*.java'
system 'jar -uf lib/jruby.jar -C src_gen .'
end
-
-namespace :test do
- task :fetch_latest_rails_repo do
- unless git_repo_exists? RAILS_DIR
- git_shallow_clone('rails', RAILS_GIT_REPO, RAILS_DIR)
- else
- git_pull('rails', RAILS_DIR)
- end
- end
-
- task :fetch_latest_prawn_repo do
- unless git_repo_exists? PRAWN_DIR
- git_shallow_clone('prawn', PRAWN_GIT_REPO, PRAWN_DIR) do
- sh "git checkout #{PRAWN_STABLE_VERSION}"
- sh "git submodule init"
- sh "git submodule update"
- end
- else
- git_pull('prawn', PRAWN_DIR) do
- sh "git checkout #{PRAWN_STABLE_VERSION}"
- sh "git submodule update"
- end
- end
- end
-end
View
@@ -1083,42 +1083,7 @@
description="Runs the very latest rubyspecs without exclusions."/>
<target name="fetch-specs">
- <condition property="rubyspec-repo-exists">
- <available file="${rubyspec.dir}/.git"/>
- </condition>
-
- <antcall target="do-fetch-specs"/>
- <antcall target="do-update-specs"/>
- </target>
-
- <target name="do-fetch-specs" unless="rubyspec-repo-exists">
- <!-- Stable specs might exist, so delete them -->
- <antcall target="clear-specs" inheritall="false"/>
-
- <echo message="Cloning rubyspec repo to: ${rubyspec.dir}"/>
- <exec dir="${spec.dir}" executable="git">
- <arg value="clone"/>
- <arg value="git://github.com/rubyspec/rubyspec.git"/>
- <arg value="${rubyspec.dir}"/>
- </exec>
-
- <echo message="Cloning mspec repo to: ${mspec.dir}"/>
- <exec dir="${spec.dir}" executable="git">
- <arg value="clone"/>
- <arg value="git://github.com/rubyspec/mspec.git"/>
- <arg value="${mspec.dir}"/>
- </exec>
- </target>
-
- <target name="do-update-specs" if="rubyspec-repo-exists">
- <echo message="Updating rubyspec repo -- ${rubyspec.dir}"/>
- <exec dir="${rubyspec.dir}" executable="git">
- <arg value="fetch"/>
- </exec>
- <echo message="Updating mspec repo -- ${mspec.dir}"/>
- <exec dir="${mspec.dir}" executable="git">
- <arg value="fetch"/>
- </exec>
+ <run-rake rake.targets="spec:fetch_latest_rubyspec_repo spec:fetch_latest_mspec_repo"/>
</target>
<target name="clear-specs">
@@ -1180,7 +1145,7 @@
<fail message="RubySpecs FAILED" unless="spec.status.combined.OK"/>
</target>
- <target name="run-specs-all" depends="jar"><antcall target="run-specs-all-precompiled"/></target>
+ <target name="run-specs-all" depends="jar, run-specs-all-precompiled"/>
<target name="run-specs-compiled" depends="jar">
<_run_specs_internal mode.name="COMPILED" compile.mode="JIT" jit.threshold="0" spec.config="${spec.dir}/jruby.1.8.mspec"/>
@@ -1212,8 +1177,12 @@
<_run_specs_internal mode.name="INTERPRETED" compile.mode="OFF" spec.config="${spec.dir}/jruby.1.9.mspec" compat="RUBY1_9"/>
</target>
- <target name="run-specs-all-interpreted"><_run_specs_all_internal compile.mode="OFF"/></target>
- <target name="run-specs-all-precompiled"><_run_specs_all_internal compile.mode="FORCE" jit.threshold="0"/></target>
+ <target name="run-specs-all-interpreted">
+ <_run_specs_all_internal mode.name="INTERPRETED" compile.mode="OFF"/>
+ </target>
+ <target name="run-specs-all-precompiled">
+ <_run_specs_all_internal mode.name="PRECOMPILED" compile.mode="FORCE" jit.threshold="0"/>
+ </target>
<target name="update-excludes">
@@ -1321,9 +1290,10 @@
<macrodef name="_run_specs_all_internal">
<attribute name="compile.mode" default="OFF"/>
<attribute name="jit.threshold" default="20"/>
+ <attribute name="mode.name"/>
<sequential>
- <run-specs compile.mode="@{compile.mode}" jit.threshold="@{jit.threshold}"/>
+ <run-specs mode.name="@{mode.name}" compile.mode="@{compile.mode}" jit.threshold="@{jit.threshold}"/>
</sequential>
</macrodef>
@@ -1650,59 +1620,15 @@
</target>
<target name="test-rails-stable" depends="jar,install-build-gems">
- <run-rake rake.targets="test:fetch_latest_rails_repo"/>
- <!-- Need to disable assertions because of a rogue one in OpenSSL -->
- <run-rake dir="${rails.dir}/activesupport" rake.targets="test" jvm.args="-da"/>
- <run-rake dir="${rails.dir}/actionmailer" rake.targets="test"/>
- <run-rake dir="${rails.dir}/activemodel" rake.targets="test"/>
- <run-rake dir="${rails.dir}/railties" rake.targets="test"/>
+ <run-rake rake.targets="test:rails"/>
</target>
+<!-- FIXME: MOVE INSTALL BUILD GEMS into rake -->
<target name="test-prawn" depends="jar,install-build-gems">
- <run-rake rake.targets="test:fetch_latest_prawn_repo"/>
- <run-rake dir="test/prawn" rake.targets="test examples"/>
+ <run-rake rake.targets="test:prawn"/>
</target>
<target name="bench-language" depends="init">
- <property name="jruby.home" value="${basedir}"/>
- <java fork="true" classname="org.jruby.Main" output="bench.language.client.interpreted.txt" errorproperty="bench.error" failonerror="false">
- <classpath refid="jruby.execute.classpath"/>
- <jvmarg line="-client ${run.jvm.model}"/>
- <sysproperty key="jruby.home" value="${jruby.home}"/>
- <arg line="-X-C bench/language/bench_all.rb 5"/>
- </java>
- <java fork="true" classname="org.jruby.Main" output="bench.language.client.jitted.txt" errorproperty="bench.error" failonerror="false">
- <classpath refid="jruby.execute.classpath"/>
- <jvmarg line="-client ${run.jvm.model}"/>
- <sysproperty key="jruby.home" value="${jruby.home}"/>
- <sysproperty key="jruby.jit.threshold" value="5"/>
- <arg line="bench/language/bench_all.rb 5"/>
- </java>
- <java fork="true" classname="org.jruby.Main" output="bench.language.client.precompiled.txt" errorproperty="bench.error" failonerror="false">
- <classpath refid="jruby.execute.classpath"/>
- <jvmarg line="-client ${run.jvm.model}"/>
- <sysproperty key="jruby.home" value="${jruby.home}"/>
- <arg line="-X+C bench/language/bench_all.rb 5"/>
- </java>
-
- <java fork="true" classname="org.jruby.Main" output="bench.language.server.interpreted.txt" errorproperty="bench.error" failonerror="false">
- <classpath refid="jruby.execute.classpath"/>
- <jvmarg line="-server ${run.jvm.model}"/>
- <sysproperty key="jruby.home" value="${jruby.home}"/>
- <arg line="-X-C bench/language/bench_all.rb 5"/>
- </java>
- <java fork="true" classname="org.jruby.Main" output="bench.language.server.jitted.txt" errorproperty="bench.error" failonerror="false">
- <classpath refid="jruby.execute.classpath"/>
- <jvmarg line="-server ${run.jvm.model}"/>
- <sysproperty key="jruby.home" value="${jruby.home}"/>
- <sysproperty key="jruby.jit.threshold" value="5"/>
- <arg line="bench/language/bench_all.rb 5"/>
- </java>
- <java fork="true" classname="org.jruby.Main" output="bench.language.server.precompiled.txt" errorproperty="bench.error" failonerror="false">
- <classpath refid="jruby.execute.classpath"/>
- <jvmarg line="-server ${run.jvm.model}"/>
- <sysproperty key="jruby.home" value="${jruby.home}"/>
- <arg line="-X+C bench/language/bench_all.rb 5"/>
- </java>
+ <run-rake rake.targets="bench:language"/>
</target>
</project>
@@ -3,22 +3,27 @@
src.dir=src
test.dir=test
lib.dir=lib
+build.dir=${base.dir}/build
dest.lib.dir=${lib.dir}
spec.dir=${base.dir}/spec
+rubyspec.git.repo=git://github.com/rubyspec/rubyspec.git
rubyspec.dir=${spec.dir}/ruby
-prawn.dir=${test.dir}/prawn
+rubyspec.tar.file=${build.dir}/rubyspec.tgz
prawn.git.repo=git://github.com/sandal/prawn.git
+prawn.dir=${test.dir}/prawn
prawn.stable.version=0.4.1
-rails.dir=${test.dir}/rails
rails.git.repo=git://github.com/rails/rails.git
+rails.dir=${test.dir}/rails
+mspec.git.repo=git://github.com/rubyspec/mspec.git
mspec.dir=${spec.dir}/mspec
+mspec.bin=${mspec.dir}/bin/mspec
+mspec.tar.file=${build.dir}/mspec.tgz
rubyspec.1.8.dir=${rubyspec.dir}/1.8
spec.tags.dir=${spec.dir}/tags
build.lib.dir=build_lib
dist.dir=dist
dist.stage.bin.dir=${dist.dir}/jruby-bin-${version.jruby}
dist.stage.src.dir=${dist.dir}/jruby-src-${version.jruby}
-build.dir=${base.dir}/build
classes.dir=${build.dir}/classes
jruby.classes.dir=${classes.dir}/jruby
jruby.openssl.classes.dir=${classes.dir}/openssl
View
@@ -0,0 +1,20 @@
+namespace :bench do
+ desc "Run all benchmarks in bench/language several times (runs a long time)"
+ task :language do
+ ['client', 'server'].each do |jvm_type|
+ jruby(:output => "bench.language.#{jvm_type}.interpreted.txt") do
+ jvmarg :line => "-#{jvm_type}"
+ arg :line => "-X-C bench/language/bench_all.rb 5"
+ end
+ jruby(:output => "bench.language.#{jvm_type}.jitted.txt") do
+ sysproperty :key => "jruby.jit.threshold", :value => "5"
+ jvmarg :line => "-#{jvm_type}"
+ arg :line => "bench/language/bench_all.rb 5"
+ end
+ jruby(:output => "bench.language.#{jvm_type}.precompiled.txt") do
+ jvmarg :line => "-#{jvm_type}"
+ arg :line => "-X+C bench/language/bench_all.rb 5"
+ end
+ end
+ end
+end
View
@@ -10,7 +10,13 @@ def git_shallow_clone(label, git_repository, local_directory)
end
def git_pull(label, local_directory)
- puts "#{label} repo found: updating repo at #{local_directory}"
+ puts "#{label} repo found: pulling repo at #{local_directory}"
sh "git pull"
Dir.chdir(local_directory) { yield } if block_given?
end
+
+def git_fetch(label, local_directory)
+ puts "#{label} repo found: fetching repo at #{local_directory}"
+ sh "git fetch"
+ Dir.chdir(local_directory) { yield } if block_given?
+end
@@ -23,9 +23,9 @@ def load_build_properties_into_constants
end
load_build_properties_into_constants
-def ant(*args)
- raise 'running ant failed!' unless system "ant -logger org.apache.tools.ant.NoBannerLogger #{args.join(' ')}"
-end
+# def ant(*args)
+# raise 'running ant failed!' unless system "ant -logger org.apache.tools.ant.NoBannerLogger #{args.join(' ')}"
+# end
require 'digest'
class HashTask < Struct.new(:hash, :file)
View
@@ -0,0 +1,104 @@
+require 'ant'
+
+# Determine if we need to put a 32 or 64 bit flag to the command-line
+# based on what java reports as the hardward architecture.
+def jvm_model
+ # My windows machine does not do this? Can this happen?
+ return nil if ENV_JAVA['os.family'] == "windows"
+
+ case ENV_JAVA['os.arch']
+ when 'amd64', 'x86_64', 'sparcv9', 's390x' then
+ '-d64'
+ when 'i386', 'x86', 'powerpc', 'ppc', 'sparc' then
+ '-d32'
+ else
+ nil
+ end
+end
+JVM_MODEL = jvm_model
+
+ant.path(:id => "build.classpath") do
+ fileset :dir => BUILD_LIB_DIR, :includes => "*.jar"
+end
+
+ant.path(:id => "jruby.execute.classpath") do
+ path :refid => "build.classpath"
+ pathelement :path => JRUBY_CLASSES_DIR
+end
+
+ant.path(:id => "test.class.path") do
+ pathelement :path => File.join(BUILD_LIB_DIR, 'junit.jar')
+ pathelement :path => File.join(BUILD_LIB_DIR, 'livetribe-jsr223-2.0.6.jar')
+ pathelement :path => File.join(BUILD_LIB_DIR, 'bsf.jar')
+ pathelement :path => File.join(BUILD_LIB_DIR, 'commons-logging-1.1.1.jar')
+# pathelement :path => "${java.class.path}"/>
+ pathelement :path => File.join(LIB_DIR, 'jruby.jar')
+ pathelement :location => TEST_CLASSES_DIR
+ pathelement :path => File.join(TEST_DIR, 'requireTest.jar')
+ pathelement :location => TEST_DIR
+end
+
+def jruby(java_options = {}, &code)
+ java_options[:fork] ||= 'true'
+ java_options[:failonerror] ||= 'true'
+ java_options[:classname] = 'org.jruby.Main'
+ ant.java(java_options) do
+ classpath :refid => 'build.classpath'
+ classpath :path => JRUBY_CLASSES_DIR
+ jvmarg :line => JVM_MODEL if JVM_MODEL
+ sysproperty :key => "jruby.home", :value => BASE_DIR
+ instance_eval(&code) if block_given?
+ end
+end
+
+def jrake(dir, targets, java_options = {}, &code)
+ java_options[:maxmemory] ||= JRUBY_LAUNCH_MEMORY
+ java_options[:dir] = dir
+ jruby(java_options) do
+ classpath :refid => "test.class.path"
+ instance_eval(&code) if block_given?
+ arg :line => "-S rake #{targets}"
+ end
+end
+
+def mspec(mspec_options = {}, java_options = {}, &code)
+ java_options[:maxmemory] ||= JRUBY_LAUNCH_MEMORY
+ java_options[:dir] = BASE_DIR
+ java_options[:failonerror] ||= 'false'
+
+ mspec_options[:compile_mode] ||= 'OFF'
+ mspec_options[:jit_threshold] ||= 20
+ mspec_options[:jit_max] ||= -1
+ mspec_options[:objectspace_enabled] ||= true
+ mspec_options[:thread_pooling] ||= false
+ mspec_options[:reflection] ||= false
+ mspec_options[:compat] ||= "RUBY1_8"
+ ms = mspec_options
+
+ puts "MSPEC: #{ms.inspect}"
+
+ jruby(java_options) do
+ classpath :refid => "test.class.path"
+ jvmarg :line => "-ea"
+ sysproperty :key => "jruby.launch.inproc", :value => "false"
+ sysproperty :key => "emma.verbosity.level", :value=> "silent"
+
+ env :key => "JAVA_OPTS", :value => "-Demma.verbosity.level=silent"
+ arg :line => "#{MSPEC_BIN} ci"
+ arg :line => "-T -J-ea"
+ arg :line => "-T -J-Djruby.launch.inproc=false"
+ arg :line => "-T -J-Djruby.compile.mode=#{ms[:compile_mode]}"
+ arg :line => "-T -J-Djruby.jit.threshold=#{ms[:jit_threshold]}"
+ arg :line => "-T -J-Djruby.jit.max=#{ms[:jit_max]}"
+ arg :line => "-T -J-Djruby.objectspace.enabled=#{ms[:objectspace_enabled]}"
+ arg :line => "-T -J-Djruby.thread.pool.enabled=#{ms[:thread_pooling]}"
+ arg :line => "-T -J-Djruby.reflection=#{ms[:reflection]}"
+ arg :line => "-T -J-Djruby.compat.version=#{ms[:compat]}"
+ arg :line => "-T -J-Demma.coverage.out.file=#{TEST_RESULTS_DIR}/coverage.emma"
+ arg :line => "-T -J-Demma.coverage.out.merge=true"
+ arg :line => "-T -J-Demma.verbosity.level=silent"
+ arg :line => "${spec.jvm.model.option}"
+ arg :line => "-f m"
+ arg :line => "-B #{ms[:spec_config]}" if ms[:spec_config]
+ end
+end
Oops, something went wrong.

0 comments on commit 0104198

Please sign in to comment.