Merge pull request #2725 from dwijnand/scriptless-1.0

[sbt 1.0] Configure scripted to do less
This commit is contained in:
eugene yokota 2016-09-07 00:46:52 -04:00 committed by GitHub
commit 57a655478f
3 changed files with 26 additions and 4 deletions

View File

@ -219,7 +219,7 @@ lazy val sbtProj = (project in file("sbt")).
def scriptedTask: Def.Initialize[InputTask[Unit]] = Def.inputTask {
val result = scriptedSource(dir => (s: State) => Scripted.scriptedParser(dir)).parsed
publishAll.value
publishLocalBinAll.value
// These two projects need to be visible in a repo even if the default
// local repository is hidden, so we publish them to an alternate location and add
// that alternate repo to the running scripted test (in Scripted.scriptedpreScripted).
@ -258,9 +258,8 @@ def otherRootSettings = Seq(
scriptedSource := (sourceDirectory in sbtProj).value / "sbt-test",
// scriptedPrescripted := { addSbtAlternateResolver _ },
scriptedLaunchOpts := List("-XX:MaxPermSize=256M", "-Xmx1G"),
publishAll := {
val _ = (publishLocal).all(ScopeFilter(inAnyProject)).value
},
publishAll := { val _ = (publishLocal).all(ScopeFilter(inAnyProject)).value },
publishLocalBinAll := { val _ = (publishLocalBin).all(ScopeFilter(inAnyProject)).value },
aggregate in bintrayRelease := false
) ++ inConfig(Scripted.RepoOverrideTest)(Seq(
scriptedPrescripted := { _ => () },

View File

@ -0,0 +1,22 @@
import sbt._, Keys._
/** This local plugin provides ways of publishing just the binary jar. */
object PublishBinPlugin extends AutoPlugin {
override def requires = plugins.JvmPlugin
override def trigger = allRequirements
object autoImport {
val publishLocalBin = taskKey[Unit]("")
val publishLocalBinConfig = taskKey[PublishConfiguration]("")
}
import autoImport._
override def projectSettings = Def settings (
publishLocalBin := Classpaths.publishTask(publishLocalBinConfig, deliverLocal).value,
publishLocalBinConfig := Classpaths.publishConfig(
(packagedArtifacts in publishLocalBin).value, Some(deliverLocal.value),
(checksums in publishLocalBin).value, logging = ivyLoggingLevel.value, overwrite = isSnapshot.value),
packagedArtifacts in publishLocalBin := Classpaths.packaged(Seq(packageBin in Compile)).value
)
}

View File

@ -20,6 +20,7 @@ object ScriptedPlugin extends sbt.AutoPlugin {
trait ScriptedKeys {
lazy val publishAll = TaskKey[Unit]("publish-all")
lazy val publishLocalBinAll = taskKey[Unit]("")
lazy val scripted = InputKey[Unit]("scripted")
lazy val scriptedUnpublished = InputKey[Unit]("scripted-unpublished", "Execute scripted without publishing SBT first. Saves you some time when only your test has changed.")
lazy val scriptedSource = SettingKey[File]("scripted-source")