sbt-garrity-software/build.sbt

83 lines
2.2 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-garrity-software"
val Description: String = "SBT 1.9.0+ plugin for Garrity Software projects."
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.0-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(
"MIT" -> url("https://garrity.co/MIT.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,
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"
)
)