-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
89 lines (80 loc) · 3.36 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
import sbt._
import org.sonar.updatecenter.common.PluginManifest
name := "sonar-java-academic-plugin"
organization := "io.github.zukkari"
homepage := Some(url("https://github.com/Zukkari/sonar-java-academic-plugin"))
description := "Implementation of Java academic code smells for Sonar"
version := "0.1"
scalaVersion := "2.13.0"
scalacOptions := Seq(
"-encoding", "utf8",
"-Xfatal-warnings",
"-deprecation",
"-language:higherKinds",
)
resolvers += "Sonar Java extracted" at "https://kodu.ut.ee/~stan96/maven_repo/"
// Dependencies
val sonarVersion = "7.9"
libraryDependencies ++= List(
"org.scala-lang" % "scala-library" % "2.13.0",
"org.sonarsource.sonarqube" % "sonar-plugin-api" % sonarVersion % Provided,
"org.slf4j" % "slf4j-api" % "1.7.28" % Provided,
"org.sonarsource.java" % "sonar-java-plugin" % "5.14.0.18788" % Provided,
"org.sonarsource.sslr" % "sslr-core" % "1.23",
"io.github.zukkari" % "sonar-java-plugin-extracted" % "1.6",
"org.typelevel" %% "cats-core" % "2.0.0",
"org.typelevel" %% "cats-effect" % "2.0.0",
"io.circe" %% "circe-parser" % "0.13.0",
"io.circe" %% "circe-core" % "0.13.0",
"io.circe" %% "circe-generic" % "0.13.0",
"org.scala-graph" %% "graph-core" % "1.13.1",
"org.scalatest" %% "scalatest" % "3.2.0-M1" % Test,
"org.mockito" %% "mockito-scala" % "1.5.17" % Test,
"org.scalatestplus" %% "scalatestplus-mockito" % "1.0.0-M2" % Test,
"org.sonarsource.java" % "java-checks-testkit" % "5.14.0.18788" % Test,
)
// Manifest attributes
packageOptions in(Compile, packageBin) += Package.ManifestAttributes(
PluginManifest.KEY -> "sonar-java-academic-plugin",
PluginManifest.NAME -> "Sonar Java academic plugin",
PluginManifest.DESCRIPTION -> description.value,
PluginManifest.HOMEPAGE -> "https://github.com/Zukkari/sonar-java-academic-plugin",
PluginManifest.SOURCES_URL -> "https://github.com/Zukkari/sonar-java-academic-plugin",
PluginManifest.ISSUE_TRACKER_URL -> "https://github.com/Zukkari/sonar-java-academic-plugin/issues",
PluginManifest.ORGANIZATION -> "Stanislav Mõškovski",
PluginManifest.ORGANIZATION_URL -> "https://github.com/Zukkari",
PluginManifest.DEVELOPERS -> "Stanislav Mõškovski",
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 -> "io.github.zukkari.SonarJavaAcademicPlugin",
PluginManifest.USE_CHILD_FIRST_CLASSLOADER -> "false"
)
def isSignatureFile(f: String): Boolean = {
f.endsWith("DSA") ||
f.endsWith("SF") ||
f.endsWith("RSA")
}
// 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 signed if isSignatureFile(signed)=> MergeStrategy.discard
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)
Test / parallelExecution := false