Created
October 14, 2016 01:03
-
-
Save joescii/4431cb2185eddb699dfb79b9c910e333 to your computer and use it in GitHub Desktop.
Conditional sbt Settings
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
scalaVersion := "2.11.7" | |
crossScalaVersions := Seq("2.9.2", "2.10.5", "2.11.7") | |
publishTo := Some(Resolver.file("Unused transient repository", file("target/unusedrepo"))) | |
def conditionalSettings[P](conditionalKey: SettingKey[P])(predicate: P => Boolean): Seq[Def.Setting[_]] = { | |
// How can I make this suck less? | |
Seq( | |
publishArtifact := { if(predicate(conditionalKey.value)) false else publishArtifact.value }, | |
publishLocal := { if(predicate(conditionalKey.value)) {} else publishLocal.value }, | |
publish := { if(predicate(conditionalKey.value)) {} else publish.value }, | |
publishTo := { if(predicate(conditionalKey.value)) None else publishTo.value } | |
) | |
} | |
conditionalSettings(scalaBinaryVersion)(_ == "2.10") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@jastice it won't compile