Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop-in compatibility adjustments #210

Merged
merged 31 commits into from
Dec 5, 2023

Conversation

andrewparmet
Copy link
Collaborator

@andrewparmet andrewparmet commented Nov 23, 2023

  • bump copied generated code to 0.12.1, the last version that had the old package names (includes KtGeneratedFileDescriptor annotation)
  • remove old protokt.proto file so that buf is happy that only one file has the protokt extension number
  • consolidate jvm extensions modules into multiplatform modules (puts files back in those JARs that were there before the 1.0 reorganization)
  • rename protokt outer class to be consistent with protobuf-java
  • remove kotlin-reflect from dependencies of protokt-core
  • remove interop between old and new generated code, as it is not needed for old generated code to function with the new runtime
  • undo manual adjustments to copied generated code as part of the above
  • kapt in multiplatform modules fails with: /Users/.../protokt/extensions/protokt-extensions-simple/build/tmp/kapt3/stubs/main/com/toasttab/protokt/ext/LocalDateStringConverter.java:3: error: incompatible types: NonExistentClass cannot be converted to Annotation @error.NonExistentClass(). Not sure what's up.

@andrewparmet andrewparmet changed the title bump copied generated code to the last version before api changed bump copied generated code to the last version before api changed; remove old protokt.proto file Nov 23, 2023
@andrewparmet andrewparmet changed the title bump copied generated code to the last version before api changed; remove old protokt.proto file options proto reorganization Nov 24, 2023
(protokt.v1.property).wrap = "java.net.InetAddress"
];

bytes address = 1;
Copy link
Collaborator Author

@andrewparmet andrewparmet Nov 24, 2023

Choose a reason for hiding this comment

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

No reason to wrap this if the outer type is going to be wrapped. (Plus, it won't compile on Kotlin JS.)

@andrewparmet andrewparmet changed the title options proto reorganization drop-in compatibility adjustments Nov 24, 2023
@@ -75,26 +73,12 @@ private class MessageGenerator(
.addMember(msg.fullProtobufTypeName.embed())
.build()
)
handleDeprecatedKtGeneratedMessage()
// put this back when handleDeprecatedKtGeneratedMessage() is removed
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just suppress deprecation on every file we generate.


// do not generate DefaultImpls objects since we do not target < JVM 1.8
// https://blog.jetbrains.com/kotlin/2020/07/kotlin-1-4-m3-generating-default-methods-in-interfaces
freeCompilerArgs = listOf("-Xjvm-default=all")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Article states this will eventually be the default.

import protokt.v1.google.protobuf.StringValue
import java.time.LocalDate

@AutoService(Converter::class)
Copy link
Member

Choose a reason for hiding this comment

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

how does this work now?

@@ -0,0 +1,9 @@
protokt.v1.DurationConverter
Copy link
Member

Choose a reason for hiding this comment

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

oh, I see

maybe we can use KSP to generate this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe. Project for another time.

@andrewparmet andrewparmet merged commit eeb79a6 into open-toast:main Dec 5, 2023
@andrewparmet andrewparmet deleted the bump-copied-generated-code branch December 5, 2023 16:03
ogolberg pushed a commit to ogolberg/protokt that referenced this pull request Jan 2, 2024
- bump copied generated code to 0.12.1, the last version that had the old package names (includes KtGeneratedFileDescriptor annotation)
- remove old protokt.proto file so that buf is happy that only one file has the protokt extension number
- consolidate jvm extensions modules into multiplatform modules (puts files back in those JARs that were there before the 1.0 reorganization)
- rename protokt outer class to be consistent with protobuf-java
- remove kotlin-reflect from dependencies of protokt-core
- remove interop between old and new generated code, as it is not needed for old generated code to function with the new runtime
- undo manual adjustments to copied generated code as part of the above
- kapt in multiplatform modules fails with: /Users/.../protokt/extensions/protokt-extensions-simple/build/tmp/kapt3/stubs/main/com/toasttab/protokt/ext/LocalDateStringConverter.java:3: error: incompatible types: NonExistentClass cannot be converted to Annotation @error.NonExistentClass(). Not sure what's up.
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.

2 participants