diff --git a/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala b/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala index 4ff15e74..b43d1e7d 100644 --- a/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala +++ b/ci/src/main/scala/org/typelevel/sbt/TypelevelCiPlugin.scala @@ -16,7 +16,7 @@ package org.typelevel.sbt -import org.typelevel.sbt.NoPublishPlugin.autoImport._ +import org.typelevel.sbt.NoPublishGlobalPlugin.autoImport._ import org.typelevel.sbt.gha.GenerativePlugin import org.typelevel.sbt.gha.GenerativePlugin.autoImport._ import org.typelevel.sbt.gha.GitHubActionsPlugin diff --git a/no-publish/src/main/scala/org/typelevel/sbt/NoPublishPlugin.scala b/no-publish/src/main/scala/org/typelevel/sbt/NoPublishPlugin.scala index 10004deb..d392dc84 100644 --- a/no-publish/src/main/scala/org/typelevel/sbt/NoPublishPlugin.scala +++ b/no-publish/src/main/scala/org/typelevel/sbt/NoPublishPlugin.scala @@ -19,28 +19,38 @@ package org.typelevel.sbt import sbt._ import Keys._ +import NoPublishGlobalPlugin.noPublishInternalAggregation object NoPublishPlugin extends AutoPlugin { + + override def trigger = noTrigger + + override def projectSettings = Seq( + publish := {}, + publishLocal := {}, + publishArtifact := false, + publish / skip := true, + Global / noPublishInternalAggregation += thisProjectRef.value + ) +} + +object NoPublishGlobalPlugin extends AutoPlugin { + + // triggered even if NoPublishPlugin is not used in the build + override def trigger = allRequirements + object autoImport { lazy val noPublishProjectRefs = settingKey[Seq[ProjectRef]]("List of no-publish projects") } + import autoImport._ - private lazy val noPublishInternalAggregation = + private[sbt] lazy val noPublishInternalAggregation = settingKey[Seq[ProjectRef]]("Aggregates all the no-publish projects") - override def trigger = noTrigger - override def globalSettings = Seq( noPublishInternalAggregation := Seq(), noPublishProjectRefs := noPublishInternalAggregation.value ) - override def projectSettings = Seq( - publish := {}, - publishLocal := {}, - publishArtifact := false, - publish / skip := true, - Global / noPublishInternalAggregation += thisProjectRef.value - ) }