-
Notifications
You must be signed in to change notification settings - Fork 14
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
Final updates to runtime and codegen fixes #352
Conversation
@@ -89,7 +89,7 @@ fun Project.enablePublishing(defaultJars: Boolean = true) { | |||
configure(KotlinMultiplatform(JavadocJar.Empty())) | |||
} | |||
pluginManager.withPlugin(KotlinPlugins.JVM) { | |||
configure(KotlinJvm(JavadocJar.Empty(), true)) | |||
configure(KotlinJvm(JavadocJar.Empty())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the default value.
subprojects { | ||
group = "${rootProject.group}.thirdparty" | ||
} | ||
group = "com.toasttab.protokt.thirdparty" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was getting clobbered by the common-conventions plugin - we've been publishing to the wrong group since that change went in.
@@ -61,7 +70,7 @@ internal object Implements { | |||
} | |||
|
|||
private fun TypeSpec.Builder.delegateProperties(msg: Message, ctx: Context, canonicalName: String, fieldName: String) { | |||
val fieldsByName = msg.fields.filterIsInstance<StandardField>().associateBy { it.fieldName } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't exclude overrides that are oneofs.
@@ -77,7 +77,7 @@ internal object Implements { | |||
field.name, | |||
(field.returnType.classifier as KClass<*>).asTypeName() | |||
.let { | |||
if (assumeNotNull) { | |||
if (assumeNotNull && !field.returnType.isMarkedNullable) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't delegate a field and mark it as non-nullable if the delegated field is nullable in the interface.
@@ -159,6 +159,9 @@ private class MessageGenerator( | |||
.build() | |||
) | |||
} | |||
if (property.overrides) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the name of a field is the same as the field on the interface and we generate a non-null accessor for it, the override needs to be on the generated delegating property, not the non-null accessor.
@@ -56,7 +56,6 @@ private fun generateFdpObjectNames(files: List<FileDescriptorProto>): Map<String | |||
Pair( | |||
fdp.name, | |||
fdp.fileOptions.protokt.fileDescriptorObjectName.takeIf { it.isNotEmpty() } | |||
?: fdp.fileOptions.default.javaOuterClassname.takeIf { it.isNotEmpty() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore all Java options.
@@ -43,11 +45,7 @@ internal object Nullability { | |||
type !in setOf(FieldType.Message, FieldType.Enum) | |||
|
|||
fun propertyType(o: Oneof) = | |||
if (o.generateNonNullAccessor) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was previously non-functional but now that it can sometimes be true, it was causing compilation failure.
Uncovered a few bugs when starting to demonstrate some internal upgrades.
Puts back a non-null accessor generator option for oneof fields.
New extension number reservation has been approved: protocolbuffers/protobuf#20485