mirror of https://github.com/sbt/sbt.git
Merge pull request #5364 from eatkins/publish-local-bin
Make publishLocalBin work without prior publishLocal
This commit is contained in:
commit
04ade0cb2f
|
|
@ -180,7 +180,7 @@ object IvyXml {
|
|||
</ivy-module>
|
||||
}
|
||||
|
||||
private def makeIvyXmlBefore[T](
|
||||
private[sbt] def makeIvyXmlBefore[T](
|
||||
task: TaskKey[T],
|
||||
shadedConfigOpt: Option[Configuration]
|
||||
): Setting[Task[T]] =
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
import sbt._, Keys._
|
||||
package sbt
|
||||
|
||||
import sbt.librarymanagement.PublishConfiguration
|
||||
import sbt.librarymanagement.ConfigRef
|
||||
import java.nio.charset.StandardCharsets.UTF_8
|
||||
import java.nio.file.{ FileAlreadyExistsException, Files }
|
||||
|
||||
import org.apache.ivy.core.module.id.ModuleRevisionId
|
||||
import sbt.Keys._
|
||||
import sbt.internal.librarymanagement.{ IvySbt, IvyXml }
|
||||
|
||||
/** This local plugin provides ways of publishing just the binary jar. */
|
||||
object PublishBinPlugin extends AutoPlugin {
|
||||
|
|
@ -13,22 +17,51 @@ object PublishBinPlugin extends AutoPlugin {
|
|||
}
|
||||
import autoImport._
|
||||
|
||||
override def globalSettings = Seq(publishLocalBin := (()))
|
||||
private val dummyDoc = taskKey[File]("").withRank(Int.MaxValue)
|
||||
override val globalSettings = Seq(publishLocalBin := (()))
|
||||
|
||||
override def projectSettings = Def settings (
|
||||
override val projectSettings: Seq[Def.Setting[_]] = Def settings (
|
||||
publishLocalBin := Classpaths.publishTask(publishLocalBinConfig).value,
|
||||
publishLocalBinConfig := {
|
||||
Classpaths.publishConfig(
|
||||
false, // publishMavenStyle.value,
|
||||
Classpaths.deliverPattern(crossTarget.value),
|
||||
if (isSnapshot.value) "integration" else "release",
|
||||
ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
|
||||
(packagedArtifacts in publishLocalBin).value.toVector,
|
||||
(checksums in publishLocalBin).value.toVector,
|
||||
logging = ivyLoggingLevel.value,
|
||||
overwrite = isSnapshot.value
|
||||
publishLocalBinConfig := Classpaths.publishConfig(
|
||||
false, // publishMavenStyle.value,
|
||||
Classpaths.deliverPattern(crossTarget.value),
|
||||
if (isSnapshot.value) "integration" else "release",
|
||||
ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
|
||||
(packagedArtifacts in publishLocalBin).value.toVector,
|
||||
(checksums in publishLocalBin).value.toVector,
|
||||
logging = ivyLoggingLevel.value,
|
||||
overwrite = isSnapshot.value
|
||||
),
|
||||
publishLocalBinConfig := publishLocalBinConfig
|
||||
.dependsOn(
|
||||
// Copied from sbt.internal.
|
||||
Def.taskDyn {
|
||||
val doGen = useCoursier.value
|
||||
if (doGen)
|
||||
Def.task {
|
||||
val currentProject = {
|
||||
val proj = csrProject.value
|
||||
val publications = csrPublications.value
|
||||
proj.withPublications(publications)
|
||||
}
|
||||
IvyXml.writeFiles(currentProject, None, ivySbt.value, streams.value.log)
|
||||
} else
|
||||
Def.task(())
|
||||
}
|
||||
)
|
||||
.value,
|
||||
dummyDoc := {
|
||||
val dummyFile = streams.value.cacheDirectory / "doc.jar"
|
||||
try {
|
||||
Files.createDirectories(dummyFile.toPath.getParent)
|
||||
Files.createFile(dummyFile.toPath)
|
||||
} catch { case _: FileAlreadyExistsException => }
|
||||
dummyFile
|
||||
},
|
||||
packagedArtifacts in publishLocalBin := Classpaths.packaged(Seq(packageBin in Compile)).value
|
||||
dummyDoc / packagedArtifact := (Compile / packageDoc / artifact).value -> dummyDoc.value,
|
||||
packagedArtifacts in publishLocalBin :=
|
||||
Classpaths
|
||||
.packaged(Seq(packageBin in Compile, packageSrc in Compile, makePom, dummyDoc))
|
||||
.value
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
sbt.version=1.3.6
|
||||
sbt.version=1.3.7
|
||||
|
|
|
|||
Loading…
Reference in New Issue