-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Migrate to Kotlin #44
Comments
Would this involve making the response objects typed? |
Please also read this note on the same topic: docker-client/docker-compose-v3#1 (comment) My idea is to increase convenience for library users like you, while also keeping flexibility on the Docker api facing side. Since there will be some kind of middle ground between convenience (more types) and flexibility (less types) I'll have to decide where to make a cut. Historically, I prefer flexibility. There are several reasons: one would be to stay as compatible across Docker versions as possible, another one would be that there is another Docker Java client available with a strongly typed model. My actual plan goes like this: I already moved the low level classes handling the boring technical stuff into its own library at https://github.com/docker-client/docker-engine. Then I'd like to implement a convenient layer on top of the current docker-client with the typical use cases like Regarding your question about response objects: yes, I'm aiming at providing the typically useful response objects or properties in a typed manner. Yet, I suppose that there are edge cases where the effort to maintain the mapping from the HTTP api to Java types might be too much. That's where I'm thinking of some kind of "detailed" response, which is exactly the same like today. Maybe an example might help. Consider the response of
Here |
WIP: #149 |
A strongly typed docker-client is now used internally, and we're going to work on the following aspects:
|
Hi, is this issue still worked on? |
@huehnerlady would you mind creating a separate issue to support Groovy 4.x? I think it should be quite easy to upgrade the Docker Client to Groovy 4. Upgrading the whole concept like described above has proven to be very slow and with baby steps due to lack of time. Are you using the docker-client directly or via gradle-docker-plugin? I would have to ensure that Gradle supports Groovy 4 in a plugin runtime context. |
we are using it directly in one lib |
After the underlying libs (docker-filesocket and docker-compose-v3) have already been migrated, the time has come to convert the main repository.
My philosophy behind this Docker client is to keep the Docker engine facing side as flexible as possible (to keep our code as stable as possible for different engine api versions). Types might be less convenient, so I have no idea whether Kotlin is counter productive.
My main motivation to introduce Kotlin is the library's client facing side. A strongly typed api certainly helps to use a library given a capable IDE. That way, the lack of documentation might be compensated to a certain degree.
Things to keep in mind:
There's no static modifier in Kotlin.
static someMethod(){}
could be converted to@JvmStatic fun someMethod()
, but it would also be valid to simply remove the static modifier and makesomeMethod()
an instance method.We should focus on the production code first. Test code can also be converted to Kotlin, but with low priority. I'm a fan of the Groovy Spock framework and there's no equivalent in Kotlin, yet (I didn't find any). Spek seems to be the most similar alternative as of today.
See docker-client/docker-filesocket@620cc55 for a first try at converting from Groovy to Kotlin.
The text was updated successfully, but these errors were encountered: