mirror of https://github.com/sbt/sbt.git
Fix #7288 and implement publisM2 / skip
This commit is contained in:
parent
1b31a377d2
commit
783a8e57db
|
|
@ -2622,7 +2622,8 @@ object Defaults extends BuildCommon {
|
||||||
if (turbo.value) ClassLoaderLayeringStrategy.AllLibraryJars
|
if (turbo.value) ClassLoaderLayeringStrategy.AllLibraryJars
|
||||||
else ClassLoaderLayeringStrategy.ScalaLibrary
|
else ClassLoaderLayeringStrategy.ScalaLibrary
|
||||||
},
|
},
|
||||||
publishLocal / skip := (publish / skip).value, // So we don't break previous behaviour
|
publishLocal / skip := (publish / skip).value,
|
||||||
|
publishM2 / skip := (publish / skip).value
|
||||||
)
|
)
|
||||||
// build.sbt is treated a Scala source of metabuild, so to enable deprecation flag on build.sbt we set the option here.
|
// build.sbt is treated a Scala source of metabuild, so to enable deprecation flag on build.sbt we set the option here.
|
||||||
lazy val deprecationSettings: Seq[Setting[_]] =
|
lazy val deprecationSettings: Seq[Setting[_]] =
|
||||||
|
|
@ -2911,9 +2912,9 @@ object Classpaths {
|
||||||
deliver := deliverTask(makeIvyXmlConfiguration).value,
|
deliver := deliverTask(makeIvyXmlConfiguration).value,
|
||||||
deliverLocal := deliverTask(makeIvyXmlLocalConfiguration).value,
|
deliverLocal := deliverTask(makeIvyXmlLocalConfiguration).value,
|
||||||
makeIvyXml := deliverTask(makeIvyXmlConfiguration).value,
|
makeIvyXml := deliverTask(makeIvyXmlConfiguration).value,
|
||||||
publish := publishTask(publishConfiguration).value,
|
publish := publishOrSkip(publishConfiguration, publish / skip).value,
|
||||||
publishLocal := publishTask(publishLocalConfiguration).value,
|
publishLocal := publishOrSkip(publishLocalConfiguration, publishLocal / skip).value,
|
||||||
publishM2 := publishTask(publishM2Configuration).value
|
publishM2 := publishOrSkip(publishM2Configuration, publishM2 / skip).value
|
||||||
)
|
)
|
||||||
|
|
||||||
private[this] def baseGlobalDefaults =
|
private[this] def baseGlobalDefaults =
|
||||||
|
|
@ -3617,56 +3618,32 @@ object Classpaths {
|
||||||
private def logSkipPublish(log: Logger, ref: ProjectRef): Unit =
|
private def logSkipPublish(log: Logger, ref: ProjectRef): Unit =
|
||||||
log.debug(s"Skipping publish* for ${ref.project}")
|
log.debug(s"Skipping publish* for ${ref.project}")
|
||||||
|
|
||||||
private def checkAndPublishLocal(
|
@deprecated("use publishOrSkip instead", "1.9.1")
|
||||||
currentCon: PublishConfiguration,
|
def publishTask(config: TaskKey[PublishConfiguration]): Initialize[Task[Unit]] = {
|
||||||
publishLocalConf: PublishConfiguration,
|
val skipKey =
|
||||||
publishSkipLocal: Boolean,
|
if (config.key == publishLocalConfiguration.key) publishLocal / skip
|
||||||
module: IvySbt#Module,
|
else publish / skip
|
||||||
log: Logger,
|
publishOrSkip(config, skipKey)
|
||||||
ref: ProjectRef
|
|
||||||
)(notPublishLocal: () => Unit): Unit = {
|
|
||||||
if (currentCon == publishLocalConf) {
|
|
||||||
if (publishSkipLocal) {
|
|
||||||
logSkipPublish(log, ref)
|
|
||||||
} else {
|
|
||||||
IvyActions.publish(module, currentCon, log)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
notPublishLocal()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def publishTask(config: TaskKey[PublishConfiguration]): Initialize[Task[Unit]] =
|
def publishOrSkip(
|
||||||
Def.taskIf {
|
config: TaskKey[PublishConfiguration],
|
||||||
if ((publish / skip).value) {
|
skip: TaskKey[Boolean]
|
||||||
val log = streams.value.log
|
): Initialize[Task[Unit]] =
|
||||||
val ref = thisProjectRef.value
|
Def
|
||||||
checkAndPublishLocal(
|
.taskIf {
|
||||||
config.value,
|
if (skip.value) {
|
||||||
publishLocalConfiguration.value,
|
val log = streams.value.log
|
||||||
(publishLocal / skip).value,
|
val ref = thisProjectRef.value
|
||||||
ivyModule.value,
|
|
||||||
log,
|
|
||||||
ref
|
|
||||||
) { () =>
|
|
||||||
logSkipPublish(log, ref)
|
logSkipPublish(log, ref)
|
||||||
}
|
} else {
|
||||||
} else {
|
val conf = config.value
|
||||||
val conf = config.value
|
val log = streams.value.log
|
||||||
val log = streams.value.log
|
val module = ivyModule.value
|
||||||
val module = ivyModule.value
|
|
||||||
checkAndPublishLocal(
|
|
||||||
conf,
|
|
||||||
publishLocalConfiguration.value,
|
|
||||||
(publishLocal / skip).value,
|
|
||||||
module,
|
|
||||||
log,
|
|
||||||
thisProjectRef.value
|
|
||||||
) { () =>
|
|
||||||
IvyActions.publish(module, conf, log)
|
IvyActions.publish(module, conf, log)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} tag (Tags.Publish, Tags.Network)
|
.tag(Tags.Publish, Tags.Network)
|
||||||
|
|
||||||
val moduleIdJsonKeyFormat: sjsonnew.JsonKeyFormat[ModuleID] =
|
val moduleIdJsonKeyFormat: sjsonnew.JsonKeyFormat[ModuleID] =
|
||||||
new sjsonnew.JsonKeyFormat[ModuleID] {
|
new sjsonnew.JsonKeyFormat[ModuleID] {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue