mirror of https://github.com/sbt/sbt.git
[2.x] clean task cleans sona-staging (#9479)
**Problem/Solution** 1. clean task cleans sona-staging directory. 2. cleanFull calls clean task.
This commit is contained in:
parent
fc3666586a
commit
3520576a54
|
|
@ -760,6 +760,7 @@ object Defaults extends BuildCommon with DefExtra {
|
|||
case NonFatal(_) => ()
|
||||
}
|
||||
clean.value
|
||||
(ThisBuild / publish / clean).value
|
||||
},
|
||||
scalaCompilerBridgeBin := Def
|
||||
.ifS(Def.task {
|
||||
|
|
|
|||
|
|
@ -218,6 +218,7 @@ private[sbt] object Clean {
|
|||
val h = Help.more(CleanFull, cleanFullDetailed)
|
||||
val expunge: State => State =
|
||||
(s: State) =>
|
||||
import UpperStateOps.*
|
||||
val outputDirectory = s
|
||||
.get(BasicKeys.rootOutputDirectory)
|
||||
.getOrElse(sys.error("outputDirectory has not been set"))
|
||||
|
|
@ -225,6 +226,7 @@ private[sbt] object Clean {
|
|||
cacheStore.foreach:
|
||||
case d: DiskActionCacheStore => d.clear()
|
||||
case _ => ()
|
||||
val s2 = s.unsafeRunAggregated(LocalRootProject / clean)
|
||||
IO.delete(outputDirectory.toFile())
|
||||
IO.delete(
|
||||
s.configuration
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ package sbt
|
|||
package plugins
|
||||
|
||||
import Def.Setting
|
||||
import Keys.*
|
||||
import sbt.io.IO
|
||||
import sbt.io.syntax.*
|
||||
|
||||
/**
|
||||
* Plugin that enables resolving artifacts via ivy.
|
||||
|
|
@ -29,6 +32,13 @@ object IvyPlugin extends AutoPlugin {
|
|||
|
||||
override lazy val globalSettings: Seq[Setting[?]] =
|
||||
Defaults.globalIvyCore
|
||||
override lazy val buildSettings: Seq[Setting[?]] =
|
||||
Seq(
|
||||
publish / clean := Def.uncached {
|
||||
IO.delete(stagingDirectory.value)
|
||||
IO.delete((ThisBuild / baseDirectory).value / "target" / "sona-bundle")
|
||||
},
|
||||
)
|
||||
override lazy val projectSettings: Seq[Setting[?]] =
|
||||
Classpaths.ivyPublishSettings ++ Classpaths.ivyBaseSettings
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
name := "clean-sona-staging"
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
$ touch target/sona-staging/dummy.txt
|
||||
$ touch target/sona-bundle/dummy.txt
|
||||
|
||||
> clean
|
||||
|
||||
$ absent target/sona-staging/dummy.txt
|
||||
$ absent target/sona-bundle/dummy.txt
|
||||
Loading…
Reference in New Issue