Skip to content

Add Scala 3.7.4 cross-build#110

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/add-scala-3-crossbuild
Draft

Add Scala 3.7.4 cross-build#110
Copilot wants to merge 3 commits into
mainfrom
copilot/add-scala-3-crossbuild

Conversation

Copilot AI commented May 27, 2026

Copy link
Copy Markdown

Adds Scala 3.7.4 as a cross-build target alongside the existing 2.12/2.13 builds, eliminating the need for CrossVersion.for3Use2_13 workarounds in downstream projects.

Key challenges

  • data-class is Scala 2 only: io.github.alexarchambault::data-class:0.2.7 has no _3 artifact. All files using @data annotations must be handled separately.
  • Stream removed in Scala 3: replaced by LazyList.

Approach: version-specific source directories

Source files are split into src/ (version-agnostic), src-2/ (Scala 2.x), and src-3/ (Scala 3):

File Change for Scala 3
Version.scala StreamLazyList, @data classcase class
VersionInterval.scala @data classcase class
ModuleMatcher.scala @data classcase class, @unroll on attributeMatchers
ModuleMatchers.scala @data classcase class, @unroll on includeByDefault (replaces @since)
VersionConstraint.scala @data classcase class for Lazy/Eager; add explicit withLatest to Eager (previously generated by @data)

build.mill changes

  • Added scala3 = "3.7.4" to DepVersions
  • sources task selects src-2/ or src-3/ based on Scala version
  • compileMvnDeps skips data-class for Scala 3
  • mvnDeps includes com.lihaoyi:::unroll-annotation:0.3.0 for Scala 3 (no compiler plugin needed with Scala 3.7+)
  • scalacOptions uses -release 8 (single dash) for Scala 3 vs --release 8 for Scala 2

Binary compatibility

The @unroll annotation (from com.lihaoyi:::unroll-annotation:0.3.0) is used on Scala 3 case class parameters with default values to generate binary-compatible constructor/apply/copy overloads — replacing the role that @since played with data-class in the Scala 2 version.

Copilot AI linked an issue May 27, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add cross-build support for Scala 3.3.7 Add Scala 3.3.7 cross-build May 27, 2026
Copilot AI requested a review from alexarchambault May 27, 2026 19:30

@alexarchambault alexarchambault left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Actually, add support for 3.7.4 instead, and use the @unroll annotation

Copilot AI commented May 27, 2026

Copy link
Copy Markdown
Author

Actually, add support for 3.7.4 instead, and use the @unroll annotation

Done in the latest commit:

  • Switched from Scala 3.3.7 to 3.7.4
  • Added com.lihaoyi:::unroll-annotation:0.3.0 as a Scala 3 dependency (no compiler plugin needed with 3.7.4)
  • Applied @unroll to ModuleMatcher.attributeMatchers and ModuleMatchers.includeByDefault (which was @since in the Scala 2 version) to generate binary-compatible overloads

Copilot AI changed the title Add Scala 3.3.7 cross-build Add Scala 3.7.4 cross-build May 27, 2026
Copilot AI requested a review from alexarchambault May 27, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Scala 3 crossbuild

2 participants