-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sbt
More file actions
110 lines (99 loc) · 6.68 KB
/
build.sbt
File metadata and controls
110 lines (99 loc) · 6.68 KB
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
import ExtraReleaseKeys._
import java.net.URL
organization := "pt.tecnico.dsi"
name := "kadmin"
// ======================================================================================================================
// ==== Compile Options =================================================================================================
// ======================================================================================================================
javacOptions ++= Seq("-Xlint", "-encoding", "UTF-8", "-Dfile.encoding=utf-8")
scalaVersion := "2.12.3"
scalacOptions ++= Seq(
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"-encoding", "utf-8", // Specify character encoding used by source files.
"-explaintypes", // Explain type errors in more detail.
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
"-language:implicitConversions", // Explicitly enables the implicit conversions feature
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access.
"-Xfatal-warnings", // Fail the compilation if there are any warnings.
"-Xfuture", // Turn on future language features.
"-Ypartial-unification", // Enable partial unification in type constructor inference
"-Yno-adapted-args", // Do not adapt an argument list (either by inserting () or creating a tuple) to match the receiver.
"-Xlint", // Enables every warning. scala -Xlint:help for a list and explanation
//"-Xlint:-unused,_", // Enables every warning except "unused"
"-Ywarn-dead-code", // Warn when dead code is identified.
"-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined.
"-Ywarn-numeric-widen", // Warn when numerics are widened.
"-Ywarn-unused:imports", // Warn if an import selector is not referenced.
"-Ywarn-unused:patvars", // Warn if a variable bound in a pattern is unused.
"-Ywarn-unused:privates", // Warn if a private member is unused.
"-Ywarn-unused:locals", // Warn if a local definition is unused.
"-Ywarn-unused:params", // Warn if a value parameter is unused.
"-Ywarn-unused:implicits", // Warn if an implicit parameter is unused.
//"-Ywarn-value-discard", // Warn when non-Unit expression results are unused.
)
// These lines ensure that in sbt console or sbt test:console the -Ywarn* and the -Xfatal-warning are not bothersome.
// https://stackoverflow.com/questions/26940253/in-sbt-how-do-you-override-scalacoptions-for-console-in-all-configurations
scalacOptions in (Compile, console) ~= (_ filterNot { option =>
option.startsWith("-Ywarn") || option == "-Xfatal-warnings"
})
scalacOptions in (Test, console) := (scalacOptions in (Compile, console)).value
// ======================================================================================================================
// ==== Dependencies ====================================================================================================
// ======================================================================================================================
libraryDependencies ++= Seq(
"com.typesafe" % "config" % "1.3.1",
"joda-time" % "joda-time" % "2.9.9",
"work.martins.simon" %% "scala-expect" % "7.0.0-SNAPSHOT" changing(),
//"work.martins.simon" %% "scala-expect" % "6.0.0",
"ch.qos.logback" % "logback-classic" % "1.2.3" % Test,
"org.scalatest" %% "scalatest" % "3.0.4" % Test,
)
// Needed for scoverage snapshot
resolvers += Opts.resolver.sonatypeSnapshots
// ======================================================================================================================
// ==== Scaladoc ========================================================================================================
// ======================================================================================================================
autoAPIMappings := true // Tell scaladoc to look for API documentation of managed dependencies in their metadata.
scalacOptions in (Compile, doc) ++= Seq(
"-diagrams", // Create inheritance diagrams for classes, traits and packages.
"-groups", // Group similar functions together (based on the @group annotation)
"-implicits", // Document members inherited by implicit conversions.
"-doc-source-url", s"${homepage.value.get}/tree/v${latestReleasedVersion.value}€{FILE_PATH}.scala",
"-sourcepath", (baseDirectory in ThisBuild).value.getAbsolutePath,
)
// Define the base URL for the Scaladocs for your library. This will enable clients of your library to automatically
// link against the API documentation using autoAPIMappings.
apiURL := Some(url(s"${homepage.value.get}/${latestReleasedVersion.value}/api/"))
enablePlugins(GhpagesPlugin)
enablePlugins(SiteScaladocPlugin)
git.remoteRepo := s"git@github.com:ist-dsi/${name.value}.git"
// ======================================================================================================================
// ==== Deployment ======================================================================================================
// ======================================================================================================================
publishTo := Some(if (isSnapshot.value) Opts.resolver.sonatypeSnapshots else Opts.resolver.sonatypeStaging)
sonatypeProfileName := organization.value
licenses += "MIT" -> url("http://opensource.org/licenses/MIT")
homepage := Some(url(s"https://github.com/ist-dsi/${name.value}"))
scmInfo := Some(ScmInfo(homepage.value.get, s"git@github.com:ist-dsi/${name.value}.git"))
developers += Developer("Lasering", "Simão Martins", "", new URL("https://github.com/Lasering"))
// Will fail the build/release if updates for the dependencies are found
dependencyUpdatesFailBuild := true
coverageFailOnMinimum := true
coverageMinimum := 90
import ReleaseTransformations._
releaseProcess := Seq[ReleaseStep](
releaseStepCommand("dependencyUpdates"),
checkSnapshotDependencies,
inquireVersions,
runClean,
releaseStepCommand("doc"),
releaseStepCommand("""eval scala.sys.process.Process("./test.sh").!"""),
setReleaseVersion,
tagRelease,
//releaseStepCommand("ghpagesPushSite"),
releaseStepCommand("publishSigned"),
releaseStepCommand("sonatypeRelease"), // This step is not needed if the release is a snapshot
pushChanges,
writeVersions,
)