buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jyri Kytömäki (JIRA) <j...@apache.org>
Subject [jira] Updated: (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
Date Thu, 05 Aug 2010 10:56:16 GMT

     [ https://issues.apache.org/jira/browse/BUILDR-489?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jyri Kytömäki updated BUILDR-489:
---------------------------------

    Environment: 
Windows XP
Java 1.6
Scala 2.8
JRuby 1.4.0

  was:
Windows XP
java 1.6
scala 2.8

    Description: 
Scalac compiler does not pass options for javac.
So if encoding option is set :

compile.options.other = %w{-encoding utf-8}

That option is not passed to javac which fails if some java source files contain special characters.

I fixed the issue in our environment like this:

--- a/project/vendor/jruby-1.4.0/lib/ruby/gems/1.8/gems/buildr-1.4.1-java/lib/buildr/scala/compiler.rb
+++ b/project/vendor/jruby-1.4.0/lib/ruby/gems/1.8/gems/buildr-1.4.1-java/lib/buildr/scala/compiler.rb
@@ -152,12 +152,13 @@ module Buildr::Scala
 
     def initialize(project, options) #:nodoc:
       super
+      # use common options also for javac
+      options[:javac] ||= { :warnings => options[:warnings], :debug => options[:debug],
:deprecation => options[:deprecation], :source => options[:source], :target => options[:target],
:other => options[:other] }
       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.compatible_28?
-      options[:javac] ||= {}
 
       @java = Javac.new(project, options[:javac])
     end
--



  was:
Scalac compiler does not pass options for javac.
So if encoding option is set . For isntance:

compile.options.other = %w{-encoding utf-8}

That option is not passed to javac which failes if java source contains special characters.

I fixed the issue in our environment like this:

--- a/project/vendor/jruby-1.4.0/lib/ruby/gems/1.8/gems/buildr-1.4.1-java/lib/buildr/scala/compiler.rb
+++ b/project/vendor/jruby-1.4.0/lib/ruby/gems/1.8/gems/buildr-1.4.1-java/lib/buildr/scala/compiler.rb
@@ -152,12 +152,13 @@ module Buildr::Scala
 
     def initialize(project, options) #:nodoc:
       super
+      # use common options also for javac
+      options[:javac] ||= { :warnings => options[:warnings], :debug => options[:debug],
:deprecation => options[:deprecation], :source => options[:source], :target => options[:target],
:other => options[:other] }
       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.compatible_28?
-      options[:javac] ||= {}
 
       @java = Javac.new(project, options[:javac])
     end
--




> Java + Scala joint compiler fails if  default encoding and source file encoding are not
same and special characters have been used in source code
> -------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: BUILDR-489
>                 URL: https://issues.apache.org/jira/browse/BUILDR-489
>             Project: Buildr
>          Issue Type: Bug
>          Components: Compilers
>    Affects Versions: 1.4.1
>         Environment: Windows XP
> Java 1.6
> Scala 2.8
> JRuby 1.4.0
>            Reporter: Jyri Kytömäki
>
> Scalac compiler does not pass options for javac.
> So if encoding option is set :
> compile.options.other = %w{-encoding utf-8}
> That option is not passed to javac which fails if some java source files contain special
characters.
> I fixed the issue in our environment like this:
> --- a/project/vendor/jruby-1.4.0/lib/ruby/gems/1.8/gems/buildr-1.4.1-java/lib/buildr/scala/compiler.rb
> +++ b/project/vendor/jruby-1.4.0/lib/ruby/gems/1.8/gems/buildr-1.4.1-java/lib/buildr/scala/compiler.rb
> @@ -152,12 +152,13 @@ module Buildr::Scala
>  
>      def initialize(project, options) #:nodoc:
>        super
> +      # use common options also for javac
> +      options[:javac] ||= { :warnings => options[:warnings], :debug => options[:debug],
:deprecation => options[:deprecation], :source => options[:source], :target => options[:target],
:other => options[:other] }
>        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.compatible_28?
> -      options[:javac] ||= {}
>  
>        @java = Javac.new(project, options[:javac])
>      end
> --

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message