Skip to content

Splitties v2.0.0-alpha6

Pre-release
Pre-release
Compare
Choose a tag to compare
@LouisCAD LouisCAD released this 11 Nov 21:46
aa940e7

Version 2.0.0-alpha5 broke the API, this version fixes this.

Like version 2.0.0-alpha5, but without breaking the API from 2.0.0-alpha4

This release is mostly the same as 2.0.0-alpha5, but also has 2 very important things:

  • binary compatibility (minor change in Preferences experimental API excluded)
  • source compatibility, except an overload resolution ambiguity in View DSL, see the
    migration guide
    for a smooth migration.

Removed splits and versions sync

Version 2.0.0-alpha5 technically removed 2 splits (one was actually a renaming, the other one
a merging).

Consequently, you have to make sure your dependencies no longer reference these removed artifacts.
Easily done.

Problems arise when you depend on libraries that themselves depend on Splitties, which may be older
versions. These libraries may bring transitive dependencies to old modules that will clash with
ones from newer versions, and the versions they rely on may also mismatch with the ones you need,
and these older versions will take precedence if they are in library modules of your project that
don't depend explicitly on a newer version.

Fortunately, Gradle dependency resolution strategy allows to easily fix these issues all over your
project.

All you need to do is to make sure you have the following snippet into your root project's
build.gradle file:

allprojects {
    ext {
        splitties_version = '2.0.0-alpha6'
    }
    configurations.all {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            def req = details.requested
            if (req.group != "com.louiscad.splitties") return
            if (req.name == "splitties-uithread") {
                details.useTarget(
                        group: req.group,
                        name: "splitties-mainthread",
                        version: splitties_version
                )
                details.because("Splitties uithread has been renamed to mainthread")
            } else if (req.name == "splitties-viewdsl-appcompat-styles") {
                details.useTarget(
                        group: req.group,
                        name: "splitties-viewdsl-appcompat",
                        version: splitties_version
                )
                details.because("[Splitties] Split merged and removed")
            } else {
                details.useTarget(group: req.group, name: req.name, version: splitties_version)
                details.because("Transitive dependencies could take precedence otherwise")
            }
        }
    }
}

The snippet above, for all sub-projects (aka. modules):

  1. defines Splitties version in an ext property so it can be used in all build.gradle files.
  2. sets a resolution strategy for all configurations (like implementation or api) which:
  3. redirects any usage of the old splitties-mainthread artifact to the new
    splitties-mainthread one.
  4. redirects any usage of the old splitties-viewdsl-appcompat-styles artifact to the one it has
    been merged into: splitties-viewdsl-appcompat.
  5. makes sure all splitties artifacts versions are in sync, across all sub-projects.

If you don't do this but have a library using an old artifact in your dependencies, you'll
encounter gradle sync issues, or runtime issues, and the real cause may not appear clearly
(because of bugs in tooling).

Changes per module

Checked Lazy

uiLazy has been deprecated in favor of mainThreadLazy.

View DSL RecyclerView

The wrapInRecyclerView extension function now accepts an optional lambda to configure the wrapping
RecyclerView easily.