Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle Scala Plugin corollary to addCompilerPlugin in sbt

What is the best way to add a Scala compiler plugin to the scalaCompile task in Gradle?

like image 320
vergenzt Avatar asked Feb 16 '16 18:02

vergenzt


1 Answers

  1. Add a configuration for compiler plugins: configurations { scalaCompilerPlugin }

  2. Add compiler plugin dependencies: dependencies { scalaCompilerPlugin "org.scalamacros:paradise_2.11.7:2.1.0" }

  3. Set up the option: tasks.withType(ScalaCompile) { scalaCompileOptions.additionalParameters = [ "-Xplugin:" + configurations.scalaCompilerPlugin.asPath ] }

I was able to use Macro Paradise in a Gradle-built project with this setup.

like image 177
vergenzt Avatar answered Oct 26 '22 15:10

vergenzt