google / dagger

A fast dependency injector for Android and Java.
https://dagger.dev
Apache License 2.0
17.41k stars 2.01k forks source link

[Feature Request] Allow Dagger Hilt to be configured from "plugins" DSL #3170

Closed jaredsburrows closed 2 years ago

jaredsburrows commented 2 years ago

Description

Publish plugin data for Dagger Hilt plugin? The AGP and Kotlin plugins do this already.

Example (currently in production)

Usingbuildscript:

buildscript {
  repositories {
    google()
    mavenCentral()
  }

  dependencies {
    classpath("com.android.tools.build:gradle:7.0.4")
    classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
  }
}

apply {
  plugin("com.android.application")
  plugin("org.jetbrains.kotlin.android")
}

Using plugins:

plugins {
  id("com.android.application") version "7.0.4"
  kotlin("android") version "1.6.10"
}

Proposal Example

Usingbuildscript:

buildscript {
  repositories {
    google()
    mavenCentral()
  }

  dependencies {
    classpath("com.google.dagger:hilt-android-gradle-plugin:2.40.5")
  }
}

apply {
  plugin("dagger.hilt.android.plugin")
}

Using plugins:

plugins {
  id("com.google.dagger.hilt") version "2.40.5"
}
danysantiago commented 2 years ago

Duplicate of https://github.com/google/dagger/issues/2774, we need to publish a marker artifact for this to work.

jaredsburrows commented 2 years ago

@danysantiago Can we update #2774's title and description or use this issue to track the progress?

jaredsburrows commented 2 years ago

@danysantiago submitted this change here https://github.com/google/dagger/commit/e50aa067efc6484e165e6e0715dc7391487a03f1