openhab-addons icon indicating copy to clipboard operation
openhab-addons copied to clipboard

Bump Kotlin, okhttp, okio, and java-telegram-bot-api libraries

Open Skinah opened this issue 1 year ago • 17 comments

Update various libraries to their latest versions, and also make it easier to keep multiple bindings in sync with the latest and same version. No need to use 3+ different versions of the same library.

Updating java-telegram-bot-api to tackle some of the Telegram bugs and feature requests.

Skinah avatar Feb 25 '24 06:02 Skinah

out of curiosity: why do we have kotlin in our pom.xml? AFAIK Kotlin as a language itself not allowed to be used in OH. Are there libraries that we use and require kotlin?

stefan-hoehn avatar Feb 25 '24 07:02 stefan-hoehn

I am not the person to ask as I do not know enough about Java.... However I can point toward this info: https://square.github.io/okhttp/changelogs/upgrading_to_okhttp_4/ The okhttp3 lib has not had any updates in 4 years now as the lib has moved to Kotlin and any bug and security fixes are only being made in the okhttp4 Kotlin branch. To keep everything compatible they kept the package called okhttp3 even in V4 branch.

The Telegram binding uses... https://github.com/pengrad/java-telegram-bot-api And this lib then uses the okhttp3 lib, which in turn then needs the kotlin-stdlib.

Having looked at the code the past week, the Pengrad lib is very annoying to me when I have to keep referring to a json API for documentation reasons and then learn it all a second time in a java lib that is not documented fully. I believe it would be better to just get rid of it, and implement the Telegram API directly using Jetty and Gson libs. I may regret that statement, but I wont know until I try and do it directly. Anyone's thoughts on this?

Skinah avatar Feb 25 '24 09:02 Skinah

out of curiosity: why do we have kotlin in our pom.xml? AFAIK Kotlin as a language itself not allowed to be used in OH. Are there libraries that we use and require kotlin?

In the case of the Jellyfin add-on, it uses the official Jellyfin SDK which is developed in Kotlin.

GiviMAD avatar Feb 25 '24 10:02 GiviMAD

This PR will supersede #15903 and by that fix https://github.com/openhab/openhab-addons/security/dependabot/57.

jlaur avatar Feb 25 '24 12:02 jlaur

I believe it will also supersede #15902 I have tested the Telegram binding with the changes and it works.

Skinah avatar Feb 26 '24 08:02 Skinah

@lsiepel You requested a review from me but I doubt I can give any valuable input here. 🤷🏻‍♂️

stefan-hoehn avatar Feb 26 '24 09:02 stefan-hoehn

@lsiepel You requested a review from me but I doubt I can give any valuable input here. 🤷🏻‍♂️

I thought you did some testing for dbquery in the past for similar updates. Anyway, LGTM. @Skinah did you perform some testing with influxdb ? That is the only one left with a mayor release change.

lsiepel avatar Mar 02 '24 09:03 lsiepel

I do not use that bundle so I built it successfully with mvn clean install and then dropped it in the addons folder. I got an error in the logs that was stating I did not have it setup or have any strategies setup.

Skinah avatar Mar 04 '24 04:03 Skinah

I do not use that bundle so I built it successfully with mvn clean install and then dropped it in the addons folder. I got an error in the logs that was stating I did not have it setup or have any strategies setup.

Are you planning to tests this a bit further? I think this part needs some basic testing before it can be merged. Maybe someone else that uses influx? (personally i have never used it)

lsiepel avatar Mar 04 '24 17:03 lsiepel

I have a pi3 setup for testing, so I can do this sometime next week... hopefully. If someone has it already setup it would save me a lot of time. I agree this should be tested further then a basic compile.

Skinah avatar Mar 07 '24 01:03 Skinah

I could try the addon in my RPi4 environment with latest milestone release installed and influxdb running, if this would help. But as I'm only a semi-professional end-user, I sadly can't build the addon myself.

justauser0815 avatar Mar 08 '24 15:03 justauser0815

OK after more then 6 hours of getting influxdb installed, working and then trying to work out the dependancies, I finally got it working with this log output showing its connecting and talking to the Database...

2024-03-10 07:26:34.841 [DEBUG] [rnal.influx1.InfluxDB1RepositoryImpl] - database status is OK, version is 1.8.10
2024-03-10 07:26:34.844 [INFO ] [.influxdb.InfluxDBPersistenceService] - InfluxDB persistence service started.

Release notes for v7.0.0 of the influxdb-client-java library that lists the dependencies it uses... https://github.com/influxdata/influxdb-client-java/blob/master/CHANGELOG.md#700-2024-01-30

@justauser0815 Your welcome to try it out from my personal server below, but I would caution you against it unless your capable of backing up and restoring the database if something goes wrong, or like myself you are testing it on a spare raspberry pi with a load you do not care about. This has updated multiple libraries from very outdated ones v4.3.0 [date released 2022-02-18] to 7.0.0 this is a very big jump and multiple libs have been bumped in their versions. It would be great to have another person test it due to the number of large changes the libraries have probably gone through.

If your having issues or bad performance with influxdb, then it is worth trying it for sure. I am only saying the above as a disclaimer it should work just fine.

http://pcmus.com/openhab/org.openhab.persistence.influxdb-4.2.0-SNAPSHOT.jar

Skinah avatar Mar 10 '24 07:03 Skinah

Thank you very much! I will definitely give it a try. I have an extra raspberry for testing. Is your updated version of the telegram binding already available somewhere for testing?

justauser0815 avatar Mar 10 '24 10:03 justauser0815

I put the telegram changes on hold till this gets merged. Its a single file I can drop back in once this is sorted to get the changes and then compile.

Skinah avatar Mar 10 '24 12:03 Skinah

@lsiepel I cancelled the build as it was already at 4 hours and did not look like it was progressing. Is it a problem with the build system as it is building fine here?

Skinah avatar Mar 10 '24 12:03 Skinah

Maybe @wborn has a clue as i think he is an expert on this matter. I also cancelled the build after 4:20.

lsiepel avatar Mar 10 '24 20:03 lsiepel

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/openhab-4-2-milestone-discussion/154316/45

openhab-bot avatar Mar 12 '24 12:03 openhab-bot

I cancelled the build as it was already at 4 hours and did not look like it was progressing. Is it a problem with the build system as it is building fine here?

I think there is a problem with full PR builds for the time being. Jenkins builds time out after 4 hours and GitHub Actions builds after 6 hours. However, I just saw one full Jenkins build succeed today, so maybe there is hope: #16526.

jlaur avatar Mar 16 '24 14:03 jlaur

@Skinah - just to be sure: Was commit 0941c20baf9b676fd4c216262bfc1c6b20b20245 due to build failing, or some other issue? The build now succeeded.

jlaur avatar Mar 18 '24 09:03 jlaur

@jlaur Yes I dropped the okio jar back to the older version because that one passed an earlier build before something must have changed on the build system. I have now updated them all to the latest versions as of this point in time, and it is now passing, thanks to whatever and who made the change. I certainly understand why we end up with so many different version of the same libraries now.

Skinah avatar Mar 22 '24 00:03 Skinah

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/openhab-4-2-milestone-discussion/154316/60

openhab-bot avatar Mar 24 '24 14:03 openhab-bot

Removing additional testing tag as I have tested and now a user has confirmed it also fixes an issue on their system in the thread that is linked just above.

Skinah avatar Mar 29 '24 05:03 Skinah