forked from sonar-scala/sonar-scala
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
121 lines (111 loc) · 4.27 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import com.mwz.sonar.scala.scapegoat.ScapegoatInspectionsGenerator
import org.sonar.updatecenter.common.PluginManifest
import sbt._
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._
import sbtrelease.Version.Bump.Minor
name := "sonar-scala"
organization := "com.github.mwz"
homepage := Some(url("https://github.com/mwz/sonar-scala"))
licenses := Seq("LGPL-3.0" -> url("https://opensource.org/licenses/lgpl-3.0.html"))
description := "Enables analysis of Scala projects with SonarQube."
// Compile options
scalaVersion := "2.12.6"
scalacOptions := Seq(
"-unchecked",
"-deprecation",
"-encoding",
"utf8",
"-feature",
"-language:reflectiveCalls"
)
javacOptions := Seq("-Xlint:deprecation")
cancelable in Global := true
scalafmtOnCompile in ThisBuild := true
scapegoatVersion in ThisBuild := "1.3.4"
scapegoatReports := Seq("xml")
coverageOutputXML := true
coverageOutputHTML := false
coverageOutputCobertura := false
// Add the Scpegoat inspections generator task to the compile source generators
sourceGenerators in Compile += ScapegoatInspectionsGenerator.generatorTask.taskValue
// Lib dependencies
val sonarVersion = "6.7"
libraryDependencies ++= List(
"org.sonarsource.sonarqube" % "sonar-core" % sonarVersion % Provided,
"org.sonarsource.sonarqube" % "sonar-plugin-api" % sonarVersion % Provided,
"org.slf4j" % "slf4j-api" % "1.7.25" % Provided,
"org.typelevel" %% "cats-core" % "1.1.0",
"org.scalariform" %% "scalariform" % "0.2.6",
"org.scalastyle" %% "scalastyle" % "1.0.0",
"com.google.guava" % "guava" % "23.0",
"org.scalatest" %% "scalatest" % "3.0.5" % Test,
"org.mockito" % "mockito-core" % "2.16.0" % Test
)
// Adding a resolver to the Artima maven repo, so sbt can download the Artima SuperSafe Scala compiler
resolvers += "Artima Maven Repository" at "http://repo.artima.com/releases"
// Manifest attributes
packageOptions in (Compile, packageBin) += Package.ManifestAttributes(
PluginManifest.KEY -> "scala",
PluginManifest.NAME -> "Scala",
PluginManifest.DESCRIPTION -> description.value,
PluginManifest.HOMEPAGE -> "https://github.com/mwz/sonar-scala",
PluginManifest.SOURCES_URL -> "https://github.com/mwz/sonar-scala",
PluginManifest.ISSUE_TRACKER_URL -> "https://github.com/mwz/sonar-scala/issues",
PluginManifest.ORGANIZATION -> "Michael Wizner",
PluginManifest.ORGANIZATION_URL -> "https://github.com/mwz",
PluginManifest.DEVELOPERS -> "Augustin Borsu, Michael Wizner",
PluginManifest.VERSION -> version.value,
PluginManifest.DISPLAY_VERSION -> version.value,
PluginManifest.SONAR_VERSION -> sonarVersion,
PluginManifest.LICENSE -> "GNU LGPL 3",
PluginManifest.SONARLINT_SUPPORTED -> "false",
PluginManifest.MAIN_CLASS -> "com.mwz.sonar.scala.ScalaPlugin",
PluginManifest.USE_CHILD_FIRST_CLASSLOADER -> "false"
)
// Assembly
test in assembly := {}
assemblyJarName in assembly := s"${name.value}-${version.value}.jar"
assemblyMergeStrategy in assembly := {
case "log4j.properties" => MergeStrategy.first
case "reference.conf" => MergeStrategy.concat
case "application.conf" => MergeStrategy.concat
case PathList("META-INF", xs @ _*) =>
xs match {
case ("MANIFEST.MF" :: Nil) => MergeStrategy.discard
case _ => MergeStrategy.first
}
case _ => MergeStrategy.first
}
artifact in (Compile, assembly) := {
val art = (artifact in (Compile, assembly)).value
art.withClassifier(Some("assembly"))
}
addArtifact(artifact in (Compile, assembly), assembly)
// Bintray
bintrayRepository := "maven"
bintrayPackage := "sonar-scala"
bintrayVcsUrl := Some("[email protected]:mwz/sonar-scala.git")
bintrayReleaseOnPublish := true
publishMavenStyle := true
publishArtifact in Test := false
pomIncludeRepository := (_ => false)
// Release
releaseVersionBump := Minor
releaseTagComment := s"Releasing ${(version in ThisBuild).value}. [ci skip]"
releaseCommitMessage := s"Setting version to ${(version in ThisBuild).value}. [ci skip]"
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
setReleaseVersion,
releaseStepTask(sonarScan),
commitReleaseVersion,
tagRelease,
publishArtifacts,
setNextVersion,
commitNextVersion,
pushChanges
)
// Test
parallelExecution in Test := false
logBuffered in Test := false
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-oDF")