-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This new major version aims to bring a new and hopefully cleaner project structure. The `scalaz` based configuration is moved to a different module to isolate better from the core. In the future a `cats` based version will be added as well. More core utilities were added and the old ones were brushed up for better consistency and clarity.
- Loading branch information
Showing
59 changed files
with
2,052 additions
and
902 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version = "2.1.0" | ||
maxColumn = 120 | ||
align = most | ||
continuationIndent.defnSite = 2 | ||
assumeStandardLibraryStripMargin = true | ||
docstrings = JavaDoc | ||
lineEndings = preserve | ||
includeCurlyBraceInSelectChains = false | ||
danglingParentheses = true | ||
spaces { | ||
inImportCurlyBraces = true | ||
} | ||
optIn.annotationNewlines = true | ||
|
||
rewrite.rules = [SortImports, RedundantBraces] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,116 +1,107 @@ | ||
|
||
name := "scala-utils" | ||
|
||
organization := "org.tupol" | ||
|
||
scalaVersion := "2.11.12" | ||
|
||
crossScalaVersions := Seq("2.11.12", "2.12.6") | ||
|
||
// ------------------------------ | ||
// DEPENDENCIES AND RESOLVERS | ||
|
||
updateOptions := updateOptions.value.withCachedResolution(true) | ||
|
||
libraryDependencies ++= Seq( | ||
"com.typesafe.scala-logging" % "scala-logging" % "3.9.0" cross CrossVersion.binary, | ||
"org.scala-lang" % "scala-reflect" % scalaVersion.value, | ||
"org.scalaz" % "scalaz-core" % "7.2.26" cross CrossVersion.binary, | ||
"org.scalacheck" % "scalacheck" % "1.14.0" % "test" cross CrossVersion.binary, | ||
"org.scalatest" % "scalatest" % "3.0.5" % "test" cross CrossVersion.binary, | ||
"com.typesafe" % "config" % "1.3.0" | ||
) | ||
// ------------------------------ | ||
// TESTING | ||
parallelExecution in Test := false | ||
|
||
fork in Test := true | ||
|
||
publishArtifact in Test := true | ||
|
||
// ------------------------------ | ||
// TEST COVERAGE | ||
|
||
scoverage.ScoverageKeys.coverageExcludedFiles := ".*BuildInfo.*" | ||
|
||
|
||
// ------------------------------ | ||
// PUBLISHING | ||
isSnapshot := version.value.trim.endsWith("SNAPSHOT") | ||
|
||
useGpg := true | ||
|
||
// Nexus (see https://www.scala-sbt.org/1.x/docs/Using-Sonatype.html) | ||
publishTo := { | ||
val repo = "https://oss.sonatype.org/" | ||
if (isSnapshot.value) | ||
Some("snapshots" at repo + "content/repositories/snapshots") | ||
else | ||
Some("releases" at repo + "service/local/staging/deploy/maven2") | ||
} | ||
|
||
publishArtifact in Test := true | ||
|
||
publishMavenStyle := true | ||
|
||
pomIncludeRepository := { x => false } | ||
|
||
|
||
licenses := Seq("MIT-style" -> url("https://opensource.org/licenses/MIT")) | ||
|
||
homepage := Some(url("https://github.com/tupol/scala-utils")) | ||
|
||
scmInfo := Some( | ||
ScmInfo( | ||
url("https://github.com/tupol/scala-utils.git"), | ||
"scm:[email protected]:tupol/scala-utils.git" | ||
import Dependencies.{Versions, _} | ||
import com.typesafe.sbt.SbtPgp.autoImportImpl.useGpg | ||
import sbt.Keys.{libraryDependencies, organization} | ||
import sbt.url | ||
import sbtbuildinfo.BuildInfoPlugin.autoImport.{buildInfoKeys, buildInfoOptions} | ||
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ | ||
|
||
lazy val publishSettings = Seq( | ||
isSnapshot := version.value.trim.endsWith("SNAPSHOT"), | ||
useGpg := true, | ||
// Nexus (see https://www.scala-sbt.org/1.x/docs/Using-Sonatype.html) | ||
publishTo := { | ||
val repo = "https://oss.sonatype.org/" | ||
if (isSnapshot.value) Some("snapshots" at repo + "content/repositories/snapshots") | ||
else Some("releases" at repo + "service/local/staging/deploy/maven2") | ||
}, | ||
publishArtifact in Test := true, | ||
publishMavenStyle := true, | ||
pomIncludeRepository := { x => false }, | ||
licenses := Seq("MIT-style" -> url("https://opensource.org/licenses/MIT")), | ||
homepage := Some(url("https://github.com/tupol/scala-utils")), | ||
scmInfo := Some( | ||
ScmInfo( | ||
url("https://github.com/tupol/scala-utils.git"), | ||
"scm:[email protected]:tupol/scala-utils.git" | ||
) | ||
), | ||
developers := List( | ||
Developer( | ||
id = "tupol", | ||
name = "Tupol", | ||
email = "[email protected]", | ||
url = url("https://github.com/tupol") | ||
) | ||
), | ||
releaseProcess := Seq[ReleaseStep]( | ||
checkSnapshotDependencies, // : ReleaseStep | ||
inquireVersions, // : ReleaseStep | ||
runClean, // : ReleaseStep | ||
runTest, // : ReleaseStep | ||
setReleaseVersion, // : ReleaseStep | ||
commitReleaseVersion, // : ReleaseStep, performs the initial git checks | ||
tagRelease, // : ReleaseStep | ||
releaseStepCommand(s"""sonatypeOpen "${organization.value}" "${name.value} v${version.value}""""), | ||
releaseStepCommand("+publishSigned"), | ||
releaseStepCommand("+sonatypeRelease"), | ||
setNextVersion, // : ReleaseStep | ||
commitNextVersion, // : ReleaseStep | ||
pushChanges // : ReleaseStep, also checks that an upstream branch is properly configured | ||
) | ||
) | ||
|
||
developers := List( | ||
Developer( | ||
id = "tupol", | ||
name = "Tupol", | ||
email = "[email protected]", | ||
url = url("https://github.com/tupol") | ||
) | ||
lazy val coverageSettings = Seq( | ||
coverageEnabled in Test := true, | ||
coverageMinimum in Test := 95, | ||
coverageFailOnMinimum in Test := true, | ||
coverageExcludedPackages := ".*BuildInfo.*" | ||
) | ||
lazy val basicSettings = Seq( | ||
organization := "org.tupol", | ||
name := "scala-utils", | ||
scalaVersion := Versions.scala, | ||
crossScalaVersions := Versions.crossScala, | ||
scalacOptions ++= Seq( | ||
"-feature", | ||
"-deprecation", | ||
"-unchecked", | ||
"-Ywarn-unused-import" | ||
), | ||
updateOptions := updateOptions.value.withCachedResolution(true), | ||
libraryDependencies ++= CoreTestDependencies, | ||
scoverage.ScoverageKeys.coverageExcludedFiles := ".*BuildInfo.*" | ||
|
||
import ReleaseTransformations._ | ||
releaseProcess := Seq[ReleaseStep]( | ||
checkSnapshotDependencies, // : ReleaseStep | ||
inquireVersions, // : ReleaseStep | ||
runClean, // : ReleaseStep | ||
runTest, // : ReleaseStep | ||
setReleaseVersion, // : ReleaseStep | ||
commitReleaseVersion, // : ReleaseStep, performs the initial git checks | ||
tagRelease, // : ReleaseStep | ||
releaseStepCommand(s"""sonatypeOpen "${organization.value}" "${name.value} v${version.value}""""), | ||
releaseStepCommand("+publishSigned"), | ||
releaseStepCommand("+sonatypeRelease"), | ||
setNextVersion, // : ReleaseStep | ||
commitNextVersion, // : ReleaseStep | ||
pushChanges // : ReleaseStep, also checks that an upstream branch is properly configured | ||
) | ||
val commonSettings = basicSettings ++ coverageSettings ++ publishSettings | ||
|
||
// ------------------------------ | ||
// BUILD-INFO | ||
lazy val root = (project in file(".")). | ||
enablePlugins(BuildInfoPlugin). | ||
settings( | ||
|
||
lazy val core = (project in file("core")) | ||
.enablePlugins(BuildInfoPlugin) | ||
.settings(commonSettings: _*) | ||
.settings( | ||
name := "scala-utils-core", | ||
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion), | ||
buildInfoPackage := "org.tupol.utils.info" | ||
buildInfoOptions := Seq[BuildInfoOption](BuildInfoOption.BuildTime, BuildInfoOption.ToMap, BuildInfoOption.ToJson), | ||
buildInfoPackage := "org.tupol.utils", | ||
libraryDependencies ++= CoreDependencies, | ||
publishArtifact in Test := true | ||
) | ||
|
||
buildInfoKeys ++= Seq[BuildInfoKey]( | ||
resolvers, | ||
libraryDependencies in Test, | ||
BuildInfoKey.map(name) { case (k, v) => "project" + k.capitalize -> v.capitalize }, | ||
BuildInfoKey.action("buildTime") { | ||
System.currentTimeMillis | ||
} // re-computed each time at compile | ||
) | ||
|
||
buildInfoOptions += BuildInfoOption.BuildTime | ||
buildInfoOptions += BuildInfoOption.ToMap | ||
buildInfoOptions += BuildInfoOption.ToJson | ||
lazy val config_z = (project in file("config-z")) | ||
.enablePlugins(BuildInfoPlugin) | ||
.settings(commonSettings: _*) | ||
.settings( | ||
name := "scala-utils-config-z", | ||
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion), | ||
buildInfoOptions := Seq[BuildInfoOption](BuildInfoOption.BuildTime, BuildInfoOption.ToMap, BuildInfoOption.ToJson), | ||
buildInfoPackage := "org.tupol.utils.config", | ||
libraryDependencies ++= ConfigZDependencies | ||
) | ||
.dependsOn(core % "test->test;compile->compile") | ||
|
||
lazy val scala_utils = Project( | ||
id = "scala-utils", | ||
base = file(".") | ||
).settings(commonSettings: _*) | ||
.dependsOn(core % "test->test;compile->compile", config_z) | ||
.aggregate(core, config_z) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.