Add Scala 2.12 cross-building for all Scala 2 modules - #587
Open
jonoabroad wants to merge 2 commits into
Open
Conversation
Adds 2.12.20 to the build matrix for core, openai, claude, gemini, agent-testkit and the fs2/zio/pekko/akka streaming modules. The Scala 3-only modules (mcp, ox, examples, docs) and Scala Native targets are unchanged. Source adjustments, all cross-compatible with 2.13 and 3: - Replace 2.13-only stdlib calls: String.toLongOption, Either.orElse, Seq.distinctBy. - Provide sttp.ai.core.compat.unused: scala.annotation.unused does not exist on 2.12, so it is aliased on 2.13/3 and an inert annotation on 2.12 (with the warning category silenced on 2.12 rows only). - Materialise immutable Seqs where 2.12's default scala.collection.Seq is not accepted (multipartBody in OpenAI.scala, pekko/akka Source in test specs). - Add type ascriptions where 2.12's weaker inference fails (LoopAgent toolMap, SchemaSupport fold state, and two test specs). - Qualify assistants.Tool in Attachment: 2.12 resolves same-package members ahead of explicit imports (scala/bug#4695, fixed in 2.13), which silently bound the wrong Tool type. Docs updated to state 2.12 support. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
Adds Scala 2.12.20 to the build matrix for every module that already builds for 2.13:
core,openai,claude,gemini,agent-testkit, and the fs2/zio/pekko/akka streaming modules. The Scala 3-only modules (mcp,ox,examples,docs) and Scala Native targets are unchanged. Closes #586.Shared sources stay cross-compatible rather than duplicated (~14 small adjustments):
toLongOption,Either.orElse,distinctBy).sttp.ai.core.compat.unused:scala.annotation.unuseddoesn't exist on 2.12, so it's aliased on 2.13/3 and inert on 2.12 (warning category silenced on 2.12 rows only — 2.13 keeps full checking).collection.Seqisn't accepted; type ascriptions where 2.12's inference fails.Attachmentnow referencesassistants.Toolfully qualified — on 2.12 it silently bound the same-packageToolinstead of the imported one (scala/bug#4695, fixed in 2.13).ADR 0004 records the decision, the compat mechanisms, and the exit criterion; happy to drop or reword it if you'd rather record ADRs yourselves.
Verification
scalafmtCheckAll,compileDocumentation, and the fullsbt testaggregate pass; 2.13/3 unit suites are unchanged and green. Integration tests were not run (they need live API keys) — happy to run them against our own keys before merge if useful.🤖 Generated with Claude Code