-
Notifications
You must be signed in to change notification settings - Fork 152
Remove circular dependencies #119
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
Remove circular dependencies #119
Conversation
paul-sachs
commented
Jun 15, 2022
- Modified generator to not create cycles
- Add lint rule
- Fix linting imports
- Remove lint rule to restrict duplicate imports
| 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"), | ||
| } | ||
| } |
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.
Couldn't think of a better way to handle this without doing some significant rearchitecting. I think it's sufficient, if a little frail.
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.
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.
After #119, we can revert the introduction of index-runtime.ts, and don't need runtimeImportPathBootstrapWKT anymore.