diff --git a/build.sbt b/build.sbt index 8816e810c..8c8fd074b 100644 --- a/build.sbt +++ b/build.sbt @@ -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 := { _ => () }, diff --git a/project/PublishBinPlugin.scala b/project/PublishBinPlugin.scala new file mode 100644 index 000000000..e999a94fe --- /dev/null +++ b/project/PublishBinPlugin.scala @@ -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 + ) +} diff --git a/project/Scripted.scala b/project/Scripted.scala index a821ff446..20d8ad7b4 100644 --- a/project/Scripted.scala +++ b/project/Scripted.scala @@ -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")