From 0c11bc6addeecf1b6dfac9aded37cd4a0489e7cd Mon Sep 17 00:00:00 2001 From: andrea Date: Tue, 2 Oct 2018 16:24:28 +0100 Subject: [PATCH] Build time configurable library management --- build.sbt | 2 +- project/Dependencies.scala | 25 ++++++++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 0dd097327..fcc53da8a 100644 --- a/build.sbt +++ b/build.sbt @@ -590,7 +590,7 @@ lazy val mainProj = (project in file("main")) addSbtIO, addSbtUtilLogging, addSbtLmCore, - addSbtLmIvy, + addSbtLmImpl, addSbtCompilerInterface, addSbtZincCompile ) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 1f73ef56f..9ef43669e 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -11,7 +11,11 @@ object Dependencies { // sbt modules private val ioVersion = "1.3.0-M3" private val utilVersion = "1.3.0-M2" - private val lmVersion = "1.2.1" + private val lmVersion = + sys.props.get("sbt.build.lm.version") match { + case Some(version) => version + case _ => "1.2.1" + } private val zincVersion = "1.2.2" private val sbtIO = "org.scala-sbt" %% "io" % ioVersion @@ -25,7 +29,22 @@ object Dependencies { private val utilScripted = "org.scala-sbt" %% "util-scripted" % utilVersion private val libraryManagementCore = "org.scala-sbt" %% "librarymanagement-core" % lmVersion - private val libraryManagementIvy = "org.scala-sbt" %% "librarymanagement-ivy" % lmVersion + + private val libraryManagementImpl = { + val lmOrganization = + sys.props.get("sbt.build.lm.organization") match { + case Some(impl) => impl + case _ => "org.scala-sbt" + } + + val lmModuleName = + sys.props.get("sbt.build.lm.moduleName") match { + case Some(impl) => impl + case _ => "librarymanagement-ivy" + } + + lmOrganization %% lmModuleName % lmVersion + } val launcherVersion = "1.0.4" val launcherInterface = "org.scala-sbt" % "launcher-interface" % launcherVersion @@ -79,7 +98,7 @@ object Dependencies { def addSbtLmCore(p: Project): Project = addSbtModule(p, sbtLmPath, "lmCore", libraryManagementCore) - def addSbtLmIvy(p: Project): Project = addSbtModule(p, sbtLmPath, "lmIvy", libraryManagementIvy) + def addSbtLmImpl(p: Project): Project = addSbtModule(p, sbtLmPath, "lmImpl", libraryManagementImpl) def addSbtCompilerInterface(p: Project): Project = addSbtModule(p, sbtZincPath, "compilerInterface212", compilerInterface)