doubleshot 0.3.0-java → 0.4.0-java

Sign up to get free protection for your applications and to get access to all the features.
data/Doubleshot CHANGED
@@ -4,7 +4,7 @@ Doubleshot.new do |config|
4
4
 
5
5
  config.project = "doubleshot"
6
6
  config.group = "org.sam.doubleshot"
7
- config.version = "0.3.0"
7
+ config.version = "0.4.0"
8
8
 
9
9
  config.gem "minitest", ">= 3.0.1"
10
10
  config.gem "minitest-wscolor", ">= 0"
@@ -18,13 +18,13 @@ Doubleshot.new do |config|
18
18
  config.mvn_repository "http://maven.mirrors.travis-ci.org/nexus/content/repositories/codehaus-snapshots/"
19
19
  config.mvn_repository "http://maven.mirrors.travis-ci.org/nexus/content/shadows/central-m1/"
20
20
  config.mvn_repository "http://maven.mirrors.travis-ci.org/nexus/content/repositories/central/"
21
- else
22
- config.mvn_repository "https://nexus.codehaus.org/content/groups/public/"
23
- config.mvn_repository "https://oss.sonatype.org/content/groups/public/"
24
- config.mvn_repository "http://mirrors.ibiblio.org/pub/mirrors/maven2"
25
- config.mvn_repository "http://repo1.maven.org/maven2"
26
21
  end
27
-
22
+
23
+ config.mvn_repository "https://nexus.codehaus.org/content/groups/public/"
24
+ config.mvn_repository "https://oss.sonatype.org/content/groups/public/"
25
+ config.mvn_repository "http://mirrors.ibiblio.org/pub/mirrors/maven2"
26
+ config.mvn_repository "http://repo1.maven.org/maven2"
27
+
28
28
  config.jar "org.sonatype.aether:aether-api:jar:1.13.1"
29
29
  config.jar "org.sonatype.aether:aether-util:jar:1.13.1"
30
30
  config.jar "org.sonatype.aether:aether-impl:jar:1.13.1"
data/README.textile CHANGED
@@ -55,17 +55,13 @@ end
55
55
 
56
56
  h2. Development
57
57
 
58
- Here's how to get Doubleshot running locally yourself. You'll need Java, Maven, JRuby (1.7.x or -head) and Bundler installed. Then, clone the repo:
58
+ Here's how to get Doubleshot running locally yourself. You'll need Java, Maven and JRuby (1.7.x or -head) installed. Then, clone the repo:
59
59
 
60
60
  bc. git clone git://github.com/sam/doubleshot.git
61
61
 
62
- The last milestone we're currently working on is Gem resolution. For right now, you'll need to bootstrap the build with Bundler:
63
-
64
- bc. bundle install
65
-
66
62
  Doubleshot bootstraps it's own build using a slightly different process than used for projects actually using it. It's a chicken and egg situation. Since Doubleshot depends on some Java code to resolve JAR dependencies, and we can't compile without our dependencies, we can't use Doubleshot's normal code to resolve it's own JAR dependencies. That's why Doubleshot has a @pom.xml@ (generated with the @doubleshot pom@ command). We shell out to the Maven command line while bootstrapping the build.
67
63
 
68
- All that just to clarify the process. Once you've installed your Gem dependencies with Bundler, the only thing left you actually need to do at this point is run one of the @doubleshot@ commands to package or test. The internal bootstrapping will take care of the rest:
64
+ All that just to clarify the process. The only thing left you actually need to do at this point is run one of the @doubleshot@ commands to package or test. The internal bootstrapping will take care of the rest:
69
65
 
70
66
  bc. bin/doubleshot test --ci
71
67
 
data/ext/java/Aether.java CHANGED
@@ -50,9 +50,6 @@ public class Aether {
50
50
  installer = locator.getService( Installer.class );
51
51
 
52
52
  session = newSession( repoSystem, localRepo, verbose, offline );
53
-
54
- RemoteRepository central = new RemoteRepository( "central", "default", "http://repo1.maven.org/maven2/" );
55
- repos.add(central);
56
53
  }
57
54
 
58
55
  private ServiceLocator newServiceLocator() {
@@ -39,8 +39,6 @@ class Doubleshot::CLI::Commands::Build < Doubleshot::CLI
39
39
  doubleshot.config.target.rmtree
40
40
  end
41
41
 
42
- compiler = Doubleshot::Compiler.new(doubleshot.config.source.java, doubleshot.config.target)
43
-
44
42
  if doubleshot.config.project == "doubleshot"
45
43
  puts "Bootstrapping Doubleshot build with Maven..."
46
44
  doubleshot.bootstrap!
@@ -49,22 +47,26 @@ class Doubleshot::CLI::Commands::Build < Doubleshot::CLI
49
47
  doubleshot.setup!
50
48
  end
51
49
 
52
- if options.classpath.empty?
53
- doubleshot.classpath
54
- else
55
- options.classpath
56
- end.each do |path|
57
- compiler.classpath << path
58
- end
50
+ if doubleshot.config.source.java.exist?
51
+ compiler = Doubleshot::Compiler.new(doubleshot.config.source.java, doubleshot.config.target)
59
52
 
60
- puts "[INFO] Using #{compiler.classpath}"
61
- puts
53
+ if options.classpath.empty?
54
+ doubleshot.classpath
55
+ else
56
+ options.classpath
57
+ end.each do |path|
58
+ compiler.classpath << path
59
+ end
62
60
 
63
- if compiler.pending? || !options.conditional
64
- puts "Compiling..."
65
- compiler.build!
66
- else
67
- puts "Conditional build: No source changes."
61
+ puts "[INFO] Using #{compiler.classpath}"
62
+ puts
63
+
64
+ if compiler.pending? || !options.conditional
65
+ puts "Compiling..."
66
+ compiler.build!
67
+ else
68
+ puts "Conditional build: No source changes."
69
+ end
68
70
  end
69
71
 
70
72
  return 0
@@ -283,8 +283,10 @@ class Doubleshot
283
283
  @gemspec.require_paths = [ @source.ruby.to_s, @target.to_s ]
284
284
 
285
285
  test_files = []
286
- @source.tests.find do |path|
287
- test_files << path.to_s if path.file? && @whitelist.include?(path.extname)
286
+ if @source.tests.exist?
287
+ @source.tests.find do |path|
288
+ test_files << path.to_s if path.file? && @whitelist.include?(path.extname)
289
+ end
288
290
  end
289
291
  @gemspec.test_files = test_files
290
292
 
@@ -296,12 +298,16 @@ class Doubleshot
296
298
  end
297
299
  end
298
300
 
299
- @source.ruby.find do |path|
300
- files << path.to_s if path.file? && @whitelist.include?(path.extname)
301
+ if @source.ruby.exist?
302
+ @source.ruby.find do |path|
303
+ files << path.to_s if path.file? && @whitelist.include?(path.extname)
304
+ end
301
305
  end
302
306
 
303
- @source.java.find do |path|
304
- files << path.to_s if path.file? && @whitelist.include?(path.extname)
307
+ if @source.java.exist?
308
+ @source.java.find do |path|
309
+ files << path.to_s if path.file? && @whitelist.include?(path.extname)
310
+ end
305
311
  end
306
312
 
307
313
  if @target.exist?
@@ -96,6 +96,10 @@ class Doubleshot
96
96
  while unbound_variable = variable_table.first_unbound
97
97
  possible_values_for_unbound = possible_values_for(unbound_variable)
98
98
  trace("Searching for a value for #{unbound_variable.artifact}")
99
+ trace("Constraints are")
100
+ constraint_table.constraints_on_artifact(unbound_variable.artifact).each do |constraint|
101
+ trace("\t#{constraint}")
102
+ end
99
103
  trace("Possible values are #{possible_values_for_unbound}")
100
104
 
101
105
  while possible_value = possible_values_for_unbound.shift
@@ -233,9 +237,19 @@ class Doubleshot
233
237
  constraint_table.add(dependency, source)
234
238
  dependency_domain = graph.versions(dependency.name, dependency.constraint)
235
239
  domain[dependency.name] = [(domain[dependency.name] || []), dependency_domain]
236
- .flatten
237
- .uniq
238
- .sort { |left, right| right.version <=> left.version }
240
+ .flatten
241
+ .uniq
242
+ .sort { |left, right| right.version <=> left.version }
243
+
244
+ #if the variable we are constraining is still unbound, we want to filter
245
+ #its possible values, if its already bound, we know its ok to add this constraint because
246
+ #we can never change a previously bound value without removing this constraint and we check above
247
+ #whether or not its ok to add this constraint given the current value
248
+
249
+ variable = variable_table.find_artifact(dependency.name)
250
+ if variable.value.nil?
251
+ reset_possible_values_for(variable)
252
+ end
239
253
  end
240
254
  end
241
255
 
Binary file
@@ -337,8 +337,6 @@ describe Doubleshot::Resolver::GemResolver::Solver do
337
337
  end
338
338
 
339
339
  it "must correctly resolve when one resolution exists but it is not the latest" do
340
- skip "pending: https://github.com/reset/solve/pull/7"
341
-
342
340
  @graph.artifacts("get-the-old-one", "1.0")
343
341
  .depends("locked-mid-1", ">= 0")
344
342
  .depends("locked-mid-2", ">= 0")
@@ -360,9 +358,9 @@ describe Doubleshot::Resolver::GemResolver::Solver do
360
358
  Doubleshot::Resolver::GemResolver::Solver.new(@graph, ["get-the-old-one"]).resolve.must_equal(
361
359
  {
362
360
  "get-the-old-one" => "1.0",
363
- "locked-mid-1" => "1.3",
364
- "locked-mid-2" => "1.4",
365
- "old-bottom" => "0.5"
361
+ "locked-mid-1" => "2.0",
362
+ "locked-mid-2" => "1.0",
363
+ "old-bottom" => "2.0"
366
364
  })
367
365
  end
368
366
 
@@ -446,4 +444,4 @@ describe Doubleshot::Resolver::GemResolver::Solver do
446
444
 
447
445
  end
448
446
  end
449
- end
447
+ end
@@ -70,16 +70,15 @@ describe Doubleshot::Resolver::GemResolver do
70
70
  end
71
71
 
72
72
  it "should correctly resolve dependencies when one resolution exists but it is not the latest" do
73
- skip "pending: https://github.com/reset/solve/pull/7"
74
73
  @dependencies.fetch "get-the-old-one"
75
74
 
76
75
  @resolver.resolve! @dependencies
77
76
 
78
77
  @dependencies.size.must_equal 4
79
78
  @dependencies.fetch("get-the-old-one").version.must_equal "1.0"
80
- @dependencies.fetch("locked-mid-1").version.must_equal "1.3"
81
- @dependencies.fetch("locked-mid-2").version.must_equal "1.4"
82
- @dependencies.fetch("old-bottom").version.must_equal "0.5"
79
+ @dependencies.fetch("locked-mid-1").version.must_equal "2.0"
80
+ @dependencies.fetch("locked-mid-2").version.must_equal "1.0"
81
+ @dependencies.fetch("old-bottom").version.must_equal "2.0"
83
82
  end
84
83
  end
85
84
 
@@ -6,15 +6,13 @@ require_relative "../helper"
6
6
 
7
7
  describe Doubleshot::Resolver::JarResolver do
8
8
  before do
9
- @resolver = Doubleshot::Resolver::JarResolver.new(Doubleshot::Resolver::JarResolver::DEFAULT_REPOSITORY)
9
+ @resolver = Doubleshot::Resolver::JarResolver.new(*Doubleshot::current.config.mvn_repositories)
10
10
  end
11
11
 
12
12
  describe "fetch" do
13
13
  before do
14
14
  @dependencies = Doubleshot::Dependencies::JarDependencyList.new
15
- @dependencies.fetch("com.pyx4j:maven-plugin-log4j:jar:1.0.1")
16
- @dependencies.fetch("org.springframework:spring-core:jar:3.1.2.RELEASE")
17
- @dependencies.fetch("org.hibernate:hibernate-core:jar:4.1.7.Final")
15
+ @dependencies.fetch("ch.qos.logback:logback-core:jar:1.0.6")
18
16
  end
19
17
 
20
18
  it "must return the same JarDependencyList" do
@@ -26,9 +24,5 @@ describe Doubleshot::Resolver::JarResolver do
26
24
  dependency.path.wont_be_nil
27
25
  end
28
26
  end
29
-
30
- it "must populate transitive dependencies" do
31
- @resolver.resolve!(@dependencies).size.must_equal 16
32
- end
33
27
  end
34
28
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: doubleshot
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.0
5
+ version: 0.4.0
6
6
  platform: java
7
7
  authors:
8
8
  - Sam Smoot
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-01 00:00:00.000000000 Z
12
+ date: 2012-11-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest