You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by to...@apache.org on 2010/04/03 07:40:09 UTC
svn commit: r930479 - in /buildr/trunk: lib/buildr/core/compile.rb
spec/core/compile_spec.rb
Author: toulmean
Date: Sat Apr 3 05:40:09 2010
New Revision: 930479
URL: http://svn.apache.org/viewvc?rev=930479&view=rev
Log:
fix for BUILDR-400: Don't forbid projects to use their own compiler after one has been guessed
Modified:
buildr/trunk/lib/buildr/core/compile.rb
buildr/trunk/spec/core/compile_spec.rb
Modified: buildr/trunk/lib/buildr/core/compile.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/compile.rb?rev=930479&r1=930478&r2=930479&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/compile.rb (original)
+++ buildr/trunk/lib/buildr/core/compile.rb Sat Apr 3 05:40:09 2010
@@ -369,7 +369,6 @@ module Buildr
def compiler=(name) #:nodoc:
cls = Compiler.select(name) or raise ArgumentError, "No #{name} compiler available. Did you install it?"
return self if cls === @compiler
- raise "#{compiler} compiler already selected for this project" if @compiler
@compiler = cls.new(project, options)
from Array(cls.sources).map { |path| project.path_to(:source, usage, path) }.
select { |path| File.exist?(path) } if sources.empty?
Modified: buildr/trunk/spec/core/compile_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/core/compile_spec.rb?rev=930479&r1=930478&r2=930479&view=diff
==============================================================================
--- buildr/trunk/spec/core/compile_spec.rb (original)
+++ buildr/trunk/spec/core/compile_spec.rb Sat Apr 3 05:40:09 2010
@@ -102,8 +102,17 @@ describe Buildr::CompileTask do
lambda { define('foo') { compile.using(:unknown) } }.should raise_error(ArgumentError, /unknown compiler/i)
end
- it 'should only allow setting the compiler once' do
- lambda { define('foo') { compile.using(:javac).using(:scalac) } }.should raise_error(RuntimeError, /already selected/i)
+ it 'should allow overriding the guessed compiler' do
+ write "src/main/java/com/example/Hello.java", ""
+ old_compiler = nil
+ new_compiler = nil
+ define('foo') {
+ old_compiler = compile.compiler
+ compile.using(:scalac)
+ new_compiler = compile.compiler
+ }
+ old_compiler.should == :javac
+ new_compiler.should == :scalac
end
end