Skip to content

Instantly share code, notes, and snippets.

@DamianReeves
Created January 19, 2019 13:26
Show Gist options
  • Save DamianReeves/d8aaa55e834bcdfcad32f2d035ebc046 to your computer and use it in GitHub Desktop.
Save DamianReeves/d8aaa55e834bcdfcad32f2d035ebc046 to your computer and use it in GitHub Desktop.
Add Scala Compiler Plugins Using a Custom Config
tasks.withType(ScalaCompile){
// Map plugin jars to -Xplugin parameter
List<String> parameters =
configurations.scalaCompilerPlugin.files.collect {
'-Xplugin:'+ it.absolutePath
}
// Add existing parameters
List<String> existingParameters = scalaCompileOptions.additionalParameters
if (existingParameters) {
parameters.addAll(existingParameters)
}
// Add whatever flags you typically add
parameters += [
'-language:implicitConversions',
'-language:higherKinds'
]
// Finally set the additionalParameters
scalaCompileOptions.additionalParameters = parameters
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment