mirror of https://github.com/sbt/sbt.git
Add props to define source dependency on io
Use either -Dsbtio.path on the command line or sbtio.path= in project/local.properties
This commit is contained in:
parent
ea56f331a1
commit
0d86bbdd0e
18
build.sbt
18
build.sbt
|
|
@ -83,8 +83,9 @@ lazy val utilComplete = (project in internalPath / "util-complete").
|
|||
settings(
|
||||
commonSettings,
|
||||
name := "Util Completion",
|
||||
libraryDependencies ++= Seq(jline, sbtIO)
|
||||
)
|
||||
libraryDependencies += jline
|
||||
).
|
||||
configure(addSbtIO)
|
||||
|
||||
// logging
|
||||
lazy val utilLogging = (project in internalPath / "util-logging").
|
||||
|
|
@ -117,9 +118,10 @@ lazy val utilCache = (project in internalPath / "util-cache").
|
|||
settings(
|
||||
commonSettings,
|
||||
name := "Util Cache",
|
||||
libraryDependencies ++= Seq(sjsonnew, scalaReflect.value, sbtIO),
|
||||
libraryDependencies ++= Seq(sjsonnew, scalaReflect.value),
|
||||
libraryDependencies += sjsonnewScalaJson % Test
|
||||
)
|
||||
).
|
||||
configure(addSbtIO)
|
||||
|
||||
// Builds on cache to provide caching for filesystem-related operations
|
||||
lazy val utilTracking = (project in internalPath / "util-tracking").
|
||||
|
|
@ -127,9 +129,9 @@ lazy val utilTracking = (project in internalPath / "util-tracking").
|
|||
settings(
|
||||
commonSettings,
|
||||
name := "Util Tracking",
|
||||
libraryDependencies += sbtIO,
|
||||
libraryDependencies += sjsonnewScalaJson % Test
|
||||
)
|
||||
).
|
||||
configure(addSbtIO)
|
||||
|
||||
// Internal utility for testing
|
||||
lazy val utilTesting = (project in internalPath / "util-testing").
|
||||
|
|
@ -144,12 +146,12 @@ lazy val utilScripted = (project in internalPath / "util-scripted").
|
|||
settings(
|
||||
commonSettings,
|
||||
name := "Util Scripted",
|
||||
libraryDependencies += sbtIO,
|
||||
libraryDependencies ++= {
|
||||
if (scalaVersion.value startsWith "2.11") Seq(parserCombinator211)
|
||||
else Seq()
|
||||
}
|
||||
)
|
||||
).
|
||||
configure(addSbtIO)
|
||||
|
||||
def customCommands: Seq[Setting[_]] = Seq(
|
||||
commands += Command.command("release") { state =>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,26 @@ object Dependencies {
|
|||
lazy val scala211 = "2.11.8"
|
||||
lazy val scala212 = "2.12.0-M4"
|
||||
|
||||
lazy val sbtIO = "org.scala-sbt" %% "io" % "1.0.0-M6"
|
||||
private lazy val sbtIO = "org.scala-sbt" %% "io" % "1.0.0-M6"
|
||||
|
||||
def getSbtModulePath(key: String, name: String) = {
|
||||
val localProps = new java.util.Properties()
|
||||
IO.load(localProps, file("project/local.properties"))
|
||||
val path = Option(localProps getProperty key) orElse (sys.props get key)
|
||||
path foreach (f => println(s"Using $name from $f"))
|
||||
path
|
||||
}
|
||||
|
||||
lazy val sbtIoPath = getSbtModulePath("sbtio.path", "sbt/io")
|
||||
|
||||
def addSbtModule(p: Project, path: Option[String], projectName: String, m: ModuleID, c: Option[Configuration] = None) =
|
||||
path match {
|
||||
case Some(f) => p dependsOn c.fold[ClasspathDependency](ProjectRef(file(f), projectName))(ProjectRef(file(f), projectName) % _)
|
||||
case None => p settings (libraryDependencies += c.fold(m)(m % _))
|
||||
}
|
||||
|
||||
def addSbtIO(p: Project): Project = addSbtModule(p, sbtIoPath, "io", sbtIO)
|
||||
|
||||
lazy val jline = "jline" % "jline" % "2.13"
|
||||
|
||||
lazy val scalaCompiler = Def.setting { "org.scala-lang" % "scala-compiler" % scalaVersion.value }
|
||||
|
|
|
|||
Loading…
Reference in New Issue