https://kotlinlang.org logo
Title
f

Francesc

04/05/2023, 11:29 PM
I'm writing a plugin using the build convention approach and I want to add a dependency to a module. For a library dependency, I can do this
dependencies {
            val bom = libs.findLibrary("androidx-compose-compose-bom").get()
            add("implementation", platform(bom))
        }
what's the syntax to add a dependency to a module, the equivalent to
implementation(project(":core:coroutines:coroutines-api"))
?
after some trial and error it seems that this is the syntax
val projectPath = requireNotNull(project.findProject(<path here>))
        dependencies.add("implementation", projectPath)
f

Francesc

04/06/2023, 1:46 AM
thanks, but unless I'm missreading your snippet, you only have library dependencies, no dependencies on other modules in your app
y

YOUNG HO CHA

04/06/2023, 2:04 AM
Ah. your question was how to get project instance on plugin. Yes. you can use
Project.findProject()
, or just use
Project.project()
, too.