Skip to main content
Version: 0.10.0

configuration

The TangleComponents holder needs to be initialized with an application-scoped Dagger Component in order to complete the graph.

class MyApplication : Application() {

override fun onCreate() {
super.onCreate()

val myAppComponent = DaggerAppComponent.factory()
.create(this)

TangleComponents.add(myAppComponent)
}
}

Gradle plugin

The simple way to apply Tangle is to just apply the gradle plugin. It will automatically add the dependencies and perform some basic validation of your module's configuration.

// settings.gradle.kts

pluginManagement {
repositories {
gradlePluginPortal()
}
}
// top-level build.gradle.kts

plugins {
id("com.rickbusarow.tangle") version "0.10.0"
}
// any Android module's build.gradle.kts

plugins {
id("android-library") // or application, etc.
kotlin("android")
id("com.squareup.anvil")
id("com.rickbusarow.tangle")
}

// optional
tangle {
composeEnabled.set(true) // default is false
}

Explicit dependencies

You can also just add dependencies yourself, without applying the plugin.

Note that tangle-api is an Android library, and tangle-compiler generates Android-specific code, so they should only be added to Android modules.

// any Android module's build.gradle.kts

plugins {
id("android-library") // or application, etc.
kotlin("android")
id("com.squareup.anvil")
}

dependencies {

api("com.rickbusarow.tangle:tangle-annotations:0.10.0")

implementation("com.rickbusarow.tangle:tangle-api:0.10.0")

// optional Compose support
implementation("com.rickbusarow.tangle:tangle-compose:0.10.0")

// `anvil` adds the compiler extension to the Anvil plugin's list of code generators
anvil("com.rickbusarow.tangle:tangle-compiler:0.10.0")
}