lock_jar 0.13.0 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +16 -0
  3. data/.rubocop.yml +28 -0
  4. data/.travis.yml +12 -1
  5. data/Gemfile +6 -3
  6. data/Guardfile +2 -3
  7. data/README.md +17 -16
  8. data/Rakefile +11 -7
  9. data/lib/lock_jar/buildr.rb +95 -89
  10. data/lib/lock_jar/bundler.rb +85 -84
  11. data/lib/lock_jar/class_loader.rb +19 -21
  12. data/lib/lock_jar/cli.rb +32 -25
  13. data/lib/lock_jar/domain/artifact.rb +39 -45
  14. data/lib/lock_jar/domain/dsl.rb +50 -79
  15. data/lib/lock_jar/domain/dsl_merger.rb +76 -0
  16. data/lib/lock_jar/domain/gem_dsl.rb +10 -12
  17. data/lib/lock_jar/domain/jarfile_dsl.rb +6 -18
  18. data/lib/lock_jar/domain/lockfile.rb +17 -24
  19. data/lib/lock_jar/logging.rb +4 -3
  20. data/lib/lock_jar/maven.rb +29 -29
  21. data/lib/lock_jar/registry.rb +52 -60
  22. data/lib/lock_jar/resolver.rb +17 -20
  23. data/lib/lock_jar/runtime/install.rb +28 -0
  24. data/lib/lock_jar/runtime/list.rb +55 -0
  25. data/lib/lock_jar/runtime/load.rb +54 -0
  26. data/lib/lock_jar/runtime/lock.rb +152 -0
  27. data/lib/lock_jar/runtime.rb +30 -302
  28. data/lib/lock_jar/version.rb +2 -1
  29. data/lib/lock_jar.rb +137 -105
  30. data/lock_jar.gemspec +7 -4
  31. data/spec/fixtures/jarfile_gem/Gemfile +4 -0
  32. data/spec/fixtures/jarfile_gem/Jarfile +1 -0
  33. data/spec/fixtures/jarfile_gem/jarfile_gem.gemspec +23 -0
  34. data/spec/fixtures/jarfile_gem/lib/jarfile_gem/version.rb +3 -0
  35. data/spec/fixtures/jarfile_gem/lib/jarfile_gem.rb +5 -0
  36. data/spec/lock_jar/bundler_spec.rb +27 -0
  37. data/spec/lock_jar/class_loader_spec.rb +34 -36
  38. data/spec/lock_jar/cli_spec.rb +39 -46
  39. data/spec/lock_jar/domain/dsl_merger_spec.rb +49 -0
  40. data/spec/lock_jar/domain/dsl_spec.rb +35 -37
  41. data/spec/lock_jar/domain/gem_dsl_spec.rb +18 -0
  42. data/spec/lock_jar/maven_spec.rb +9 -11
  43. data/spec/lock_jar/resolver_spec.rb +16 -17
  44. data/spec/lock_jar/runtime_spec.rb +17 -13
  45. data/spec/lock_jar_spec.rb +255 -195
  46. data/spec/spec_helper.rb +13 -8
  47. data/spec/support/helper.rb +13 -5
  48. data/spec/support/shared_examples/lockfile.rb +4 -6
  49. metadata +43 -19
  50. data/bundler/Gemfile +0 -21
  51. data/bundler/LICENSE.txt +0 -22
  52. data/bundler/README.md +0 -29
  53. data/bundler/Rakefile +0 -2
  54. data/bundler/lib/lock_jar_bundler/bundler.rb +0 -35
  55. data/bundler/lib/lock_jar_bundler/piggy_back.rb +0 -98
  56. data/bundler/lib/lock_jar_bundler/version.rb +0 -5
  57. data/bundler/lib/lock_jar_bundler.rb +0 -5
  58. data/bundler/lock_jar_bundler.gemspec +0 -24
  59. data/bundler/spec/Jarfile +0 -3
  60. data/bundler/spec/dummy_gem/Jarfile +0 -1
  61. data/bundler/spec/dummy_gem/dummy_gem.gemspec +0 -19
  62. data/bundler/spec/lock_jar_bundler_spec.rb +0 -49
  63. data/bundler/spec/spec_helper.rb +0 -88
  64. data/lib/lock_jar/domain/dsl_helper.rb +0 -84
  65. data/spec/lock_jar/domain/dsl_helper_spec.rb +0 -52
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fdc8665446b2c03fe7af8986a64e2f26e2c60b2b
4
- data.tar.gz: 46e658bf1bd14e571797ed13e22af81390cdb86b
3
+ metadata.gz: 127144912becde98e2e9f80f09c4cc8539ac9444
4
+ data.tar.gz: 5cc472a575538541f16e46ad98f8cc788aa9670a
5
5
  SHA512:
6
- metadata.gz: c7168fac6c7af56f0875c87e27c68353ebb3f36acf3efc8fa3edeaf40f29cc3dd32863770bd6f071e48d42019b96721611804086624813866cec2e71991dabcd
7
- data.tar.gz: 772b77a7c9b2c1262c2bd8c9521797f31fcba17f294650e8b2bd379f29ee3aef75ea43aaafb8d1c1f5fd9496cbd7b87c8230c51ac46b661b89ff5224f11cae83
6
+ metadata.gz: 03900e1901e2442d270e32d33dd817880beb11b2d8593ec29266c92065593184f636e8cbc95815e5856966ec37095f899eac1e28feedb01cbecd99d1c6c7d920
7
+ data.tar.gz: 7c1e04d429617d7b95b139195312f8f2106c8c94e6f1b6fb52ccfc6995359d89bdc8135d4fae8025b3bceb04f4a15440a7cb9f462eb2cb2b89b2b5e9c61f9e51
data/.codeclimate.yml ADDED
@@ -0,0 +1,16 @@
1
+ languages:
2
+ Ruby: true
3
+ engines:
4
+ rubocop:
5
+ enabled: true
6
+ checks:
7
+ Rubocop/Rails/Output:
8
+ enabled: false
9
+ ratings:
10
+ paths:
11
+ - lib/**
12
+ exclude_paths:
13
+ - spec/**/*
14
+ - vendor/**/*
15
+ - tmp/**/*
16
+ - target/**/*
data/.rubocop.yml ADDED
@@ -0,0 +1,28 @@
1
+ # This is the configuration used to check the rubocop source code.
2
+
3
+ AllCops:
4
+ Exclude:
5
+ - 'tmp/**/*'
6
+ - 'target/**/*'
7
+ - 'vendor/**/*'
8
+ - 'spec/fixtures/**/*'
9
+
10
+ Metrics/LineLength:
11
+ Max: 100
12
+ Exclude:
13
+ - 'spec/**/*'
14
+
15
+ Metrics/MethodLength:
16
+ Max: 25
17
+
18
+ Metrics/AbcSize:
19
+ Max: 30
20
+
21
+ Metrics/CyclomaticComplexity:
22
+ Max: 10
23
+
24
+ Style/PredicateName:
25
+ Enabled: false
26
+
27
+ Style/Lambda:
28
+ Enabled: false
data/.travis.yml CHANGED
@@ -1,3 +1,5 @@
1
+ before_install:
2
+ - export JRUBY_OPTS="-Xcli.debug=true --debug"
1
3
  language: ruby
2
4
  rvm:
3
5
  - 1.9.3
@@ -7,4 +9,13 @@ rvm:
7
9
  - jruby-20mode
8
10
  - jruby-21mode
9
11
 
10
- script: bundle exec rspec spec
12
+ script: bundle exec rake
13
+ sudo: false
14
+
15
+ addons:
16
+ code_climate:
17
+ repo_token: 3377046eefe5079936ac6dd66241c7fac6e56c632a34b653ef7896e31fa048c1
18
+
19
+ cache:
20
+ directories:
21
+ - .spec-tmp
data/Gemfile CHANGED
@@ -3,11 +3,14 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in lock_jar.gemspec
4
4
  gemspec
5
5
 
6
+ group :test do
7
+ gem 'codeclimate-test-reporter', require: nil
8
+ gem 'jarfile_gem', path: 'spec/fixtures/jarfile_gem'
9
+ end
6
10
 
7
11
  group :development do
8
- gem 'guard-rspec', :require => false
12
+ gem 'guard-rspec', require: false
9
13
  gem 'pry'
10
14
  gem 'yard'
11
- gem 'jruby-openssl', :platforms => :jruby
12
- gem 'rspec', '~> 2.14.1'
15
+ gem 'rubocop'
13
16
  end
data/Guardfile CHANGED
@@ -3,7 +3,6 @@
3
3
 
4
4
  guard :rspec do
5
5
  watch(%r{^spec/.+_spec\.rb$})
6
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
- watch('spec/spec_helper.rb') { "spec" }
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { 'spec' }
8
8
  end
9
-
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # LockJar
2
2
 
3
3
  [![Build Status](https://secure.travis-ci.org/mguymon/lock_jar.png?branch=master)](http://travis-ci.org/mguymon/lock_jar)
4
+ [![Code Climate](https://codeclimate.com/github/mguymon/lock_jar/badges/gpa.svg)](https://codeclimate.com/github/mguymon/lock_jar)
4
5
 
5
6
  LockJar manages Java Jars for Ruby. Powered by [Naether](https://github.com/mguymon/naether) to
6
7
  create a frankenstein of Bundler and Maven. A Jarfile ([example](https://github.com/mguymon/lock_jar/blob/master/spec/support/Jarfile)) is used to generate a Jarfile.lock that contains all the resolved jar dependencies. The Jarfile.lock can be used to populate the classpath.
@@ -10,7 +11,7 @@ LockJar can:
10
11
  * From the [command line](https://github.com/mguymon/lock_jar/blob/master/README.md#command-line)
11
12
  * [Triggered from a Gem install](https://github.com/mguymon/lock_jar/blob/master/README.md#gem-integration)
12
13
  * [Integrated into Buildr](https://github.com/mguymon/lock_jar/blob/master/README.md#buildr-integration)
13
- * Experimental [integration with Bundler](https://github.com/mguymon/lock_jar/blob/master/README.md#bundler-integration)
14
+ * [Integrated into Bundler](https://github.com/mguymon/lock_jar/blob/master/README.md#bundler-integration)
14
15
 
15
16
  https://github.com/mguymon/lock_jar
16
17
 
@@ -29,12 +30,12 @@ JRuby is natively supported. Ruby 1.9.3 and 2.1 uses [Rjb](http://rjb.rubyforge.
29
30
  A Jarfile is a simple file using a Ruby DSL for defining a project's dependencies using the following
30
31
  methods:
31
32
 
32
- * **local_repo( path )**: Set the local Maven repository, this were dependencies are downloaded to.
33
- * **remote_repo( url )**: Add additional url of remote Maven repository.
34
- * **group( groups )**: Set the group for nested jar or pom. A single or Array of groups can be set.
35
- * **jar( notations, opts = {} )**: Add Jar dependency in artifact notation, artifact:group:version as the bare minimum. A single or Array of notations can be passed. Default group is _default_, can be specified by setting _opts = { :group => ['group_name'] }_
36
- * **local( path )**: Add a local path to a Jar
37
- * **pom( pom_path, opts = {} )**: Add a local Maven pom, default is to load dependencies for `runtime` and `compile` scopes. To select the scopes to be loaded from the pom, set the _opts = { :scopes => ['test'] }_
33
+ * **local_repo(path)**: Set the local Maven repository, this were dependencies are downloaded to.
34
+ * **remote_repo(url)**: Add additional url of remote Maven repository.
35
+ * **group(groups)**: Set the group for nested jar or pom. A single or Array of groups can be set.
36
+ * **jar(notations, opts = {})**: Add Jar dependency in artifact notation, artifact:group:version as the bare minimum. A single or Array of notations can be passed. Default group is _default_, can be specified by setting _opts = { :group => ['group_name'] }_
37
+ * **local(path)**: Add a local path to a Jar
38
+ * **pom(pom_path, opts = {})**: Add a local Maven pom, default is to load dependencies for `runtime` and `compile` scopes. To select the scopes to be loaded from the pom, set the _opts = { :scopes => ['test'] }_
38
39
  * **without_default_maven_repo**: Do not use the default maven repo.
39
40
 
40
41
  #### Example Jarfile
@@ -55,7 +56,7 @@ methods:
55
56
 
56
57
  ### Resolving dependencies
57
58
 
58
- **LockJar.lock( *args )**: Using a Jarfile, creates a lock file. Depending on the type of arg, a different configuration is set.
59
+ **LockJar.lock(*args)**: Using a Jarfile, creates a lock file. Depending on the type of arg, a different configuration is set.
59
60
  * _[String]_ will set the Jarfile path, e.g. `'/somewhere/Jarfile.different'`. Default jarfile is `'Jarfile'`
60
61
  * _[Hash]_ will set the options, e.g. `{ :local_repo => 'path' }`
61
62
  * **:download** _[Boolean]_ if true, will download jars to local repo. Defaults to true.
@@ -192,7 +193,7 @@ You can skip the _Jarfile_ and _Jarfile.lock_ to directly play with dependencies
192
193
 
193
194
  Since you skipped the locking part, mostly likely you will need to resolve the dependences in the block, just pass the _:resolve => true_ option to enable dependency resolution (also works for _LockJar.list_).
194
195
 
195
- LockJar.load( :resolve => true ) do
196
+ LockJar.load(:resolve => true) do
196
197
  jar 'org.eclipse.jetty:example-jetty-embedded:jar:8.1.2.v20120308'
197
198
  end
198
199
 
@@ -233,9 +234,9 @@ Rakefile with default to install Jars using LockJar:
233
234
  require 'lock_jar'
234
235
 
235
236
  # get jarfile relative the gem dir
236
- lockfile = File.expand_path( "../Jarfile.lock", __FILE__ )
237
+ lockfile = File.expand_path("../Jarfile.lock", __FILE__)
237
238
 
238
- LockJar.install( lockfile )
239
+ LockJar.install(lockfile)
239
240
  end
240
241
 
241
242
  #### Work around for Rakefile default
@@ -252,10 +253,10 @@ Instead of rely in a Rakefile to install Jars when the Gem is installed, Jars ca
252
253
  Ruby needs to be called before calling `LockJar.load`. Only Jars that are missing are downloaded.
253
254
 
254
255
  #get jarfile relative the gem dir
255
- lockfile = File.expand_path( "../Jarfile.lock", __FILE__ )
256
+ lockfile = File.expand_path("../Jarfile.lock", __FILE__)
256
257
 
257
258
  # Download any missing Jars
258
- LockJar.install( lockfile )
259
+ LockJar.install(lockfile)
259
260
 
260
261
  ### Loading
261
262
 
@@ -263,10 +264,10 @@ With the Jars installed, loading the classpath for the Gem is simple.
263
264
  As part of the load process for the Gem (an entry file that is required, etc) use the following:
264
265
 
265
266
  #get jarfile relative the gem dir
266
- lockfile = File.expand_path( "../Jarfile.lock", __FILE__ )
267
+ lockfile = File.expand_path("../Jarfile.lock", __FILE__)
267
268
 
268
269
  # Loads the ClassPath with Jars from the lockfile
269
- LockJar.load( lockfile )
270
+ LockJar.load(lockfile)
270
271
 
271
272
  See also [loading Jars into a custom ClassLoader](https://github.com/mguymon/lock_jar/wiki/ClassLoader).
272
273
 
@@ -327,7 +328,7 @@ Generated the following lock files using **lock_jar:lock**
327
328
 
328
329
  ## Bundler Integration
329
330
 
330
- Bundler integration is **experimental** right now. [LockJar patches Bundler](https://github.com/mguymon/lock_jar/blob/master/lib/lock_jar/bundler.rb)
331
+ [LockJar patches Bundler](https://github.com/mguymon/lock_jar/blob/master/lib/lock_jar/bundler.rb)
331
332
  to allow creation of a _Jarfile.lock_ when Bundler calls `install` and `update`. The dependencies from the _Jarfile.lock_ are automatically loaded when
332
333
  Bundler calls `setup` and `require`. To enable this support, add this require to your _Gemfile_
333
334
 
data/Rakefile CHANGED
@@ -1,24 +1,28 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'rubygems'
4
3
  require 'bundler'
4
+ require 'rspec/core/rake_task'
5
+ require 'rubocop/rake_task'
6
+ require 'bundler/gem_tasks'
7
+ require 'rdoc/task'
8
+
5
9
  begin
6
10
  Bundler.setup(:default, :development)
7
11
  rescue Bundler::BundlerError => e
8
12
  $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
13
+ $stderr.puts 'Run `bundle install` to install missing gems'
10
14
  exit e.status_code
11
15
  end
12
- require 'rake'
13
- require "bundler/gem_tasks"
14
16
 
17
+ RSpec::Core::RakeTask.new
18
+ RuboCop::RakeTask.new
15
19
 
16
- require 'rdoc/task'
17
20
  Rake::RDocTask.new do |rdoc|
18
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
19
-
21
+ version = File.exist?('VERSION') ? File.read('VERSION') : ''
20
22
  rdoc.rdoc_dir = 'rdoc'
21
23
  rdoc.title = "lockjar #{version}"
22
24
  rdoc.rdoc_files.include('README*')
23
25
  rdoc.rdoc_files.include('lib/**/*.rb')
24
26
  end
27
+
28
+ task default: [:spec, :rubocop]
@@ -16,130 +16,136 @@
16
16
  require 'lock_jar'
17
17
  require 'lock_jar/domain/dsl'
18
18
 
19
+ #
19
20
  module Buildr
20
-
21
- @@global_lockjar_dsl = nil
22
-
21
+ attr_reader :global_lockjar_dsl
22
+
23
23
  class << self
24
- def project_to_lockfile( project )
25
- "#{project.name.gsub(/:/,'-')}.lock"
26
- end
27
-
28
- def global_lockjar_dsl
29
- @@global_lockjar_dsl
24
+ def project_to_lockfile(project)
25
+ "#{project.name.gsub(/:/, '-')}.lock"
30
26
  end
31
27
  end
32
-
33
- def lock_jar( &blk )
34
- @@global_lockjar_dsl = ::LockJar::Domain::Dsl.create(&blk)
28
+
29
+ def lock_jar(&blk)
30
+ @global_lockjar_dsl = ::LockJar::Domain::Dsl.create(&blk)
35
31
  end
36
-
37
- namespace "lock_jar" do
38
- desc "Lock dependencies for each project"
39
- task("lock") do
40
- projects.each do |project|
41
- if project.lockjar_dsl
42
- # add buildr repos
43
- repositories.remote.each do |repo|
44
- project.lockjar_dsl.repository repo
45
- end
46
- ::LockJar.lock( project.lockjar_dsl, :lockfile => Buildr.project_to_lockfile(project) )
32
+
33
+ namespace 'lock_jar' do
34
+ desc 'Lock dependencies for each project'
35
+ task('lock') do
36
+ projects.each do |project|
37
+ next if project.lockjar_dsl.nil?
38
+
39
+ # add buildr repos
40
+ repositories.remote.each do |repo|
41
+ project.lockjar_dsl.repository repo
47
42
  end
43
+ ::LockJar.lock(project.lockjar_dsl, lockfile: Buildr.project_to_lockfile(project))
48
44
  end
49
45
  end
50
46
  end
51
-
47
+
52
48
  module LockJar
49
+ #
53
50
  module ProjectExtension
54
51
  include Extension
55
-
56
- def lock_jar( &blk )
57
- @lockjar_dsl = ::LockJar::Domain::Dsl.create(&blk)
58
-
59
- unless Buildr.global_lockjar_dsl.nil?
60
- @lockjar_dsl.merge( Buildr.global_lockjar_dsl )
61
- end
52
+
53
+ def lock_jar(&blk)
54
+ @lockjar_dsl = ::LockJar::Domain::Dsl.create(&blk)
55
+ @lockjar_dsl.merge(Buildr.global_lockjar_dsl) unless Buildr.global_lockjar_dsl.nil?
62
56
  end
63
-
64
- def lock_jars( *args )
57
+
58
+ def lock_jars(*args)
65
59
  lockfile = Buildr.project_to_lockfile(project)
66
60
  opts = {}
67
61
  groups = ['default']
68
-
62
+
69
63
  args.each do |arg|
70
64
  if arg.is_a?(Hash)
71
- opts.merge!( arg )
72
- elsif arg.is_a?( String )
65
+ opts.merge!(arg)
66
+ elsif arg.is_a?(String)
73
67
  lockfile = arg
74
- elsif arg.is_a?( Array )
68
+ elsif arg.is_a?(Array)
75
69
  groups = arg
76
70
  end
77
71
  end
78
-
79
- ::LockJar.list( lockfile, groups, opts )
72
+
73
+ ::LockJar.list(lockfile, groups, opts)
80
74
  end
81
-
75
+
82
76
  def lockjar_dsl
83
77
  @lockjar_dsl || Buildr.global_lockjar_dsl
84
78
  end
85
-
86
- after_define do |project|
87
- task :compile => 'lock_jar:compile'
79
+
80
+ after_define do |project|
81
+ task compile: 'lock_jar:compile'
88
82
  task 'test:compile' => 'lock_jar:test:compile'
89
-
83
+
90
84
  task 'eclipse' => 'lock_jar:eclipse'
91
-
92
- namespace "lock_jar" do
93
- desc "Lock dependencies to JarFile"
94
- task("lock") do
95
- dsl = project.lockjar_dsl
96
- if dsl
97
- # add buildr repos
98
- repositories.remote do |repo|
99
- puts repo
100
- dsl.repository repo
101
- end
102
- ::LockJar.lock( dsl, :lockfile => "#{project.name}.lock" )
103
- else
104
- # XXX: output that there were no dependencies to lock
105
- puts "No lock_jar dependencies to lock for #{project.name}"
106
- end
107
- end
108
-
109
- task("compile") do
110
- if project.lockjar_dsl && !File.exists?( Buildr.project_to_lockfile(project) )
111
- raise "#{project.name}.lock does not exist, run #{project.name}:lockjar:lock first"
85
+
86
+ namespace 'lock_jar' do
87
+ desc 'Lock dependencies to JarFile'
88
+ task('lock') do
89
+ dsl = project.lockjar_dsl
90
+ if dsl
91
+ # add buildr repos
92
+ repositories.remote do |repo|
93
+ puts repo
94
+ dsl.repository repo
112
95
  end
113
- jars = ::LockJar.list( Buildr.project_to_lockfile(project), ['default'] )
114
- project.compile.with( jars )
96
+ ::LockJar.lock(dsl, lockfile: "#{project.name}.lock")
97
+ else
98
+ # XXX: output that there were no dependencies to lock
99
+ puts "No lock_jar dependencies to lock for #{project.name}"
115
100
  end
116
-
117
- task("test:compile") do
118
- if project.lockjar_dsl && !File.exists?( Buildr.project_to_lockfile(project) )
119
- raise "#{Buildr.project_to_lockfile(project)} does not exist, run #{project.name}:lockjar:lock first"
120
- end
121
- jars = ::LockJar.list( Buildr.project_to_lockfile(project), ['test'] )
122
-
123
- project.test.compile.with( jars )
124
- project.test.with( jars )
101
+ end
102
+
103
+ task('compile') do
104
+ if project.lockjar_dsl && !File.exist?(Buildr.project_to_lockfile(project))
105
+ fail(
106
+ "#{project.name}.lock does not exist, run "\
107
+ "#{project.name}:lockjar:lock first"
108
+ )
125
109
  end
126
-
127
- task("eclipse") do
128
- if project.lockjar_dsl && !File.exists?( Buildr.project_to_lockfile(project) )
129
- raise "#{Buildr.project_to_lockfile(project)} does not exist, run #{project.name}:lockjar:lock first"
130
- end
131
- jars = ::LockJar.list( Buildr.project_to_lockfile(project), ['default'] )
132
- project.compile.with( jars )
133
-
134
- jars = ::LockJar.list( Buildr.project_to_lockfile(project), ['test'] )
135
- project.test.compile.with( jars )
110
+ jars = ::LockJar.list(Buildr.project_to_lockfile(project), ['default'])
111
+ project.compile.with(jars)
112
+ end
113
+
114
+ task('test:compile') do
115
+ if project.lockjar_dsl && !File.exist?(Buildr.project_to_lockfile(project))
116
+ fail(
117
+ "#{Buildr.project_to_lockfile(project)} does not exist, run"\
118
+ " #{project.name}:lockjar:lock first"
119
+ )
136
120
  end
121
+ jars = ::LockJar.list(Buildr.project_to_lockfile(project), ['test'])
122
+
123
+ project.test.compile.with(jars)
124
+ project.test.with(jars)
125
+ end
126
+
127
+ task('eclipse') do
128
+ if project.lockjar_dsl && !File.exist?(Buildr.project_to_lockfile(project))
129
+ fail(
130
+ "#{Buildr.project_to_lockfile(project)} does not exist, run "\
131
+ "#{project.name}:lockjar:lock first"
132
+ )
133
+ end
134
+ jars = ::LockJar.list(Buildr.project_to_lockfile(project), ['default'])
135
+ project.compile.with(jars)
136
+
137
+ jars = ::LockJar.list(Buildr.project_to_lockfile(project), ['test'])
138
+ project.test.compile.with(jars)
139
+ end
137
140
  end
138
141
  end
139
142
  end
140
143
  end
141
144
  end
142
145
 
143
- class Buildr::Project
144
- include Buildr::LockJar::ProjectExtension
145
- end
146
+ module Buildr
147
+ # Patch Builder::Project to include Buildr::LockJar::ProjectExtension
148
+ class Project
149
+ include Buildr::LockJar::ProjectExtension
150
+ end
151
+ end