forax / pro

A Java build tool that works seamlessly with modules
GNU General Public License v3.0
103 stars 15 forks source link

Specify source file encoding #3

Closed sormuras closed 7 years ago

sormuras commented 7 years ago

How do I pass a VM option like -Dfile.encoding=UTF-8 to the compiler?

sormuras commented 7 years ago

Forking and building "pro" works like a charm, so I just did a quick CompilerPlugin.java hack:

    CmdLine cmdLine = gatherAll(JavacOption.class, option -> option.action).apply(javac, new CmdLine());
    cmdLine.addAll("-encoding", "UTF-8");
forax commented 7 years ago

Hi Christian, i've just added an option rawArguments to the compiler plugin, so in the JSON, this snippet should work compiler: { rawArguments: [ "-Dfile.encoding=UTF8" ] }

let me know if it works for you

sormuras commented 7 years ago

Ho Rémi! Thanks for the quick fix. I like the .pro/shell syntax more:

set("compiler.rawArguments", list(
     "-encoding", "UTF8"
));