feat: Add Scala 3 cross-compilation support - #723
Merged
Conversation
- Breaking change: *use normal circe instead of the ST forked one*. This may cause downstream breakage because of sbts global class loader. You'll just have to nag other maintainers to upgrade their circe if this causes problems - Replace gigahorse with Java's built-in HTTP client to avoid cross-version conflicts - Fix symbol literals throughout codebase (replace 'symbol with "string") - Fix collection conversions for Scala 2/3 compatibility - Add parallel collections compatibility layer for tests - Fix lambda parameter syntax for Scala 3 (add parentheses) - Configure cross-compilation for Scala 2.12.20 and 3.3.4 - All projects except sbt-converter now support Scala 3 Co-Authored-By: Claude <[email protected]>
…scary - because it seems this name change was done years ago
oyvindberg
force-pushed
the
pr/scala3-support
branch
from
September 28, 2025 14:23
f9cef1a to
35797e5
Compare
Replace hashCode usage with StableHash that generates consistent hashes across Scala 2 and Scala 3 compilations. This fixes the issue where SharedBuilder file names would differ between Scala versions due to unstable hashCode implementations in Scala 3.
Reverting from macos-latest-large back to macos-latest as requested. This uses the standard 3 vCPU / 7 GB RAM runners instead of the large ones.
oyvindberg
force-pushed
the
pr/scala3-support
branch
from
September 28, 2025 18:01
35797e5 to
40ff62d
Compare
The sbt-converter plugin is SBT 1.x specific and only works with Scala 2.12. Updated CI workflow to test all modules except sbt-converter when building with Scala 3.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds Scala 3 cross-compilation support to the ScalablyTyped Converter, enabling the project to build and run with both Scala 2.12 and Scala 3.
Key Achievement: Deterministic Output Across Scala Versions
A major accomplishment of this PR is achieving 100% identical output when generating TypeScript bindings across Scala 2.12 and Scala 3. This ensures:
Changes Made for Deterministic Output
1. Stable Hashing Implementation (
StableHash)hashCodeimplementation forProducttypes (case classes) changed between Scala 2 and 3, causing different hash values for the same dataStableHashutility that uses an inlined MurmurHash3 algorithm (same as Scala's default) with consistent seed values across all Scala versions2. Deterministic Method Renaming for Erasure Clashes (
CombineOverloads)combineSameErasureto sort grouped methods by:_Props,_PropNames) regardless of Scala version3. Library Version Hash Calculation
StableHashto all AST nodes and data structures involved in version calculation2.5.13-572b22are now identical across Scala versionsOther Scala 3 Compatibility Changes
Build Configuration
sbt-converteras Scala 2.12 only (SBT plugin limitation)sbt-converterfor Scala 3Code Compatibility
CI/CD Updates
sbt-converterfor Scala 3 buildsmacos-latestrunners from large runnersTesting
All existing tests pass on both Scala 2.12 and Scala 3, with identical output verified for:
ImporterTest3Breaking Changes
None. The converter maintains backward compatibility and produces identical output to previous versions.
Future Work
sbt-converterto Scala 3 when SBT adds proper Scala 3 support for plugins