Author: assaf
Date: Mon Aug 4 14:31:08 2008
New Revision: 682515
URL: http://svn.apache.org/viewvc?rev=682515&view=rev
Log:
Fixed: BUILDR-116: TestTask should include the main compile target in its
dependencies, even when using non standard directories (Lacton).
Modified:
incubator/buildr/trunk/CHANGELOG
incubator/buildr/trunk/lib/buildr/core/compile.rb
incubator/buildr/trunk/spec/compile_spec.rb
incubator/buildr/trunk/spec/test_spec.rb
Modified: incubator/buildr/trunk/CHANGELOG
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/CHANGELOG?rev=682515&r1=682514&r2=682515&view=diff
==============================================================================
--- incubator/buildr/trunk/CHANGELOG (original)
+++ incubator/buildr/trunk/CHANGELOG Mon Aug 4 14:31:08 2008
@@ -18,6 +18,8 @@
* Fixed: BUILDR-112 Using a user gem repository with 'rake setup' (Lacton).
* Fixed: BUILDR-114 Hash.from_java_properties does not behave
like java.util.Properties (Lacton).
+* Fixed: BUILDR-116: TestTask should include the main compile target in its
+dependencies, even when using non standard directories (Lacton).
* Docs: BUILDR-111 Troubleshoot tip when Buildr's bin directory shows up in
RUBYLIB (Geoffrey Ruscoe).
Modified: incubator/buildr/trunk/lib/buildr/core/compile.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/compile.rb?rev=682515&r1=682514&r2=682515&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/compile.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/compile.rb Mon Aug 4 14:31:08 2008
@@ -246,6 +246,7 @@
# compile.from('src/java').into('classes').with('module1.jar')
def from(*sources)
@sources |= sources.flatten
+ guess_compiler if @compiler.nil? && sources.flatten.any? { |source|
File.exist?(source) }
self
end
@@ -318,10 +319,7 @@
# based on existing source directories (e.g. src/main/java), or by
requesting
# a specific compiler (see #using).
def compiler
- unless @compiler
- candidate = Compiler.compilers.detect { |cls| cls.applies_to?(project,
self) }
- self.compiler = candidate if candidate
- end
+ guess_compiler unless @compiler
@compiler && @compiler.class.to_sym
end
@@ -365,7 +363,11 @@
# Associates this task with project and particular usage (:main, :test).
def associate_with(project, usage) #:nodoc:
@project, @usage = project, usage
- # Try to guess if we have a compiler to match source files.
+ guess_compiler
+ end
+
+ # Try to guess if we have a compiler to match source files.
+ def guess_compiler #:nodoc:
candidate = Compiler.compilers.detect { |cls| cls.applies_to?(project,
self) }
self.compiler = candidate if candidate
end
Modified: incubator/buildr/trunk/spec/compile_spec.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/compile_spec.rb?rev=682515&r1=682514&r2=682515&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/compile_spec.rb (original)
+++ incubator/buildr/trunk/spec/compile_spec.rb Mon Aug 4 14:31:08 2008
@@ -330,7 +330,7 @@
# On my machine the times end up the same, so need to push dependencies in
the past.
time = Time.now
sources.map { |src|
src.pathmap("#{compile_task.target}/thepackage/%n.class") }.
- each { |kls| write kls ; File.utime(time, time, kls) }
+ each { |kls| write kls ; File.utime(time - 1, time - 1, kls) }
jars.each { |jar| File.utime(time + 1, time + 1, jar) }
lambda { compile_task.from(sources).with(jars).invoke }.should
run_task('foo:compile')
end
Modified: incubator/buildr/trunk/spec/test_spec.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/test_spec.rb?rev=682515&r1=682514&r2=682515&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/test_spec.rb (original)
+++ incubator/buildr/trunk/spec/test_spec.rb Mon Aug 4 14:31:08 2008
@@ -203,6 +203,12 @@
project('foo').test.dependencies.should
include(project('foo').test.compile.target)
end
+ it 'should include the test compile target in its dependencies, even when
using non standard directories' do
+ write 'src/test/Test.java', 'class Test {}'
+ define('foo') { test.compile path_to('src/test') }
+ project('foo').test.dependencies.should
include(project('foo').test.compile.target)
+ end
+
it 'should add test compile target ahead of regular compile target' do
write 'src/main/java/Code.java'
write 'src/test/java/Test.java'