mirror of https://github.com/sbt/sbt.git
Merge pull request #322 from eed3si9n/wip/nohouse
in-source sbt-houserules
This commit is contained in:
commit
da6897b8a3
|
|
@ -4,7 +4,7 @@ group: stable
|
|||
language: scala
|
||||
|
||||
scala:
|
||||
- 2.12.8
|
||||
- 2.12.10
|
||||
|
||||
env:
|
||||
global:
|
||||
|
|
@ -30,9 +30,8 @@ install:
|
|||
- unset JAVA_HOME
|
||||
- java -Xmx32m -version
|
||||
# detect sbt version from project/build.properties
|
||||
# - export TRAVIS_SBT=$(grep sbt.version= project/build.properties | sed -e 's/sbt.version=//g' ) && echo "sbt $TRAVIS_SBT"
|
||||
# use 1.2.8 until 1.3.0 installer is out
|
||||
- export TRAVIS_SBT=1.2.8
|
||||
- export TRAVIS_SBT=$(grep sbt.version= project/build.properties | sed -e 's/sbt.version=//g' ) && echo "sbt $TRAVIS_SBT"
|
||||
# - export TRAVIS_SBT=1.3.3
|
||||
- sdk install sbt $TRAVIS_SBT
|
||||
# override Travis CI's SBT_OPTS
|
||||
- unset SBT_OPTS
|
||||
|
|
|
|||
61
build.sbt
61
build.sbt
|
|
@ -7,16 +7,28 @@ val _ = {
|
|||
sys.props += ("line.separator" -> "\n")
|
||||
}
|
||||
|
||||
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 := "librarymanagement"
|
||||
ThisBuild / homepage := Some(url("https://github.com/sbt/librarymanagement"))
|
||||
ThisBuild / description := "Library management module for sbt"
|
||||
ThisBuild / scmInfo := {
|
||||
val slug = "sbt/librarymanagement"
|
||||
Some(ScmInfo(url(s"https://github.com/$slug"), s"git@github.com:$slug.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")),
|
||||
)
|
||||
|
||||
ThisBuild / Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat
|
||||
|
||||
|
|
@ -65,6 +77,7 @@ val mimaSettings = Def settings (
|
|||
"1.1.3",
|
||||
"1.1.4",
|
||||
"1.2.0",
|
||||
"1.3.0",
|
||||
) map (
|
||||
version =>
|
||||
organization.value %% moduleName.value % version
|
||||
|
|
@ -75,24 +88,14 @@ val mimaSettings = Def settings (
|
|||
lazy val lmRoot = (project in file("."))
|
||||
.aggregate(lmCore, lmIvy)
|
||||
.settings(
|
||||
inThisBuild(
|
||||
Seq(
|
||||
homepage := Some(url("https://github.com/sbt/librarymanagement")),
|
||||
description := "Library management module for sbt",
|
||||
scmInfo := {
|
||||
val slug = "sbt/librarymanagement"
|
||||
Some(ScmInfo(url(s"https://github.com/$slug"), s"git@github.com:$slug.git"))
|
||||
},
|
||||
bintrayPackage := "librarymanagement",
|
||||
)
|
||||
),
|
||||
commonSettings,
|
||||
name := "LM Root",
|
||||
publish := {},
|
||||
publishLocal := {},
|
||||
publishArtifact in Compile := false,
|
||||
publishArtifact := false,
|
||||
customCommands
|
||||
mimaPreviousArtifacts := Set.empty,
|
||||
customCommands,
|
||||
)
|
||||
|
||||
lazy val lmCore = (project in file("core"))
|
||||
|
|
@ -330,19 +333,19 @@ lazy val lmIvy = (project in file("ivy"))
|
|||
),
|
||||
)
|
||||
|
||||
lazy val lmScriptedTest = (project in file("scripted-test"))
|
||||
.enablePlugins(SbtPlugin)
|
||||
.settings(
|
||||
commonSettings,
|
||||
skip in publish := true,
|
||||
name := "scripted-test",
|
||||
scriptedLaunchOpts := {
|
||||
scriptedLaunchOpts.value ++
|
||||
Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
|
||||
},
|
||||
scriptedBufferLog := false
|
||||
)
|
||||
.enablePlugins(SbtScriptedIT)
|
||||
// lazy val lmScriptedTest = (project in file("scripted-test"))
|
||||
// .enablePlugins(SbtPlugin)
|
||||
// .settings(
|
||||
// commonSettings,
|
||||
// skip in publish := true,
|
||||
// name := "scripted-test",
|
||||
// scriptedLaunchOpts := {
|
||||
// scriptedLaunchOpts.value ++
|
||||
// Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
|
||||
// },
|
||||
// scriptedBufferLog := false
|
||||
// )
|
||||
// .enablePlugins(SbtScriptedIT)
|
||||
|
||||
// we are updating the nightly process, so we are commenting this out for now
|
||||
// addCommandAlias("scriptedIvy", Seq(
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ import Keys._
|
|||
import sbt.contraband.ContrabandPlugin.autoImport._
|
||||
|
||||
object Dependencies {
|
||||
val scala212 = "2.12.8"
|
||||
val scala212 = "2.12.10"
|
||||
|
||||
def nightlyVersion: Option[String] = sys.props.get("sbt.build.version")
|
||||
|
||||
private val ioVersion = nightlyVersion.getOrElse("1.3.0-M16")
|
||||
private val utilVersion = nightlyVersion.getOrElse("1.3.0-M9")
|
||||
private val ioVersion = nightlyVersion.getOrElse("1.3.1")
|
||||
private val utilVersion = nightlyVersion.getOrElse("1.3.2")
|
||||
|
||||
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
|
||||
|
||||
|
|
|
|||
|
|
@ -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,108 +1,108 @@
|
|||
import sbt._
|
||||
import Keys._
|
||||
// import sbt._
|
||||
// import Keys._
|
||||
|
||||
import java.io.File
|
||||
import java.util.UUID.randomUUID
|
||||
// import java.io.File
|
||||
// import java.util.UUID.randomUUID
|
||||
|
||||
object SbtScriptedIT extends AutoPlugin {
|
||||
// object SbtScriptedIT extends AutoPlugin {
|
||||
|
||||
object autoImport {
|
||||
val scriptedTestSbtRepo = settingKey[String]("SBT repository to be used in scripted tests")
|
||||
val scriptedTestSbtRef = settingKey[String]("SBT branch to be used in scripted tests")
|
||||
val scriptedTestLMImpl = settingKey[String]("Librarymanagement implementation to be used in scripted tests")
|
||||
val scriptedSbtVersion = settingKey[String]("SBT version to be published locally for IT tests")
|
||||
}
|
||||
// object autoImport {
|
||||
// val scriptedTestSbtRepo = settingKey[String]("SBT repository to be used in scripted tests")
|
||||
// val scriptedTestSbtRef = settingKey[String]("SBT branch to be used in scripted tests")
|
||||
// val scriptedTestLMImpl = settingKey[String]("Librarymanagement implementation to be used in scripted tests")
|
||||
// val scriptedSbtVersion = settingKey[String]("SBT version to be published locally for IT tests")
|
||||
// }
|
||||
|
||||
import autoImport._
|
||||
override def requires = ScriptedPlugin
|
||||
// import autoImport._
|
||||
// override def requires = ScriptedPlugin
|
||||
|
||||
override def trigger = noTrigger
|
||||
// override def trigger = noTrigger
|
||||
|
||||
override lazy val globalSettings = Seq(
|
||||
scriptedTestSbtRepo := "https://github.com/sbt/sbt.git",
|
||||
scriptedTestSbtRef := "develop",
|
||||
scriptedTestLMImpl := "ivy",
|
||||
scriptedSbtVersion := s"""${sbtVersion.value}-LM-SNAPSHOT"""
|
||||
)
|
||||
// override lazy val globalSettings = Seq(
|
||||
// scriptedTestSbtRepo := "https://github.com/sbt/sbt.git",
|
||||
// scriptedTestSbtRef := "develop",
|
||||
// scriptedTestLMImpl := "ivy",
|
||||
// scriptedSbtVersion := s"""${sbtVersion.value}-LM-SNAPSHOT"""
|
||||
// )
|
||||
|
||||
private def cloneSbt(targetDir: File, repo: String, ref: String) = {
|
||||
import org.eclipse.jgit.api._
|
||||
// private def cloneSbt(targetDir: File, repo: String, ref: String) = {
|
||||
// import org.eclipse.jgit.api._
|
||||
|
||||
if (!targetDir.exists) {
|
||||
IO.createDirectory(targetDir)
|
||||
// if (!targetDir.exists) {
|
||||
// IO.createDirectory(targetDir)
|
||||
|
||||
new CloneCommand()
|
||||
.setDirectory(targetDir)
|
||||
.setURI(repo)
|
||||
.call()
|
||||
// new CloneCommand()
|
||||
// .setDirectory(targetDir)
|
||||
// .setURI(repo)
|
||||
// .call()
|
||||
|
||||
val git = Git.open(targetDir)
|
||||
// val git = Git.open(targetDir)
|
||||
|
||||
git.checkout().setName(ref).call()
|
||||
}
|
||||
}
|
||||
// git.checkout().setName(ref).call()
|
||||
// }
|
||||
// }
|
||||
|
||||
private def publishLocalSbt(
|
||||
targetDir: File,
|
||||
lmVersion: String,
|
||||
lmGroupID: String,
|
||||
lmArtifactID: String,
|
||||
version: String) = {
|
||||
import sys.process._
|
||||
Process(
|
||||
Seq(
|
||||
"sbt",
|
||||
"-J-Xms2048m",
|
||||
"-J-Xmx2048m",
|
||||
"-J-XX:ReservedCodeCacheSize=256m",
|
||||
"-J-XX:MaxMetaspaceSize=512m",
|
||||
s"""-Dsbt.build.lm.version=${lmVersion}""",
|
||||
s"""-Dsbt.build.lm.organization=${lmGroupID}""",
|
||||
s"""-Dsbt.build.lm.moduleName=${lmArtifactID}""",
|
||||
s"""set ThisBuild / version := "${version}"""",
|
||||
"clean",
|
||||
"publishLocal"
|
||||
),
|
||||
Some(targetDir)
|
||||
) !
|
||||
}
|
||||
// private def publishLocalSbt(
|
||||
// targetDir: File,
|
||||
// lmVersion: String,
|
||||
// lmGroupID: String,
|
||||
// lmArtifactID: String,
|
||||
// version: String) = {
|
||||
// import sys.process._
|
||||
// Process(
|
||||
// Seq(
|
||||
// "sbt",
|
||||
// "-J-Xms2048m",
|
||||
// "-J-Xmx2048m",
|
||||
// "-J-XX:ReservedCodeCacheSize=256m",
|
||||
// "-J-XX:MaxMetaspaceSize=512m",
|
||||
// s"""-Dsbt.build.lm.version=${lmVersion}""",
|
||||
// s"""-Dsbt.build.lm.organization=${lmGroupID}""",
|
||||
// s"""-Dsbt.build.lm.moduleName=${lmArtifactID}""",
|
||||
// s"""set ThisBuild / version := "${version}"""",
|
||||
// "clean",
|
||||
// "publishLocal"
|
||||
// ),
|
||||
// Some(targetDir)
|
||||
// ) !
|
||||
// }
|
||||
|
||||
private def setScriptedTestsSbtVersion(baseDir: File, version: String) = {
|
||||
IO.listFiles(baseDir).foreach { d =>
|
||||
if (d.isDirectory) {
|
||||
IO.createDirectory(d / "project")
|
||||
IO.write(
|
||||
d / "project" / "build.properties",
|
||||
s"sbt.version=$version"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
// private def setScriptedTestsSbtVersion(baseDir: File, version: String) = {
|
||||
// IO.listFiles(baseDir).foreach { d =>
|
||||
// if (d.isDirectory) {
|
||||
// IO.createDirectory(d / "project")
|
||||
// IO.write(
|
||||
// d / "project" / "build.properties",
|
||||
// s"sbt.version=$version"
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
import sbt.ScriptedPlugin.autoImport._
|
||||
// import sbt.ScriptedPlugin.autoImport._
|
||||
|
||||
override lazy val projectSettings = Seq(
|
||||
scriptedTests := {
|
||||
val targetDir = target.value / "sbt"
|
||||
// override lazy val projectSettings = Seq(
|
||||
// scriptedTests := {
|
||||
// val targetDir = target.value / "sbt"
|
||||
|
||||
if (!targetDir.exists) {
|
||||
cloneSbt(targetDir, scriptedTestSbtRepo.value, scriptedTestSbtRef.value)
|
||||
// if (!targetDir.exists) {
|
||||
// cloneSbt(targetDir, scriptedTestSbtRepo.value, scriptedTestSbtRef.value)
|
||||
|
||||
publishLocalSbt(
|
||||
targetDir,
|
||||
version.value,
|
||||
organization.value,
|
||||
s"librarymanagement-${scriptedTestLMImpl.value}",
|
||||
scriptedSbtVersion.value
|
||||
)
|
||||
}
|
||||
// publishLocalSbt(
|
||||
// targetDir,
|
||||
// version.value,
|
||||
// organization.value,
|
||||
// s"librarymanagement-${scriptedTestLMImpl.value}",
|
||||
// scriptedSbtVersion.value
|
||||
// )
|
||||
// }
|
||||
|
||||
setScriptedTestsSbtVersion(
|
||||
sbtTestDirectory.value / thisProject.value.id,
|
||||
scriptedSbtVersion.value
|
||||
)
|
||||
// setScriptedTestsSbtVersion(
|
||||
// sbtTestDirectory.value / thisProject.value.id,
|
||||
// scriptedSbtVersion.value
|
||||
// )
|
||||
|
||||
scriptedTests.value
|
||||
}
|
||||
)
|
||||
}
|
||||
// scriptedTests.value
|
||||
// }
|
||||
// )
|
||||
// }
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
sbt.version=1.3.0-M3
|
||||
sbt.version=1.3.3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.9")
|
||||
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.0.0")
|
||||
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.2")
|
||||
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.4.2")
|
||||
addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.14")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue