Skip to content

Commit

Permalink
Move noPublishProjectRefs to always-triggered plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
armanbilge committed Jun 22, 2023
1 parent c1ea445 commit 1b82a49
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 20 additions & 10 deletions no-publish/src/main/scala/org/typelevel/sbt/NoPublishPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}

0 comments on commit 1b82a49

Please sign in to comment.