Skip to content
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

add sbt-version-policy and advance mimaPreviousVersion #501

Merged
merged 3 commits into from
Mar 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- run: java -version
- sbt_cmd:
scala_version: << parameters.scala_version >>
sbt_tasks: xml/update xml/compile xml/test:compile xml/test xml/doc xml/package xml/osgiBundle
sbt_tasks: xml/update xml/compile xml/Test/compile xml/test xml/doc xml/package xml/osgiBundle xml/versionPolicyCheck
scalajs_job:
executor: scala_jdk8_executor
parameters:
Expand All @@ -78,7 +78,7 @@ jobs:
- run: node -v
- sbt_cmd:
scala_version: << parameters.scala_version >>
sbt_tasks: xmlJS/update xmlJS/compile xmlJS/test:compile xmlJS/test xmlJS/doc xmlJS/package
sbt_tasks: xmlJS/update xmlJS/compile xmlJS/Test/compile xmlJS/test xmlJS/doc xmlJS/package
scalanative_job:
executor: scala_native_executor
parameters:
Expand Down
75 changes: 12 additions & 63 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
ThisBuild / startYear := Some(2002)
ThisBuild / licenses += (("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0")))

ThisBuild / versionScheme := Some("early-semver")
ThisBuild / versionPolicyIntention := Compatibility.BinaryAndSourceCompatible

lazy val configSettings: Seq[Setting[_]] = Seq(
unmanagedSourceDirectories ++= {
unmanagedSourceDirectories.value.flatMap { dir =>
Expand Down Expand Up @@ -59,76 +62,22 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform)
|""".stripMargin)),

scalaModuleMimaPreviousVersion := {
if (isDotty.value) None // No such release yet
else Some("1.3.0")
// pending resolution of https://github.com/scalacenter/sbt-version-policy/issues/62
if (isDotty.value) None
else Some("2.0.0-M5")
},
mimaBinaryIssueFilters ++= {
import com.typesafe.tools.mima.core._
import com.typesafe.tools.mima.core.ProblemFilters._
Seq(
// scala-xml 1.1.1 deprecated XMLEventReader, so it broke
// binary compatibility for 2.0.0 in the following way:
exclude[MissingClassProblem]("scala.xml.pull.EvComment"),
exclude[MissingClassProblem]("scala.xml.pull.EvComment$"),
exclude[MissingClassProblem]("scala.xml.pull.EvElemEnd"),
exclude[MissingClassProblem]("scala.xml.pull.EvElemEnd$"),
exclude[MissingClassProblem]("scala.xml.pull.EvElemStart"),
exclude[MissingClassProblem]("scala.xml.pull.EvElemStart$"),
exclude[MissingClassProblem]("scala.xml.pull.EvEntityRef"),
exclude[MissingClassProblem]("scala.xml.pull.EvEntityRef$"),
exclude[MissingClassProblem]("scala.xml.pull.EvProcInstr"),
exclude[MissingClassProblem]("scala.xml.pull.EvProcInstr$"),
exclude[MissingClassProblem]("scala.xml.pull.EvText"),
exclude[MissingClassProblem]("scala.xml.pull.EvText$"),
exclude[MissingClassProblem]("scala.xml.pull.ExceptionEvent"),
exclude[MissingClassProblem]("scala.xml.pull.ExceptionEvent$"),
exclude[MissingClassProblem]("scala.xml.pull.ProducerConsumerIterator"),
exclude[MissingClassProblem]("scala.xml.pull.XMLEvent"),
exclude[MissingClassProblem]("scala.xml.pull.XMLEventReader"),
exclude[MissingClassProblem]("scala.xml.pull.XMLEventReader$POISON$"),
exclude[MissingClassProblem]("scala.xml.pull.XMLEventReader$Parser"),
exclude[MissingClassProblem]("scala.xml.pull.package"),
exclude[MissingClassProblem]("scala.xml.pull.package$"),
exclude[MissingTypesProblem]("scala.xml.Atom"),
exclude[MissingTypesProblem]("scala.xml.Comment"),
exclude[MissingTypesProblem]("scala.xml.Document"),
exclude[MissingTypesProblem]("scala.xml.EntityRef"),
exclude[MissingTypesProblem]("scala.xml.PCData"),
exclude[MissingTypesProblem]("scala.xml.ProcInstr"),
exclude[MissingTypesProblem]("scala.xml.SpecialNode"),
exclude[MissingTypesProblem]("scala.xml.Text"),
exclude[MissingTypesProblem]("scala.xml.Unparsed"),
// Miscellaneous deprecations
exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp"),
exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp$TopIter$"),
exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp$Node$"),
exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp$Point$"),
exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp$TopIter"),
exclude[MissingClassProblem]("scala.xml.dtd.impl.PointedHedgeExp$Node"),
exclude[MissingClassProblem]("scala.xml.dtd.Scanner"),
exclude[MissingClassProblem]("scala.xml.dtd.ContentModelParser$"),
exclude[MissingClassProblem]("scala.xml.dtd.ContentModelParser"),
exclude[MissingClassProblem]("scala.xml.dtd.ElementValidator"),
exclude[MissingClassProblem]("scala.xml.dtd.ElementValidator"),
exclude[MissingClassProblem]("scala.xml.factory.Binder"),
exclude[MissingClassProblem]("scala.xml.parsing.ValidatingMarkupHandler"),
exclude[MissingClassProblem]("scala.xml.persistent.CachedFileStorage"),
exclude[MissingClassProblem]("scala.xml.persistent.Index"),
exclude[MissingClassProblem]("scala.xml.persistent.SetStorage"),
exclude[DirectMissingMethodProblem]("scala.xml.dtd.ContentModel.parse"),
exclude[DirectMissingMethodProblem]("scala.xml.Elem.this"),
exclude[DirectMissingMethodProblem]("scala.xml.Elem.apply"),
exclude[DirectMissingMethodProblem]("scala.xml.Elem.processXml"),
exclude[DirectMissingMethodProblem]("scala.xml.Elem.xmlToProcess"),
// Scala 2.12 deprecated mutable.Stack, so we broke
// binary compatibility for 2.0.0 in the following way:
exclude[IncompatibleMethTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack_="),
exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.hStack"),
exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.scopeStack"),
exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.attribStack"),
exclude[IncompatibleResultTypeProblem]("scala.xml.parsing.FactoryAdapter.tagStack"),
// because we reverted #279
exclude[DirectMissingMethodProblem]("scala.xml.Utility.escapeText"),
// New MiMa checks for generic signature changes
exclude[IncompatibleSignatureProblem]("*"),
// afaict this is just a JDK 8 vs 15 difference, producing a false positive when
// we compare classes built on JDK 15 (which we only do on CI, not at release time)
// to previous-version artifacts that were built on 8. see scala/scala-xml#501
exclude[DirectMissingMethodProblem]("scala.xml.include.sax.XIncluder.declaration"),
)
},

Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ export CI_SNAPSHOT_RELEASE="${projectPrefix}publish"
# for now, until we're confident in the new release scripts, just close the staging repo.
export CI_SONATYPE_RELEASE="; sonatypePrepare; sonatypeBundleUpload; sonatypeClose"

sbt clean ${projectPrefix}test ${projectPrefix}publishLocal $releaseTask
sbt clean ${projectPrefix}test ${projectPrefix}versionPolicyCheck ${projectPrefix}publishLocal $releaseTask
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion)
addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion)
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.5.3")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0")
addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "1.0.0-RC5")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was consider and discussed at scala/sbt-scala-module#111 . I was on the fence about it, but in the end I just shrugged and made a decision not to do it.

In general, my experiences while doing community build work have given me a somewhat dim view of putting build stuff in plugins. It makes individual builds harder to read and harder to maintain. As soon as settings and tasks are coming from a plugin, you can't just read the build and see what's going on anymore. You have to consider the possibility that a bunch of random stuff is coming in from some plugin and then you have to go read the sources of the plugin, too.

And then maintenance is harder for individual module maintainers, because they can't easily make changes to sbt-scala-module themselves. (And it's already hard enough to find and retain module maintainers.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose sbt-scala-module could add sbt-version-policy but not actually set the settings. That's a middle ground I'm not sure I considered.

But anyway, 🤷

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that now that we have the Scala Steward, we get version bumps that way, so there's less benefit in getting them via sbt-scala-module.