Skip to content

1.2.2

Choose a tag to compare

@arnaudgiuliani arnaudgiuliani released this 04 Nov 13:12

Compile safety on Kotlin/Native and wasm/JS now sees your whole graph, and multi-module projects get far fewer false errors.

✨ Added

  • Hidden dependency check (opt-in): koinCompiler { hiddenDependencyCheck = "warning" } (or "error") lists the modules that the startKoin module reaches only through a transitive implementation dependency, so compile safety can't fully check them. JVM and Android.

🐛 Fixed

  • Native, wasm and JS: definitions from another Gradle module were invisible to compile safety. You got a false KOIN-D002, or a real missing dependency passed the build (#105, #106, #113). If you turned compileSafety off for these targets, turn it back on.
  • False KOIN-D001 / KOIN-D004 across modules: on DSL parameters that need no provider (default value, nullable, List<T>, Lazy<T>, @InjectedParam, @Property, @Provided, @ScopeId) (#115), on qualified function providers (#96), on a @Single fun provider two modules away (#114), and on a DSL module from another Gradle module loaded by startKoin<MyApp> (#124, single only for now: factory and scoped still need @Provided).
  • @Single(binds = [X::class]) on a class from another module lost its binding: false KOIN-D001, and getAll<X>() empty at runtime (#98).
  • False KOIN-W001 / KOIN-D002: after moving a module to another package, on includes() chains of 3+ modules, on a module returned by a function, and on a Koin built elsewhere (#58). False KOIN-D006 on activityViewModel<T>() (#121).
  • Crashes: "No classId" on local classes and anonymous objects (#101), invalid IR when a definition in another module targets an internal class (#74), Kotlin daemon out of memory on multi-module builds (#110).
  • Configuration cache is no longer thrown away on every Kotlin edit.

🔧 Changed

  • More of your graph is checked: a green build can now fail on a real missing dependency.
  • Explicit binds across modules: the class is bound to exactly its binds, as within one module (#98).
  • strictSafety: strictSafety = false is honored on the startKoin module, with a warning (#120), and strictSafetyForceOff is deprecated. AGP 9 modules are now detected. With compileSafety = false, it no longer scans or logs (#88).
  • New warnings KOIN-W008 to KOIN-W011: module definitions not visible, a call on your own Koin, activityViewModel<T>() without parametersOf(), a module chosen at runtime. They fail allWarningsAsErrors builds.
  • KMP libraries with apiCheck: run apiDump once for the new org.koin.plugin.hints entries. Libraries built with 1.1.0 to 1.2.1: rebuild them with 1.2.2 to get the #96 fix.

✅ Compatibility

  • Koin 4.2.0+
  • Kotlin 2.3.20, 2.4.0, 2.4.10, 2.4.20

📦 Install

plugins {
    id("io.insert-koin.compiler.plugin") version "1.2.2"
}

Thanks

@PhBogdanov traced the KLIB root cause down to the Kotlin serializer across four Kotlin versions (#106), and found and fixed the daemon memory leak (#111). @shreknitin89 (#116), @cpaleop (#90) and @paulnunezm (#128) sent fixes this release builds on.

Thanks to everyone who reported, reproduced and retested: @acmpo6ou, @af-jul, @ahmedhappa, @alexandru-calinoiu, @andrew-turner-control4, @aoreshkov, @axiel7, @brueggenthies-adesso, @dakatso, @dmitry-stakhov, @emartynov, @exoego, @Faltenreich, @GoodSir42, @hmy65, @ikurek, @imcmib, @JajaComp, @jamesarich, @kfaraj, @Komdosh, @MattSkala, @nabiu256, @nagatsuka-shuuya, @oscardavison, @PhilippNowak96, @renaudmathieu, @sanders9, @smartine-ledger, @stzouvaras, @tylerwilson, @VladimirPupavaESET, @xephosbot, @yaroslav-v and @zjarlin.

Your feedback is welcome 🙏

Full changelog: 1.2.1...1.2.2