saturday06 / gradle-android-scala-plugin

gradle-android-scala-plugin adds scala language support to official gradle android plugin
Apache License 2.0
342 stars 64 forks source link

Zinc invokes scalac to compile java mistakenly or I misconfigured something? #59

Open vmlinz opened 9 years ago

vmlinz commented 9 years ago

Hi, I'm converting a sbt android project to use gradle android scala. The source code contains java and scala.

For my working repo

  1. Here's the link to the working branch: https://github.com/vmlinz/shadowsocks-android/tree/gradle-dev
  2. And the log for ./gradlew compileDebugJava --debug:https://gist.github.com/vmlinz/0438a7301a24ca820a49
  3. From what I can tell from the debug log, the zinc compiler is compiling one of the java files with scalac, which causes the error.

    Experimenting repo

  4. My cloned repo: https://github.com/vmlinz/hello-scaloid-gradle, cloned from https://github.com/pocorall/hello-scaloid-gradle and add a directory of java sources.
  5. Log for the same command ./gradlew compileDebugJava --debug: https://gist.github.com/vmlinz/278b2ac854700f107bd6
  6. This time the compilation is correct

    The only difference between build.gralde and build.sbt

sbt enable the user to set zinc compiling order to javaThenScala but in gradle I cannot find a place to set the zinc compiling order so it is forced Mixed as we can see in the log.

And I'm not sure if the the sourceset for java will only be compiled with javac as expected and the sourceset for scala will be compiled with only scalac.

Thanks for the reading.

Br, Nick

celestialmachines commented 9 years ago

Temporary workaround for me was to add this to app/build.gradle

tasks.withType(ScalaCompile) { scalaCompileOptions.useAnt = true }

vmlinz commented 9 years ago

@bitcubate Thanks, I will try it.