Hello everybody! I ran into a problem. I am developing a gradle plugin in Kotlin. There are several extensions in my plugin. The project is built on a composite build so I can immediately test my plugin, composite build example (GitHub - cortinico/kotlin-gradle-plugin-template: ๐ A template to let you started with custom Gradle Plugins + Kotlin in a few seconds). My extensions work fine, but when I publish and add a dependency to another project, those extensions become unavailable, although new tasks appear. What could be the reason?
// Plugin
open class CorePlugin : Plugin<Project> {
override fun apply(target: Project) {
val buildConfigs = target.extensions.create<BuildConfig>("buildConfigs")
// tasks creation
}
}
// Extension
open class BuildConfig {
private val params: MutableMap<String, Any> = mutableMapOf()
fun putString(fieldName: String, value: String) {
params[fieldName] = value
}
}
// Extension usage in build.gradle (unresolved after publication)
buildConfigs {
putString("Tara", "+529943241241")
putString("Max", "+529943241241")
putString("Sasha", "+529943241241")
}
Also after publishing I canโt add plugin dependency via block plugin { ... }
, only use apply(plugin = "...")