Sha256: fd27733ea1b10f3341a95807b65c54cbf12976e1560a31475f7b646cc816b80e

Contents?: true

Size: 960 Bytes

Versions: 3

Compression:

Stored size: 960 Bytes

Contents

def java_classpath_arg # myriad of ways to discover JRuby classpath
  begin
    cpath  = Java::java.lang.System.getProperty('java.class.path').split(File::PATH_SEPARATOR)
    cpath += Java::java.lang.System.getProperty('sun.boot.class.path').split(File::PATH_SEPARATOR)
    jruby_cpath = cpath.compact.join(File::PATH_SEPARATOR)
  rescue => e
  end
  unless jruby_cpath
    jruby_cpath = ENV['JRUBY_PARENT_CLASSPATH'] || ENV['JRUBY_HOME'] &&
      FileList["#{ENV['JRUBY_HOME']}/lib/*.jar"].join(File::PATH_SEPARATOR)
  end
  jruby_cpath ? "-cp \"#{jruby_cpath}\"" : ""
end

jar_name = File.join(*%w(lib arjdbc jdbc adapter_java.jar))

desc "Compile the native Java code."
task :java_compile do
  pkg_classes = File.join(*%w(pkg classes))
  mkdir_p pkg_classes
  sh "javac -target 1.5 -source 1.5 -d pkg/classes #{java_classpath_arg} #{FileList['src/java/**/*.java'].join(' ')}"
  sh "jar cf #{jar_name} -C #{pkg_classes} ."
end
file jar_name => :java_compile

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
activerecord-jdbc-adapter-1.0.0.beta2-java rakelib/compile.rake
kb-activerecord-jdbc-adapter-1.0.0.beta1-java rakelib/compile.rake
activerecord-jdbc-adapter-1.0.0.beta1-java rakelib/compile.rake