Calendar icon indicating copy to clipboard operation
Calendar copied to clipboard

Consider turning off corelibrarydesugaring for this lib

Open yogurtearl opened this issue 9 months ago • 3 comments

Consider turning off core library desugaring: https://github.com/kizitonwose/Calendar/blob/14991af8c3ba9eeec5b2fba6a4c7fc8d22e2943f/core/build.gradle#L18

This forces any app that uses this library to also turn on core library desugaring, which slows down their build.

Most things can be done using the Kotlin standard library and avoiding using JDK apis that require core library desugaring.

If you are open to this, I can look into submitting a PR for this change.

yogurtearl avatar May 08 '24 14:05 yogurtearl

Most things can be done using the Kotlin standard library and avoiding using JDK apis that require core library desugaring.

This may be true, but the java.time APIs are much easier to work with. No point reinventing the wheel which will end up making the library usage even more difficult because you have to figure out how to do everything with the standard library. The increased build time is a small price IMO.

kizitonwose avatar May 10 '24 14:05 kizitonwose

Thoughts on making this library minSdk=26, which would allow using java.time without core library desugaring?

yogurtearl avatar May 10 '24 14:05 yogurtearl

I also use this in some projects, and they are all minSdk=24, I would not bump the min sdk for the sole purpose of dropping desugar. In the future, I'd consider splitting it into a separate module, but it is not a priority right now.

kizitonwose avatar May 11 '24 19:05 kizitonwose

FYI: In version 2.6.0, I will remove desugar requirement from the library (while keeping the current min sdk). All the calendar logic live in the core and data modules which are pure java/kotlin modules hence no need for desugar there. I have also seen that I can remove the requirement from the view and compose library modules as well, without changes to the min sdk.

There is already a snapshot published with this feature if you'd like to test that everything works as expected:

repositories {
    google()
    mavenCentral()
    // Add the snapshot repository
    maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}

dependencies {
    implementation("com.kizitonwose.calendar:view:2.6.0-SNAPSHOT")
    implementation("com.kizitonwose.calendar:compose:2.6.0-SNAPSHOT")  
}

kizitonwose avatar May 27 '24 16:05 kizitonwose

The latest 2.6.0-SNAPSHOT worked for me without enabling coreLibraryDesugaringEnabled true (minSdk 34), thanks for the fix! Tested with compose compiler gradle plugin 2.0.0 on compose-bom:2024.05.00. I was getting build failures with com.kizitonwose.calendar:compose:2.5.1 and com.kizitonwose.calendar:compose:2.6.0-beta01.

el1t avatar Jun 09 '24 01:06 el1t

@kizitonwose Any timeline/estimate for a beta/stable release with not desugar requirement? :)

MarcLFJ avatar Jun 11 '24 10:06 MarcLFJ

@MarcLFJ I was thinking to release it in version 2.6.0 with Compose UI 1.7, so I don't have to do a version bump twice. But maybe it makes sense to release it already.

kizitonwose avatar Jun 12 '24 13:06 kizitonwose

This is now released in version 2.5.2 for Compose UI 1.6, and version 2.6.0-beta02 for Compose UI 1.7 beta.

kizitonwose avatar Jun 15 '24 09:06 kizitonwose

Thanks a bunch! 🙏

MarcLFJ avatar Jun 18 '24 07:06 MarcLFJ