Skip to content

Commit

Permalink
Tweak publishing from plugin/lib splitting
Browse files Browse the repository at this point in the history
1. Add sbt-plugin-releases so dynver can resolve its previous artifacts
2. Publish dynver in ivy-style (non-maven-style) so it can be resolve as
   a transitive dependency of sbt-dynver - the previous point was for
   when you're resolving dynver directly
3. Clear bintray/resolver which locally, not in CI, includes my own
   bintray repository, via my credentials info..
4. Speed up scripted by reusing the user home sbt boot directory
5. Shift the MiMa related settings into its own file
6. Temporarily disable MiMa while we can't resolve dynver... :D
  • Loading branch information
dwijnand committed Jan 28, 2021
1 parent 4d609e4 commit 49a8373
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 28 deletions.
41 changes: 13 additions & 28 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
val dynverRoot = project.in(file("."))
val dynverP = LocalProject("dynver")
aggregateProjects(dynverP, sbtdynver)
aggregateProjects(dynverLib, sbtdynver)

inThisBuild(List(
organization := "com.dwijnand",
Expand Down Expand Up @@ -29,45 +28,31 @@ inThisBuild(List(
Test / parallelExecution := true,
))

val dynver = project.settings(
val dynverLib = LocalProject("dynver")
val dynver = project.settings(
libraryDependencies += "org.eclipse.jgit" % "org.eclipse.jgit" % "5.10.0.202012080955-r" % Test,
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.15.2" % Test,

resolvers += Resolver.sbtPluginRepo("releases"), // for prev artifacts, not repo1 b/c of mergly publishing
publishSettings,
publishMavenStyle := false, // so it's resolved out of sbt-plugin-releases as a dep of sbt-dynver
)

val sbtdynver = project.dependsOn(dynverP).enablePlugins(SbtPlugin).settings(
name := "sbt-dynver",

scriptedLaunchOpts ++= Seq("-Xmx1024M", "-XX:MaxPermSize=256M", "-Dplugin.version=" + version.value),
val sbtdynver = project.dependsOn(dynverLib).enablePlugins(SbtPlugin).settings(
name := "sbt-dynver",
scriptedBufferLog := true,
scriptedDependencies := Seq(dynver / publishLocal, publishLocal).dependOn.value,

scriptedLaunchOpts += s"-Dplugin.version=${version.value}",
scriptedLaunchOpts += s"-Dsbt.boot.directory=${file(sys.props("user.home")) / ".sbt" / "boot"}",
publishSettings,
)

lazy val publishSettings = Def.settings(
mimaSettings,
bintrayPackage := "sbt-dynver", // keep publishing to the same place
bintrayRepository := "sbt-plugins",
MimaSettings.mimaSettings,
bintrayPackage := "sbt-dynver", // keep publishing to the same place
bintrayRepository := "sbt-plugins",
bintray / resolvers := Nil, // disable getting my bintray repo through my local credentials; be like CI
)

import com.typesafe.tools.mima.core._
lazy val mimaSettings = Seq(
mimaPreviousArtifacts := Set(projID.value.withRevision("5.0.0-M2")),
mimaBinaryIssueFilters ++= Seq(
ProblemFilters.exclude[Problem]("*.impl.*"), // impl is for internal implementation details
),
)

lazy val projID = Def.setting {
// Using projectID something is wrong... Looks for dynver_2.12 but artifacts are name=dynver
val sbtBv = (pluginCrossBuild / sbtBinaryVersion).value
val sbv = (pluginCrossBuild / scalaBinaryVersion).value
val mid = organization.value %% moduleName.value % "0.0.0"
if (sbtPlugin.value) Defaults.sbtPluginExtra(mid, sbtBv, sbv) else mid
}

mimaPreviousArtifacts := Set.empty
publish / skip := true

Expand Down
28 changes: 28 additions & 0 deletions project/MimaSettings.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import sbt._, Keys._
import sbt.Classpaths.pluginProjectID

import com.typesafe.tools.mima.core._
import com.typesafe.tools.mima.core.ProblemFilters.exclude
import com.typesafe.tools.mima.plugin.MimaPlugin.autoImport._

object MimaSettings {
// clear out mimaBinaryIssueFilters when changing this
val mimaPreviousVersion = "5.0.0-M2"

val projID = Def.setting {
// Using projectID something is wrong... Looks for dynver_2.12 but artifacts are name=dynver
// Even pluginProjectID.value.withExplicitArtifacts(Vector())) doesn't work here..?
val sbtBv = (pluginCrossBuild / sbtBinaryVersion).value
val sbv = (pluginCrossBuild / scalaBinaryVersion).value
val mid = organization.value %% moduleName.value % version.value
if (sbtPlugin.value) Defaults.sbtPluginExtra(mid, sbtBv, sbv) else mid
}

val mimaSettings = Def.settings (
mimaPreviousArtifacts := Set.empty, // Set(projID.value.withRevision(mimaPreviousVersion)),
mimaReportSignatureProblems := true,
mimaBinaryIssueFilters ++= Seq(
ProblemFilters.exclude[Problem]("*.impl.*"), // KEEP: impl is for internal implementation details
),
)
}

0 comments on commit 49a8373

Please sign in to comment.