Skip to content

Instantly share code, notes, and snippets.

@eugene-sy
Created December 20, 2018 13:29
Show Gist options
  • Save eugene-sy/6d637290c9c178bbd8d156c69a51ff43 to your computer and use it in GitHub Desktop.
Save eugene-sy/6d637290c9c178bbd8d156c69a51ff43 to your computer and use it in GitHub Desktop.
Gradle - Scapegoat integration
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Scala library project to get you started.
* For more details take a look at the Scala plugin chapter in the Gradle
* user guide available at https://docs.gradle.org/5.0/userguide/scala_plugin.html
*/
plugins {
// Apply the scala plugin to add support for Scala
id 'scala'
}
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}
dependencies {
// Use Scala 2.12 in our library project
implementation 'org.scala-lang:scala-library:2.12.7'
// Use Scalatest for testing our library
testImplementation 'junit:junit:4.12'
testImplementation 'org.scalatest:scalatest_2.12:3.0.5'
// Scapegoat
compile 'com.sksamuel.scapegoat:scalac-scapegoat-plugin_2.12:1.3.3' // to prevent https://github.com/sksamuel/scapegoat/issues/98
// Need scala-xml at test runtime
testCompile 'org.scala-lang.modules:scala-xml_2.12:1.1.1'
}
configurations {
scalaCompilerPlugin
}
dependencies {
scalaCompilerPlugin "com.sksamuel.scapegoat:scalac-scapegoat-plugin_2.12:1.3.3"
}
tasks.withType(ScalaCompile) {
scalaCompileOptions.additionalParameters = [
"-Xplugin:" + configurations.scalaCompilerPlugin.asPath,
"-P:scapegoat:dataDir:" + buildDir + "/scapegoat",
"-P:scapegoat:reports:all"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment