Our organisations large multi module android project has recently been migrated to employ version catalogue, build-logic and convention plugins.
all existing build gradle kts files were reformatted to use
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
so that all module dependencies could be reformatted from
xxxxxxx(":aaaa:bbbb:cccc")
to
xxxxxxx(projects.aaaa.bbbb.cccc)
the issues we are facing now are that whenever new modules are added to the android project and configured as dependencies, Android Studio employs this format xxxxxxx(":aaaa:bbbb:cccc")
and not xxxxxxx(projects.aaaa.bbbb.cccc)
.
how can we resolve this issue?
Can Android Studio be configured to use xxxxxxx(projects.aaaa.bbbb.cccc)
format?
Or
can we add an extension function to org.gradle.api.Project
to reformat (transform) this format xxxxxxx(":aaaa:bbbb:cccc")
to the desired project accessor format of xxxxxxx(projects.aaaa.bbbb.cccc)
i can see the dependencies block
public fun org.gradle.api.Project.dependencies(configuration: org.gradle.kotlin.dsl.DependencyHandlerScope.() -> kotlin.Unit): kotlin.Unit { /* compiled code */ }
has a registerTransform
public open fun <T : org.gradle.api.artifacts.transform.TransformParameters?> registerTransform(actionType: java.lang.Class<out org.gradle.api.artifacts.transform.TransformAction<T>>, registrationAction: org.gradle.api.Action<in org.gradle.api.artifacts.transform.TransformSpec<T>>): kotlin.Unit { /* compiled code */ }
which looks like it could be a good candidate for “transforming” dependencies “from” this format xxxxxxx(":aaaa:bbbb:cccc")
“to” the desired project accessor format of xxxxxxx(projects.aaaa.bbbb.cccc)
however i am having difficulty in finding any examples to assist me in the development of such Transformation.