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 2016/08/15 06:59:15 UTC

[2/2] buildr git commit: BUILDR-489 Java + Scala joint compiler fails if default encoding and source file encoding are not same and special characters have been used in source code

BUILDR-489 Java + Scala joint compiler fails if default encoding and source file encoding are not same and special characters have been used in source code


Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/e2f18acd
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/e2f18acd
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/e2f18acd

Branch: refs/heads/master
Commit: e2f18acdff4b1e13d077da0ff178c58fa1fe7f50
Parents: faa3118
Author: Antoine Toulme <an...@lunar-ocean.com>
Authored: Sun Aug 14 23:59:08 2016 -0700
Committer: Antoine Toulme <an...@lunar-ocean.com>
Committed: Sun Aug 14 23:59:08 2016 -0700

----------------------------------------------------------------------
 CHANGELOG                    | 1 +
 lib/buildr/scala/compiler.rb | 7 ++++++-
 spec/scala/compiler_spec.rb  | 9 +++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/e2f18acd/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 035005f..c4fed37 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -27,6 +27,7 @@
 * Fixed:  BUILDR-476 Buildr doesn't respect company repository manager
 * Fixed:  BUILDR-454 Definition-level parent-child references-by-name fail in 1.4.0 but not in 1.3.5. Submitted by Rhett Sutphin.
 * Fixed:  BUILDR-620 resources.filter should not run on non-text files
+* Fixed:  BUILDR-489 Java + Scala joint compiler fails if default encoding and source file encoding are not same and special characters have been used in source code
 * Change: Update the custom_pom addon to generate poms with exclusions section that excludes
           all transitive dependencies. This is required as buildr dependencies are not
           transitive while Maven's dependencies are transitive by default.

http://git-wip-us.apache.org/repos/asf/buildr/blob/e2f18acd/lib/buildr/scala/compiler.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/scala/compiler.rb b/lib/buildr/scala/compiler.rb
index 8846d1e..54bbafe 100644
--- a/lib/buildr/scala/compiler.rb
+++ b/lib/buildr/scala/compiler.rb
@@ -179,12 +179,17 @@ module Buildr::Scala
 
     def initialize(project, options) #:nodoc:
       super
+      # use common options also for javac
+      
+      options[:javac] ||= Buildr::Compiler::Javac::OPTIONS.inject({}) do |hash, option|
+        hash[option] = options[option]
+        hash
+      end
       options[:debug] = Buildr.options.debug if options[:debug].nil?
       options[:warnings] = verbose if options[:warnings].nil?
       options[:deprecation] ||= false
       options[:optimise] ||= false
       options[:make] ||= :transitivenocp if Scala.version? 2.8
-      options[:javac] ||= {}
       @java = Javac.new(project, options[:javac])
     end
 

http://git-wip-us.apache.org/repos/asf/buildr/blob/e2f18acd/spec/scala/compiler_spec.rb
----------------------------------------------------------------------
diff --git a/spec/scala/compiler_spec.rb b/spec/scala/compiler_spec.rb
index d1b795d..2c5206c 100644
--- a/spec/scala/compiler_spec.rb
+++ b/spec/scala/compiler_spec.rb
@@ -155,6 +155,11 @@ share_as :ScalacCompiler_CommonOptions do
     compile_task.using(:warnings=>false)
     scalac_args.should include('-nowarn')
   end
+  
+  it 'should pass options to javac' do
+    compile_task.using(:warnings=>false)
+    javac_args.should include('-nowarn')
+  end
 
   it 'should not use -nowarn argument when warnings is true' do
     compile_task.using(:warnings=>true)
@@ -278,6 +283,10 @@ describe 'scala compiler options' do
   def scalac_args
     compile_task.instance_eval { @compiler }.send(:scalac_args)
   end
+  
+  def javac_args
+    compile_task.instance_eval { @compiler }.instance_eval { @java }.send(:javac_args)
+  end
 
   # these specs fail. Somehow the compiler is still in version 2.8
   it 'should use -g:vars argument when debug option is true' do