-
Notifications
You must be signed in to change notification settings - Fork 29
totally disable publishing of non-core subprojects #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
totally disable publishing of non-core subprojects #14
Conversation
this should avoid all the
stuff at e.g. https://travis-ci.org/scala/scala-parallel-collections/builds/213142948 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Here's what I've built up over time, in a similar vein:
val noDocs = Def.settings(sources in (Compile, doc) := Nil, publishArtifact in (Compile, packageDoc) := false)
val noSources = Def.settings(publishArtifact in (Compile, packageSrc) := false)
val noPackage = Def.settings(Keys.`package` := file(""), packageBin := file(""), packagedArtifacts := Map())
val noPublish = Def.settings(
makePom := file(""),
deliver := file(""),
deliverLocal := file(""),
publish := {},
publishLocal := {},
publishM2 := {},
publishArtifact := false,
publishTo := Some(Resolver.file("devnull", file("/dev/null")))
)
val noArtifacts = Def.settings(noPackage, noPublish)
build.sbt
Outdated
|
||
lazy val root = (project in file(".")) | ||
.settings(disablePublishing) | ||
.aggregate(core, junit, scalacheck, testmacros) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor/pro-tip: You can avoid having to enumerate these, as well as maintain the enumeration, by just specifying the settings at the root level:
disablePublishing
build.sbt
Outdated
@@ -29,21 +40,20 @@ lazy val core = project.in(file("core")).settings(scalaModuleSettings).settings( | |||
) | |||
) | |||
|
|||
lazy val junit = project.in(file("junit")).settings( | |||
lazy val junit = project.in(file("junit")).settings(disablePublishing).settings( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor/pro-tip: No need to jump in and out of .settings
.
TL;DR: you could define this as
project.in(file("junit")).settings(
disablePublishing,
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test",
Long-winded explanation:
Individual settings (type Setting[_]
) and seq of settings (type Seq[Setting[_]]
) are both SettingDefinition
s (the former by definition, the latter via implicit lift), and .settings
is defined to take a varargs of SettingDefinition
, so they can be defined next to each other.
For convenience there is also a Def.settings(ss: SettingsDefinition*): Seq[Setting[_]]
b52839e
to
821af90
Compare
a with-extreme-prejudice followup to b21b276
821af90
to
e38e892
Compare
rebased, and applied Dale's suggested minor changes (thanks Dale) |
It would be great if sbt had support for this out of the box. Disabling publishing of a subproject is rather common and not at all well supported at the moment. |
I agree. Between sbt, sbt-bintray, sbt-sonatype there's a lot of work to do just in this niche. |
not to mention sbt-pgp, which is actually where these particular exceptions were coming from (and are hopefully finally fixed by #20) |
I closed and released the staging repo in the Sonatype web UI. I'll come back here once the artifacts are on Maven Central and I've done a bit of testing. |
🎉 |
a with-extreme-prejudice followup to b21b276
using code borrowed from scala/scala repo