android-gif-drawable icon indicating copy to clipboard operation
android-gif-drawable copied to clipboard

#457: Converted java to Kotlin

Open rahul13agrawal opened this issue 1 year ago • 6 comments

Fixes: https://github.com/koral--/android-gif-drawable/issues/457

rahul13agrawal avatar Oct 11 '23 08:10 rahul13agrawal

@koral-- Let me know if more comments on the review. I have resolved the comments couple of days back.

rahul13agrawal avatar Oct 20 '23 03:10 rahul13agrawal

Changes are looking very good. Great work!

I plan to add some binary compatibility checker https://plugins.gradle.org/search?term=binary-compatibility and depending on the results decide whether it will be version 2.x or we can keep the backwards compatibility and stick to 1.x. Some minor changes like changing the visibility to internal may be required next.

I'll try to do that in a few days from now.

koral-- avatar Oct 20 '23 10:10 koral--

Hi @rahul13agrawal I've just added https://github.com/Kotlin/binary-compatibility-validator. You can rebase on the latest dev and execute the gradle tasks:

  • apiCheck- this will give you a diff in terminal
  • apiDump - this will overwrite the current apiDump file so you can inspect the git diff in your Android Studio or whatever you prefer

It is perfectly OK that some method or class gets added. It will happen for e.g. all companion objects. But, if signature of the method, class or field has changed it can break the compatibility for existing users. The diff is quite large now, but here are some easily fixable insights:

  1. classes become final by default in kotlin, so we need to add open modifiers, this also applies to methods
  2. some fields like GifError.description were replaced by methods, you can probably use @JvmField for them
  3. some extra methods are added like GifDrawable.setMIsRunning which should probably not be part of an API

koral-- avatar Oct 24 '23 13:10 koral--

@koral-- I will go through this by this weekend.

rahul13agrawal avatar Oct 26 '23 08:10 rahul13agrawal

Hi @koral-- Sorry for such late response. I have rebase with the latest changes but whenever I run ./gradlew apiCheck or apiDump I get build successful. I am unable to find any changes. Neither in Android Studio nor in the terminal. I have gone through https://github.com/Kotlin/binary-compatibility-validator and tried to check but with no result.

rahul13agrawal avatar Nov 15 '23 06:11 rahul13agrawal

Indeed, it seems that disabling the check in the sample module only causes disabling it entirely. I need to investigate this.

In the meantime you can comment out or delete this line: https://github.com/koral--/android-gif-drawable/blob/dev/sample/build.gradle#L65 and ignore the generate dump of the sample module.

koral-- avatar Nov 15 '23 11:11 koral--