Prepare for 1.0.0: JS/Native cross-build, MiMa, declaration-order eval, publishing hygiene - #3
Conversation
|
The build was on sbt 1.11.3, with several plugins behind their latest releases. sbt 2.x is now stable (2.0.9), and the plugins this build depends on publish sbt 2 versions. Moving now means 1.0.0 is built and published with the current toolchain, so the first post-1.0 release doesn't need a build migration. Changessbt 1.11.3 → 2.0.9
Publishing:
|
| Before | After | |
|---|---|---|
| sbt | 1.11.3 | 2.0.9 |
| scalatest | 3.2.19 | 3.2.20 |
| sbt-scalafmt / scalafmt | 2.5.5 / 3.9.3 | 2.6.2 / 3.11.5 |
| sbt-scalafix | 0.14.3 | 0.14.9 |
| sbt-updates | 0.6.4 | 0.7.0 |
| sbt-pgp | 2.3.1 | 2.3.2 |
| sbt-scalajs | 1.19.0 | 1.22.0 |
| sbt-scalajs-crossproject / sbt-scala-native-crossproject | 1.3.2 | 1.4.0 |
| sbt-mima-plugin | 1.1.4 | 1.2.1 |
| actions/checkout / actions/setup-java | v4 / v4 | v7 / v6 |
build.sbt was reformatted by the new scalafmt; the changes are alignment only.
Motivation
Preparation for the
1.0.0release. A 1.0 freezes both the API semantics and the binaryinterface, so this PR settles the one arbitrary runtime semantic (
evalordering), cleans upwhat the published artifact exposes to users (dependencies, resolvers), puts the machinery in
place to keep the 1.x line binary-compatible (MiMa + early SemVer), and widens the audience
with Scala.js and Scala Native artifacts — nearly free for a compile-time-only library.
Changes
evalnow runs handlers in field declaration orderPreviously handlers ran in alphabetical order of field name — an arbitrary choice that would
have been frozen by 1.0. Handlers now run in the declaration order of the source type's
primary-constructor fields; handled non-constructor fields (body
vals) come last, inregistration order. The contract is documented on
CaseComplete.evaland in the README, andpinned by tests that distinguish declaration, alphabetical, and registration order.
Internally,
compileImplalready knows the field order at expansion time, so the emitted codenow passes a single pre-ordered
List[SOURCE_TYPE => TARGET_TYPE]toCaseCompleteImpl,replacing the name-keyed
Map+ runtime sort.getHandledFieldspreserves registration orderto support this.
Cross-build for Scala.js and Scala Native
The build is now an sbt-crossproject (
CrossType.Pureat the repo root) targeting JVM,Scala.js 1.x, and Scala Native 0.5. Sources are shared; the full test suite runs on all
three platforms. Artifacts:
casecomplete_3,casecomplete_sjs1_3,casecomplete_native0.5_3.Test-only adjustments this surfaced:
java.time.Yearreplaced withInt(nojava.timeinthe JS/Native javalibs) and a
Doublefixture value replaced withInt(Scala.js renders7.0as"7").Binary-compatibility guardrail (MiMa)
sbt-mima-pluginwired into CI via the existing test invocation (sbt 'test; mimaReportBinaryIssues').mimaPreviousArtifactsis intentionally empty until1.0.0ships (it is a new baseline);the exact expression to flip afterwards is spelled out in
build.sbt.versionScheme := Some("early-semver")declared in the POM, and a compatibility-policysection added to the README.
Publishing hygiene
scalacticwas a compile-scoped dependency in the published POM;scalatest is now
% Test, so the library has zero runtime dependencies beyond the Scalastandard library (verified in the generated POM).
shibboleth-releases, Sonatype snapshots) — everything resolvesfrom Maven Central.
inThisBuild+ per-project blocks.Docs & CI
%%%), documentedevalordering, compatibilitypolicy, platform requirements, typo fix (
equivalant→equivalent).