Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Build](https://img.shields.io/github/actions/workflow/status/harrytmthy/stitch/ci.yml?branch=main&label=build&logo=githubactions&logoColor=white&style=flat-square)](https://github.com/harrytmthy/stitch/actions)
[![License](https://img.shields.io/github/license/harrytmthy/stitch?label=license&color=blue&style=flat-square)](https://github.com/harrytmthy/stitch/blob/main/LICENSE)
[![Release](https://img.shields.io/github/v/release/harrytmthy/stitch?include_prereleases&label=release&color=orange&style=flat-square)](https://github.com/harrytmthy/stitch/releases)

A Kotlin Multiplatform dependency injection library with a precompiled path and a runtime
registration path, designed to replace the Dagger + Koin split with one consistent model.
Expand Down
4 changes: 4 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ kotlinpoet = "2.3.0"
kotlinAtomicfu = "0.32.1"
ksp = "2.3.6"
mavenPublishPlugin = "0.32.0"
stitch = "1.0.0-rc01"

[libraries]
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidxAppcompat" }
Expand All @@ -36,6 +37,9 @@ kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.re
kotlinpoet = { group = "com.squareup", name = "kotlinpoet", version.ref = "kotlinpoet" }
kotlinpoet-ksp = { group = "com.squareup", name = "kotlinpoet-ksp", version.ref = "kotlinpoet" }
ksp-api = { group = "com.google.devtools.ksp", name = "symbol-processing-api", version.ref = "ksp" }
stitch = { group = "io.github.harrytmthy", name = "stitch", version.ref = "stitch" }
stitch-annotations = { group = "io.github.harrytmthy", name = "stitch-annotations", version.ref = "stitch" }
stitch-ksp = { group = "io.github.harrytmthy", name = "stitch-ksp", version.ref = "stitch" }

# Dependencies of build-logic
android-gradle = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" }
Expand Down
6 changes: 3 additions & 3 deletions samples/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,10 @@ dependencies {
implementation(libs.androidx.core.ktx)

// Stitch flavor only
"stitchImplementation"(project(":stitch"))
"stitchCompileOnly"(project(":stitch-annotations"))
"stitchImplementation"(libs.stitch)
"stitchCompileOnly"(libs.stitch.annotations)
"stitchCompileOnly"(libs.javax.inject)
"kspStitch"(project(":stitch-ksp"))
"kspStitch"(libs.stitch.ksp)

// Dagger flavor only
"daggerImplementation"(libs.dagger)
Expand Down
6 changes: 3 additions & 3 deletions samples/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ android {

dependencies {
"withStitchCompileOnly"(libs.javax.inject)
"withStitchCompileOnly"(project(":stitch-annotations"))
"withStitchImplementation"(project(":stitch"))
"kspWithStitch"(project(":stitch-ksp"))
"withStitchCompileOnly"(libs.stitch.annotations)
"withStitchImplementation"(libs.stitch)
"kspWithStitch"(libs.stitch.ksp)
"withDaggerCompileOnly"(libs.javax.inject)
"withDaggerImplementation"(libs.dagger)
"kspWithDagger"(libs.dagger.compiler)
Expand Down
6 changes: 3 additions & 3 deletions samples/feature/home/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ dependencies {
implementation(project(":core"))
implementation(libs.androidx.appcompat)
"withStitchCompileOnly"(libs.javax.inject)
"withStitchCompileOnly"(project(":stitch-annotations"))
"withStitchImplementation"(project(":stitch"))
"kspWithStitch"(project(":stitch-ksp"))
"withStitchCompileOnly"(libs.stitch.annotations)
"withStitchImplementation"(libs.stitch)
"kspWithStitch"(libs.stitch.ksp)
"withDaggerCompileOnly"(libs.javax.inject)
"withDaggerImplementation"(libs.dagger)
"kspWithDagger"(libs.dagger.compiler)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package com.harrytmthy.stitch.annotations

/**
* A string-based qualifier annotation for the DI path.
* A string-based qualifier annotation for the precompiled path.
*
* Use this to differentiate between multiple bindings of the same type.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package com.harrytmthy.stitch.annotations

/**
* Meta-annotation that identifies a scope annotation for the DI path.
* Meta-annotation that identifies a scope annotation for the precompiled path.
*
* Scope annotations control the lifecycle and sharing of dependencies within a specific scope
* (e.g. Activity scope, Fragment scope). Combine with [DependsOn] to form a unidirectional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package com.harrytmthy.stitch.annotations

/**
* Marks a class as the root aggregation point for Stitch's DI code generation.
* Marks a class as the root aggregation point for the precompiled path's code generation.
*
* The KSP processor collects all contributed bindings and scopes across modules and
* generates the final dependency graph at this class's module. Typically placed on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ import com.harrytmthy.stitch.ksp.utils.StitchErrorLogger
import java.security.MessageDigest

/**
* KSP symbol processor for Stitch dependency injection code generation.
* KSP symbol processor for Stitch precompiled graph generation.
*
* This processor scans for @Module classes, @Provides methods, and @Inject constructors/fields,
* then generates DI component and injector objects for compile-time dependency resolution.
* This processor scans `@Provides`, constructor injection, field injection, and scope declarations,
* then generates injectors and graphs for Stitch's precompiled path.
*/
class StitchSymbolProcessor(private val environment: SymbolProcessorEnvironment) : SymbolProcessor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package com.harrytmthy.stitch.api
import kotlinx.atomicfu.atomic

/**
* A thread-safe holder for double-checked locking, used by generated DI graphs
* to lazily initialize bindings.
* A thread-safe holder for double-checked locking, used by generated precompiled graphs
* to lazily initialize scoped and singleton bindings.
*
* Check [reference] against [Uninitialized] to determine whether the value has been set,
* using [lock] for synchronization.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.harrytmthy.stitch.api
import kotlin.reflect.KClass

/**
* Core interface for Stitch's DI path. Generated scope graphs implement this interface.
* Core interface for Stitch's precompiled path. Generated graphs implement this interface.
*
* Each [Injector] represents a single scope in the dependency graph and can create child
* injectors for downstream scopes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import com.harrytmthy.stitch.internal.Registry
import kotlin.reflect.KClass

/**
* Main entry point for Stitch's service locator (SL) path.
* Main entry point for Stitch's runtime registration path.
*
* Use [register] and [unregister] to manage modules at runtime, and [get] or [inject] to
* resolve dependencies.
Expand All @@ -41,7 +41,7 @@ import kotlin.reflect.KClass
* val logger: Logger = Stitch.get()
* ```
*
* For the DI path, see [StitchInjector].
* For the precompiled path, see [StitchInjector].
*/
object Stitch {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import com.harrytmthy.stitch.internal.ConcurrentHashMap
import kotlinx.atomicfu.atomic

/**
* Global registry for Stitch's DI path. Manages the singleton graph and caches
* Global registry for Stitch's precompiled path. Manages the singleton graph and caches
* injector instances across scopes.
*
* Initialize with the generated singleton graph on application startup:
Expand All @@ -48,7 +48,7 @@ object StitchInjector {
private val nextId = atomic(1)

/**
* Initializes the DI graph with the generated [singletonGraph].
* Initializes the precompiled graph with the generated [singletonGraph].
*
* This must be called before any [getSingletonGraph] or scope creation.
*/
Expand Down
Loading