mirror of https://github.com/sbt/sbt.git
Merge pull request #7691 from eed3si9n/wip/root_skip_publish
[2.x] fix: skip publish on synthetic aggregate root
This commit is contained in:
commit
864da879c6
|
|
@ -10,12 +10,13 @@ package sbt
|
||||||
package internal
|
package internal
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import Keys.{ organization, thisProject, autoGeneratedProject }
|
import Keys.{ organization, thisProject, autoGeneratedProject, publish, publishLocal, skip }
|
||||||
import Def.Setting
|
import Def.Setting
|
||||||
// import sbt.ProjectExtra.apply
|
// import sbt.ProjectExtra.apply
|
||||||
import sbt.io.Hash
|
import sbt.io.Hash
|
||||||
import sbt.internal.util.{ Attributed, StringAttributeMap }
|
import sbt.internal.util.{ Attributed, StringAttributeMap }
|
||||||
import sbt.internal.inc.{ FileAnalysisStore, ReflectUtilities }
|
import sbt.internal.inc.{ FileAnalysisStore, ReflectUtilities }
|
||||||
|
import sbt.SlashSyntax0.*
|
||||||
import xsbti.{ FileConverter, VirtualFileRef }
|
import xsbti.{ FileConverter, VirtualFileRef }
|
||||||
import xsbti.compile.CompileAnalysis
|
import xsbti.compile.CompileAnalysis
|
||||||
|
|
||||||
|
|
@ -42,7 +43,7 @@ private[sbt] object BuildDef:
|
||||||
}
|
}
|
||||||
|
|
||||||
def defaultAggregated(id: String, aggregate: Seq[ProjectRef]): BuildDef = new BuildDef {
|
def defaultAggregated(id: String, aggregate: Seq[ProjectRef]): BuildDef = new BuildDef {
|
||||||
override def projectDefinitions(base: File) =
|
override def projectDefinitions(base: File): Seq[Project] =
|
||||||
defaultAggregatedProject(id, base, aggregate) :: Nil
|
defaultAggregatedProject(id, base, aggregate) :: Nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,12 +56,18 @@ private[sbt] object BuildDef:
|
||||||
def defaultAggregatedProject(id: String, base: File, agg: Seq[ProjectRef]): Project =
|
def defaultAggregatedProject(id: String, base: File, agg: Seq[ProjectRef]): Project =
|
||||||
defaultProject(id, base).aggregate(agg: _*)
|
defaultProject(id, base).aggregate(agg: _*)
|
||||||
|
|
||||||
private[sbt] def generatedRootWithoutIvyPlugin(
|
private[sbt] def generatedRootSkipPublish(
|
||||||
id: String,
|
id: String,
|
||||||
base: File,
|
base: File,
|
||||||
agg: Seq[ProjectRef]
|
agg: Seq[ProjectRef]
|
||||||
): Project =
|
): Project =
|
||||||
Project.mkGeneratedRoot(id, base, agg).settings(defaultProjectSettings)
|
Project
|
||||||
|
.mkGeneratedRoot(id, base, agg)
|
||||||
|
.settings(
|
||||||
|
defaultProjectSettings,
|
||||||
|
publish / skip := true,
|
||||||
|
publishLocal / skip := true,
|
||||||
|
)
|
||||||
|
|
||||||
private[sbt] def defaultProjectSettings: Seq[Setting[_]] = Seq(
|
private[sbt] def defaultProjectSettings: Seq[Setting[_]] = Seq(
|
||||||
// TODO - Can we move this somewhere else? ordering of settings is causing this to get borked.
|
// TODO - Can we move this somewhere else? ordering of settings is causing this to get borked.
|
||||||
|
|
@ -72,7 +79,7 @@ private[sbt] object BuildDef:
|
||||||
case _ => "default"
|
case _ => "default"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
autoGeneratedProject := true
|
autoGeneratedProject := true,
|
||||||
)
|
)
|
||||||
|
|
||||||
def analyzed(
|
def analyzed(
|
||||||
|
|
|
||||||
|
|
@ -1061,7 +1061,7 @@ private[sbt] object Load {
|
||||||
val refs = existingIds.map(id => ProjectRef(buildUri, id))
|
val refs = existingIds.map(id => ProjectRef(buildUri, id))
|
||||||
if (discovered.isEmpty || java.lang.Boolean.getBoolean("sbt.root.ivyplugin"))
|
if (discovered.isEmpty || java.lang.Boolean.getBoolean("sbt.root.ivyplugin"))
|
||||||
BuildDef.defaultAggregatedProject(defaultID, buildBase, refs)
|
BuildDef.defaultAggregatedProject(defaultID, buildBase, refs)
|
||||||
else BuildDef.generatedRootWithoutIvyPlugin(defaultID, buildBase, refs)
|
else BuildDef.generatedRootSkipPublish(defaultID, buildBase, refs)
|
||||||
}
|
}
|
||||||
(root, false, Nil, otherProjects)
|
(root, false, Nil, otherProjects)
|
||||||
val (finalRoot, projectLevelExtra) =
|
val (finalRoot, projectLevelExtra) =
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
ThisBuild / organization := "com.example"
|
||||||
|
ThisBuild / ivyPaths := IvyPaths((ThisBuild / baseDirectory).value.toString, Some(((ThisBuild / baseDirectory).value / "ivy" / "cache").toString))
|
||||||
|
|
||||||
|
name := "root"
|
||||||
|
|
||||||
|
lazy val core = project
|
||||||
|
.settings(
|
||||||
|
name := "core",
|
||||||
|
// organization := "com.example",
|
||||||
|
ivyPaths := IvyPaths((ThisBuild / baseDirectory).value.toString, Some(((ThisBuild / baseDirectory).value / "ivy" / "cache").toString))
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
> publishLocal
|
||||||
|
|
||||||
|
$ absent ivy/cache/local/com.example/root_3/0.1.0-SNAPSHOT/poms/root_3.pom
|
||||||
Loading…
Reference in New Issue