mirror of https://github.com/sbt/sbt.git
in-source sbt-houserules
This commit is contained in:
parent
166511c992
commit
8c2aef75e4
25
build.sbt
25
build.sbt
|
|
@ -2,16 +2,25 @@ import Dependencies._
|
|||
import Util._
|
||||
import com.typesafe.tools.mima.core._, ProblemFilters._
|
||||
|
||||
ThisBuild / git.baseVersion := "1.3.0"
|
||||
ThisBuild / version := {
|
||||
val old = (ThisBuild / version).value
|
||||
nightlyVersion match {
|
||||
case Some(v) => v
|
||||
case _ =>
|
||||
if (old contains "SNAPSHOT") git.baseVersion.value + "-SNAPSHOT"
|
||||
else old
|
||||
case _ => old
|
||||
}
|
||||
}
|
||||
ThisBuild / organization := "org.scala-sbt"
|
||||
ThisBuild / bintrayPackage := "util"
|
||||
ThisBuild / homepage := Some(url("https://github.com/sbt/util"))
|
||||
ThisBuild / description := "Util modules for sbt"
|
||||
ThisBuild / scmInfo := Some(ScmInfo(url("https://github.com/sbt/util"), "git@github.com:sbt/util.git"))
|
||||
ThisBuild / licenses := List(("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0")))
|
||||
ThisBuild / scalafmtOnCompile := true
|
||||
ThisBuild / developers := List(
|
||||
Developer("harrah", "Mark Harrah", "@harrah", url("https://github.com/harrah")),
|
||||
Developer("eed3si9n", "Eugene Yokota", "@eed3si9n", url("http://eed3si9n.com/")),
|
||||
Developer("dwijnand", "Dale Wijnand", "@dwijnand", url("https://github.com/dwijnand")),
|
||||
)
|
||||
|
||||
def internalPath = file("internal")
|
||||
|
||||
|
|
@ -54,16 +63,10 @@ lazy val utilRoot: Project = (project in file("."))
|
|||
utilScripted
|
||||
)
|
||||
.settings(
|
||||
inThisBuild(
|
||||
Seq(
|
||||
bintrayPackage := "util",
|
||||
homepage := Some(url("https://github.com/sbt/util")),
|
||||
description := "Util module for sbt",
|
||||
scmInfo := Some(ScmInfo(url("https://github.com/sbt/util"), "git@github.com:sbt/util.git")),
|
||||
)),
|
||||
commonSettings,
|
||||
name := "Util Root",
|
||||
publish / skip := true,
|
||||
mimaPreviousArtifacts := Set.empty,
|
||||
customCommands
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
import sbt._
|
||||
import Keys._
|
||||
import bintray.BintrayPlugin
|
||||
import bintray.BintrayPlugin.autoImport._
|
||||
|
||||
object HouseRulesPlugin extends AutoPlugin {
|
||||
override def requires = plugins.JvmPlugin && BintrayPlugin
|
||||
override def trigger = allRequirements
|
||||
|
||||
override def buildSettings: Seq[Def.Setting[_]] = baseBuildSettings
|
||||
override def projectSettings: Seq[Def.Setting[_]] = baseSettings
|
||||
|
||||
lazy val baseBuildSettings: Seq[Def.Setting[_]] = Seq(
|
||||
bintrayOrganization := Some("sbt"),
|
||||
bintrayRepository := "maven-releases",
|
||||
)
|
||||
|
||||
lazy val baseSettings: Seq[Def.Setting[_]] = Seq(
|
||||
bintrayPackage := (ThisBuild / bintrayPackage).value,
|
||||
bintrayRepository := (ThisBuild / bintrayRepository).value,
|
||||
scalacOptions ++= Seq("-encoding", "utf8"),
|
||||
scalacOptions ++= Seq("-deprecation", "-feature", "-unchecked", "-Xlint"),
|
||||
scalacOptions += "-language:higherKinds",
|
||||
scalacOptions += "-language:implicitConversions",
|
||||
scalacOptions ++= "-Xfuture".ifScala213OrMinus.value.toList,
|
||||
scalacOptions += "-Xlint",
|
||||
scalacOptions ++= "-Xfatal-warnings"
|
||||
.ifScala(v => {
|
||||
sys.props.get("sbt.build.fatal") match {
|
||||
case Some(_) => java.lang.Boolean.getBoolean("sbt.build.fatal")
|
||||
case _ => v == 12
|
||||
}
|
||||
})
|
||||
.value
|
||||
.toList,
|
||||
scalacOptions ++= "-Yinline-warnings".ifScala211OrMinus.value.toList,
|
||||
scalacOptions ++= "-Yno-adapted-args".ifScala212OrMinus.value.toList,
|
||||
scalacOptions += "-Ywarn-dead-code",
|
||||
scalacOptions += "-Ywarn-numeric-widen",
|
||||
scalacOptions += "-Ywarn-value-discard",
|
||||
scalacOptions ++= "-Ywarn-unused-import".ifScala(v => 11 <= v && v <= 12).value.toList
|
||||
) ++ Seq(Compile, Test).flatMap(
|
||||
c => scalacOptions in (c, console) --= Seq("-Ywarn-unused-import", "-Xlint")
|
||||
)
|
||||
|
||||
private def scalaPartV = Def setting (CrossVersion partialVersion scalaVersion.value)
|
||||
|
||||
private implicit final class AnyWithIfScala[A](val __x: A) {
|
||||
def ifScala(p: Long => Boolean) =
|
||||
Def setting (scalaPartV.value collect { case (2, y) if p(y) => __x })
|
||||
def ifScalaLte(v: Long) = ifScala(_ <= v)
|
||||
def ifScalaGte(v: Long) = ifScala(_ >= v)
|
||||
def ifScala211OrMinus = ifScalaLte(11)
|
||||
def ifScala211OrPlus = ifScalaGte(11)
|
||||
def ifScala212OrMinus = ifScalaLte(12)
|
||||
def ifScala213OrMinus = ifScalaLte(13)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,7 @@
|
|||
addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.9")
|
||||
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.0.0")
|
||||
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.5")
|
||||
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0")
|
||||
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.6.1")
|
||||
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.0.3")
|
||||
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.4.4")
|
||||
addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.16")
|
||||
|
|
|
|||
Loading…
Reference in New Issue