mirror of https://github.com/sbt/sbt.git
in-source sbt-houserules
This commit is contained in:
parent
417de34779
commit
6f49065a56
|
|
@ -191,7 +191,7 @@ lazy val sbtRoot: Project = (project in file("."))
|
|||
commands in Global += Command
|
||||
.single("sbtOn")((state, dir) => s"sbtProj/test:runMain sbt.RunFromSourceMain $dir" :: state),
|
||||
mimaSettings,
|
||||
mimaPreviousArtifacts := Set()
|
||||
mimaPreviousArtifacts := Set.empty,
|
||||
)
|
||||
|
||||
// This is used to configure an sbt-launcher for this version of sbt.
|
||||
|
|
@ -1148,7 +1148,7 @@ def customCommands: Seq[Setting[_]] = Seq(
|
|||
ThisBuild / whitesourceProduct := "Lightbend Reactive Platform"
|
||||
ThisBuild / whitesourceAggregateProjectName := {
|
||||
// note this can get detached on tag build etc
|
||||
val b = (ThisBuild / git.gitCurrentBranch).value
|
||||
val b = sys.process.Process("git rev-parse --abbrev-ref HEAD").!!
|
||||
val Stable = """1\.([0-9]+)\.x""".r
|
||||
b match {
|
||||
case Stable(y) => "sbt-1." + y.toString + "-stable"
|
||||
|
|
|
|||
|
|
@ -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,7 +1,8 @@
|
|||
scalaVersion := "2.12.10"
|
||||
scalacOptions ++= Seq("-feature", "-language:postfixOps")
|
||||
|
||||
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("org.scalameta" % "sbt-scalafmt" % "2.0.2")
|
||||
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.4.1")
|
||||
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "3.0.2")
|
||||
|
|
|
|||
Loading…
Reference in New Issue