Skip to content

Conversation

@paul-sachs
Copy link
Member

  • Modified generator to not create cycles
  • Add lint rule
  • Fix linting imports
  • Remove lint rule to restrict duplicate imports

Comment on lines +40 to +59
if bootstrapWKT {
return &Runtime{
ProtoN: symbolPool.new(syntax.String(), fmt.Sprintf("./%s.js", syntax.String())),
Message: symbolPool.new("Message", "./message.js"),
PartialMessage: symbolPool.new("PartialMessage", "./message.js").ToTypeOnly(),
PlainMessage: symbolPool.new("PlainMessage", "./message.js").ToTypeOnly(),
FieldList: symbolPool.new("FieldList", "./field-list.js").ToTypeOnly(),
MessageType: symbolPool.new("MessageType", "./message-type.js").ToTypeOnly(),
BinaryReadOptions: symbolPool.new("BinaryReadOptions", "./binary-format.js").ToTypeOnly(),
BinaryWriteOptions: symbolPool.new("BinaryWriteOptions", "./binary-format.js").ToTypeOnly(),
JsonReadOptions: symbolPool.new("JsonReadOptions", "./json-format.js").ToTypeOnly(),
JsonWriteOptions: symbolPool.new("JsonWriteOptions", "./json-format.js").ToTypeOnly(),
JsonValue: symbolPool.new("JsonValue", "./json-format.js").ToTypeOnly(),
JsonObject: symbolPool.new("JsonObject", "./json-format.js").ToTypeOnly(),
ProtoInt64: symbolPool.new("protoInt64", "./proto-int64.js"),
ScalarType: symbolPool.new("ScalarType", "./field.js"),
MethodKind: symbolPool.new("MethodKind", "./service-type.js"),
MethodIdempotency: symbolPool.new("MethodIdempotency", "./service-type.js"),
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Couldn't think of a better way to handle this without doing some significant rearchitecting. I think it's sufficient, if a little frail.

@paul-sachs paul-sachs requested a review from timostamm June 15, 2022 03:55
Copy link
Member

@timostamm timostamm left a comment

Choose a reason for hiding this comment

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

I can't think of a simple alternative either. The tight coupling to the internal file layout of the runtime library is not ideal, but as long as we keep releasing generator and library in sync, any possible mismatch we introduce will be caught by CI - the tests deliberately run in a separate package to catch things like that.

Thanks for the fix, this is great! We can remove index-runtime.ts and some other bits now, I'll open a follow-up.

timostamm added a commit that referenced this pull request Jun 15, 2022
After #119, we can revert the introduction of index-runtime.ts, and don't need runtimeImportPathBootstrapWKT anymore.
@paul-sachs paul-sachs merged commit 5ac6c55 into main Jun 15, 2022
@paul-sachs paul-sachs deleted the psachs/tcn-115-avoid-circular-imports-in-the-well-known branch June 15, 2022 11:52
@timostamm timostamm mentioned this pull request Jun 15, 2022
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.

3 participants