Im investigating using buildSrc in my current android project
i have created a buildSrc folder and specified Config constants that work fine in my apps gradle kts files.
object Config {
object App {
const val nameHeader = "APPLICATION_NAME"
const val name = "Android My App"
const val packageName = "org.research.development"
}
const val minSdk = 21
const val targetSdk = 34
val javaVersion = org.gradle.api.JavaVersion.VERSION_17
}
i am now expecting i can generate the contents of the libs folder in my buildSrc module with the following changes, using my existing libs.versions.toml
buildSrc/build.gradle.kts
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
plugins {
`kotlin-dsl`
}
repositories {
mavenCentral()
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
languageVersion.set(KotlinVersion.KOTLIN_2_0)
}
}
buildSrc/settings.gradle.kts
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
rootProject.name = "buildSrc"
when i sync, clean and build though the libs folder stays empty
is it my expectations that need to change?
or am i missing a “trick”?