Skip to content

Commit

Permalink
improve setup of rake tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mkristian committed Mar 16, 2016
1 parent 810d140 commit 64ea77a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ source 'https://rubygems.org'

# Specify your gem's dependencies in the gemspec
gemspec

# for the rake task
gem 'ruby-maven', '~> 3.3.8'
18 changes: 10 additions & 8 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#-*- mode: ruby -*-

begin
require 'maven/ruby/tasks'
require 'ruby-maven'
rescue LoadError
warn "ruby-maven not available - some tasks will not work " <<
"either `gem install ruby-maven' or use mvn instead of rake"
Expand All @@ -16,20 +16,22 @@ rescue LoadError
end
end
else
Rake::Task[:jar].clear
#Rake::Task[:jar].clear rescue nil
desc "Package jopenssl.jar with the compiled classes"
task :jar => :maven do
maven.prepare_package '-Dmaven.test.skip=true'
task :jar do
RubyMaven.exec( 'prepare_package -Dmaven.test.skip=true' )
end
namespace :jar do
desc "Package jopenssl.jar file (and dependendent jars)"
task :all => :maven do
maven.package '-Dmaven.test.skip=true'
task :all do
RubyMaven.exec( 'package -Dmaven.test.skip=true' )
end
end
end

# the actual build configuration is inside the Mavenfile
task :build do
RubyMaven.exec('package -Dmaven.test.skip')
end

task :default => :build

Expand Down Expand Up @@ -64,4 +66,4 @@ namespace :integration do
lib = [ 'lib', 'src/test/integration' ]
ruby "-I#{lib.join(':')} -e \"#{loader}\" #{test_files.map { |f| "\"#{f}\"" }.join(' ')}"
end
end
end
7 changes: 5 additions & 2 deletions src/test/ruby/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
puts Java::OrgBouncycastleJceProvider::BouncyCastleProvider.new.info
else
base_dir = File.expand_path('../../..', File.dirname(__FILE__))
$CLASSPATH << File.join(base_dir, 'pkg/classes')

jar = File.join(base_dir, 'lib/jopenssl.jar')
raise "jopenssl.jar jar not found" unless jar; $CLASSPATH << jar

jar = Dir[File.join(base_dir, 'lib/org/bouncycastle/**/bcprov-*.jar')].first
raise "bcprov jar not found" unless jar; $CLASSPATH << jar
jar = Dir[File.join(base_dir, 'lib/org/bouncycastle/**/bcpkix-*.jar')].first
Expand Down Expand Up @@ -205,4 +208,4 @@ def issue_crl(revoke_info, serial, lastup, nextup, extensions,
Dir.glob("#{File.join(base, sub)}/**/test_*.rb").each do |test|
require test
end
end
end

0 comments on commit 64ea77a

Please sign in to comment.