86 lines
2.3 KiB
Scala
86 lines
2.3 KiB
Scala
ThisBuild / organizationName := "garrity software"
|
|
ThisBuild / organization := "gs"
|
|
ThisBuild / versionScheme := Some("semver-spec")
|
|
|
|
externalResolvers := Seq(
|
|
"Garrity Software Releases" at "https://maven.garrity.co/gs",
|
|
"Garrity Software Maven Mirror" at "https://maven.garrity.co/releases"
|
|
)
|
|
|
|
val ProjectName: String = "sbt-gs-calver"
|
|
val Description: String = "SBT 1.9.0+ plugin for calendar versioning."
|
|
|
|
def getProperty[A](
|
|
name: String,
|
|
conv: String => A
|
|
): Option[A] =
|
|
Option(System.getProperty(name)).map(conv)
|
|
|
|
val VersionProperty: String = "version"
|
|
val ReleaseProperty: String = "release"
|
|
|
|
lazy val InputVersion: Option[String] =
|
|
getProperty(VersionProperty, identity)
|
|
|
|
lazy val IsRelease: Boolean =
|
|
getProperty(ReleaseProperty, _.toBoolean).getOrElse(false)
|
|
|
|
lazy val Modifier: String =
|
|
if (IsRelease) "" else "-SNAPSHOT"
|
|
|
|
val DefaultVersion: String = "0.1.3-SNAPSHOT"
|
|
|
|
lazy val SelectedVersion: String =
|
|
InputVersion
|
|
.map(v => s"$v$Modifier")
|
|
.getOrElse(DefaultVersion)
|
|
|
|
lazy val publishSettings = Seq(
|
|
publishMavenStyle := true,
|
|
Test / publishArtifact := false,
|
|
pomIncludeRepository := Function.const(false),
|
|
scmInfo := Some(
|
|
ScmInfo(
|
|
url(s"https://git.garrity.co/garrity-software/$ProjectName"),
|
|
s"git@git.garrity.co:garrity-software/$ProjectName.git"
|
|
)
|
|
),
|
|
description := Description,
|
|
licenses := List(
|
|
"Apache 2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.html")
|
|
),
|
|
homepage := Some(
|
|
url(s"https://git.garrity.co/garrity-software/$ProjectName")
|
|
),
|
|
publishTo := {
|
|
val repo = "https://maven.garrity.co/"
|
|
if (!IsRelease)
|
|
Some("Garrity Software Maven" at repo + "snapshots")
|
|
else
|
|
Some("Garrity Software Maven" at repo + "gs")
|
|
}
|
|
)
|
|
|
|
lazy val root = Project(ProjectName, file("."))
|
|
.enablePlugins(SbtPlugin)
|
|
.settings(publishSettings)
|
|
.settings(
|
|
name := ProjectName,
|
|
version := SelectedVersion,
|
|
libraryDependencies ++= Seq(
|
|
"com.lihaoyi" %% "os-lib" % "0.9.3"
|
|
),
|
|
pluginCrossBuild / sbtVersion := {
|
|
scalaBinaryVersion.value match {
|
|
// Minimum SBT version compatible with this plugin.
|
|
case "2.12" => "1.9.0"
|
|
}
|
|
},
|
|
scalacOptions := Seq(
|
|
"-unchecked",
|
|
"-deprecation",
|
|
"-feature",
|
|
"-encoding",
|
|
"utf8"
|
|
)
|
|
)
|