Skip to content

Conversation

@kubukoz
Copy link
Member

@kubukoz kubukoz commented May 28, 2025

Closes #1500

Known TODOs:

  • Support bincompat-friendly traits
  • Constrain the version scheme somewhat (so that it can have proper ordering)
  • Support enums, intEnums
  • Decide what's up with Nullable
  • Documentation
  • Generate stdlib in a separate PR/branch to prove the encoding works: POC: Generate bincompat-friendly core module #1776
  • Tweak union encoding to look closer to the currents

PR Checklist (not all items are relevant to all PRs)

  • Added unit-tests (for runtime code)
  • Added bootstrapped code + smoke tests (when the rendering logic is modified)
  • Added build-plugins integration tests (when reflection loading is required at codegen-time)
  • Added alloy compliance tests (when simpleRestJson protocol behaviour is expanded/updated)
  • Updated dynamic module to match generated-code behaviour
  • Added documentation
  • Updated changelog

@kubukoz
Copy link
Member Author

kubukoz commented Jun 17, 2025

good news, so far this DOES work

@kubukoz kubukoz force-pushed the bincompat-friendly-codegen branch 2 times, most recently from c66e403 to 3fe1aa4 Compare July 3, 2025 21:26
@kubukoz kubukoz force-pushed the bincompat-friendly-codegen branch from 3fe1aa4 to 04afeb1 Compare July 3, 2025 21:28
@kubukoz kubukoz changed the title (just started, don't even think of looking) Bincompat-friendly codegen Bincompat-friendly codegen V1 Jul 3, 2025
@kubukoz kubukoz force-pushed the bincompat-friendly-codegen branch 3 times, most recently from 0ff40e5 to a4c6988 Compare July 3, 2025 21:58
@kubukoz kubukoz force-pushed the bincompat-friendly-codegen branch from a4c6988 to a1d02b4 Compare July 3, 2025 22:47
}
@trait(selector: "structure[trait|smithy4s.meta#bincompatFriendly] > member")
@traitValidators({
Copy link
Contributor

Choose a reason for hiding this comment

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

I see you've evolved to a higher plane of consciousness

Copy link
Member Author

Choose a reason for hiding this comment

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

Only level 5 or 6 my dude

s"Failed to compile ${baseline._1} with Scala $scalaVersion and code:\n$scalaCode"
) {
os.proc(
"scala-cli",
Copy link
Contributor

@Baccata Baccata Jul 4, 2025

Choose a reason for hiding this comment

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

sweet baby jeebus !

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 wanted a programmatic api for the compiler but there's no common interface for scala 2/3 :(

In any case, we need thiss

val visitor: Lines = lines(
block(line"trait Visitor[A]")(
block({
// In bincompat-friendly mode, we can't allow using the raw visitor - only the Default variant is safe to use.
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@Baccata
Copy link
Contributor

Baccata commented Jul 4, 2025

So far I think this is a pretty damn good job !

@kubukoz
Copy link
Member Author

kubukoz commented Jul 7, 2025

enums now work, the tests include a workaround for VirtusLab/scala-cli#3735

@kubukoz kubukoz marked this pull request as ready for review July 12, 2025 00:31
Copy link
Contributor

@Baccata Baccata left a comment

Choose a reason for hiding this comment

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

This is great work, I'm not gonna nitpick on it (don't even have anything to nitpick on at a glance). Kudos !

@Baccata
Copy link
Contributor

Baccata commented Jul 17, 2025

@lewisjkl , could you do a review as well when time permits ?

Copy link
Contributor

@lewisjkl lewisjkl left a comment

Choose a reason for hiding this comment

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

Wow, that was a lot of work! Amazing stuff 🎉

@kubukoz
Copy link
Member Author

kubukoz commented Jul 18, 2025

work build is happy, feel free to merge on green 👍 if you beat me to it

@kubukoz kubukoz changed the title Bincompat-friendly codegen V1 Bincompat-friendly codegen V1, initialize trait Java codegen plugin Jul 18, 2025
@kubukoz kubukoz merged commit 6438ea1 into series/0.18 Jul 18, 2025
11 checks passed
@kubukoz kubukoz deleted the bincompat-friendly-codegen branch July 18, 2025 14:49
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.

Bincompat-friendly codegen

4 participants