In a build scan, the configuration time associated...
# community-support
j
In a build scan, the configuration time associated to the script part of the settings.gradle.kts wouldn’t include anything done by an applied plugin, right? Is it expected it can take 40-50 seconds reading the catalog file to extract a version? This is the whole content of the script
Copy code
pluginManagement {
    val fooVersion: String =
        file("$rootDir/gradle/libs.versions.toml")
            .readLines()
            .first { it.contains("foo") }
            .split("\"")[1]

    repositories {
        gradlePluginPortal()
        mavenCentral()
        google()
    }

    plugins {
        id("com.foo") version fooVersion
    }
}

plugins {
    id("com.foo")
}
g
In my case, • Put version string on gradle.properties • Load version string to settings.gradle and dependencyResolutionManagement block ◦ settings.gradle ◦ apply dependencyResolutionManagement from settings.gradle
👀 1
e
can you just skip that complexity and use
Copy code
[versions]
foo = "0.1"
[plugins]
foo = { id = "com.foo", version.ref = "foo" }

plugins {
    alias(libs.plugins.foo)
instead?
j
Is that message for me?
e
yes
j
it is the settings file, I cannot use catalogs directly there
e
I have done hacks like
Copy code
pluginManagement {
    val parseToml = Gradle::class.java.classLoader.loadClass("org.tomlj.Toml")
        .getMethod("parse", java.io.InputStream::class.java)
    val toml = file("gradle/libs.versions.toml").inputStream().use { parseToml.invoke(null, it) }
    val versions = toml.withGroovyBuilder {
        "getTable"("versions")?.withGroovyBuilder {
            ("keySet"() as Set<*>).associateWith { "get"(listOf(it)).toString() }
        }
    }.orEmpty()
    val fooVersion = versions["foo"]
before but only in personal non-production projects
j
could you check what is the time your project spends configuring the settings script with a build scan?
I would expect it to be similar (my case is on CI without config cache), as both are just parsing a file