-
Notifications
You must be signed in to change notification settings - Fork 64
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
Replace hand-written bsp4j and bsp4s with generated versions #555
Conversation
de14105
to
1758f35
Compare
1758f35
to
2986cbe
Compare
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.
In this PR we have a lot of breaking method name changes, such as buildInitialize
-> initializeBuild
. From separate discussion, I understand this is for consistency of naming. I also understand we couldn't keep the current naming of everything and have it be both consistent and api/binary compatible. However I'd prefer to keep incompatible changes to a minimum. What do others think?
I don't think there are that many users of our libraries, so introducing these (minor tbh - that's a few renames and moving setters to constructor parameters or vice versa in a few classes) breaking changes will not cause a leftpad incident ;) |
I'll try to review this early next week when I'm back, but since this does include some breaking changes I think we should also ping Just so they are aware ASAP and can also provide some input on the breakage. Also, can you include a few words/steps for others to test if this if they wanted? For example: To test this you'll need to do the following
This would be helpful to ensure a quicker review so people don't have to dig through it to find out how to run it. |
Could we put the renames into a separate commit, so that they are easier to review? |
not really, but I did my best to list all the breaking changes in the PR description |
They are named based on the json-rpc method name, like
It does, as in above example
The addition is still new, maybe we can fix it?
I guess alphabetical makes sense for minimal conflicts in future additions
UpperCamelCase is pretty idiomatic for constants in Scala |
Yes, of course you are right. I'll fix it then.
I'll fix it in the next commit.
This too. |
I reverted the renames and opened #562 |
Question to SBT wizards: what should I do to have |
You could do that, but I don't think you'd want to. |
There's also #506 |
Because the entire codebase for bsp4j and bsp4s are now generated, there's never a situation where you'd want to run a |
I suggest creating a dedicated task for generating and compiling then to not mess with expected behavior of tasks too much. Something like val buildGeneratedCode := {
codegen.value
xtend.value
compile.value
} My sbt is rusty, might not fully work like this |
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.
So I think we can live with some minor breaking changes on generated API level, so from my side it's good to go! I'd like to get feedback from the other tool maintainers though.
Unfortunately our property tests are flaky... |
I might have overlooked it, as this PR is quite large. Is there an API now, to get the implemented protocol version? Or did you decide to make version-specific artifacts? |
I don't think we've decided anything :) |
But there's always been a request for getting the BSP version: in the build/initialize request first the client says the version of BSP it uses and then the server replies with its BSP version |
The issue here though is knowing which BSP version the library supports, as opposed to the server. It should be somehow clear or discernible from the programmer's perspective. It could be as simple as a hard coded string that can be reall easily navigated to. |
Exactly. I'd like to use that library hard-coded version to use in the BSP Server implementation to answer the question, which BSP version does this server speak. |
Ahh, I see now. Okay, so let me implement it. |
If there's no objections by Wednesday, let's merge this, okay? |
Thanks for notifying me. I won't have time to review this PR but I support the main idea and I have no objection to merge it. |
Some things are going to break because bsp4j, bsp4s and the typescript definition of the protocol sometimes didn't agree one with another. In other cases the libraries were internally inconsistent because of copy-pasting.
What's going to break:
In bsp4j:
onConnectWithServer
is removed - it wasn't a proper json-rpc notification anyway - probably a leftover from some older version? Also it wasn't defined in the spec at all.MessageType.INFORMATION
is renamed toMessageType.INFO
. The spec clearly saysINFO
: https://build-server-protocol.github.io/docs/specification#messagetypeJvmBuildTarget
structure were optional in the protocol and bsp4s, so in the corresponding bsp4j class they were moved from constructor parameters to setters. We can either change (the protocol AND bsp4s) or bsp4j. I chose the latter option. But I don't know if these fields being optional make any sense.DebugSessionParams
had an obligatorydataKind
which was illegal according to the specIn bsp4s:
CleanCacheResult
no longer has amessage
field. It wasn't defined in the spec.value
for getting the inner value (previously some used id, some used code and some used value)In spec:
Non-breaking changes:
dataKind
, but they didn't. Now they do.${language}Extension
.xtend files are broken into separate classes for each structureJvmEnvironmentItem
there was this useless identity assignmentAll of the changes above come from the fact that now everything is generated from the smithy model in a consistent way. Hand-written implementations were inconsistent in many places. I didn't introduce any special cases/hardcode anything. But as you can see, all of the breaking changes are very minor/simple.
In bsp4s there's a constant
Bsp4s.ProtocolVersion
and in bsp4jBsp4j.PROTOCOL_VERSION
with the supported protocol version.To test this you'll need to do the following
sbt generate
sbt test
to show that all the normal tests are still passing, etc