Last active
April 11, 2018 12:20
-
-
Save hochgi/e0dd854a8774414cd750 to your computer and use it in GitHub Desktop.
cross building against multiple versions of some library in SBT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name := s"my-artifact_lib${System.getProperty("cross.build.lib.version")}" | |
libraryDependencies += "com.some.group" % "some-artifact" % System.getProperty("cross.build.lib.version") | |
val changeVer = inputKey[Unit]("change system property cross.build.lib.version") | |
val buildAndPublish = taskKey[Unit]("your custom build task...") | |
changeVer := { | |
import complete.DefaultParsers._ | |
val ver = (Space ~> NotSpace).parsed | |
System.setProperty("cross.build.lib.version",ver) | |
} | |
buildAndPublish := println(name.value) //you might want to do some actual building here ;) | |
val crossBuildCommand = Command.command("crossBuild") { state => | |
val libVersions = Seq("1.0","1.23","3.14") | |
(state /: libVersions) { case (currState,ver) => | |
s"changeVer $ver" :: reload :: buildAndPublish :: currState | |
} | |
} | |
commands += crossBuildCommand |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment