Hey team, I see that when building a fresh versio...
# community-support
a
Hey team, I see that when building a fresh version of gradle project lets say is written in Kotlin DSL, it takes some time to download the kotlin dependencies and configure the project (almost 8 mins). Is there a way to pre-cache this step in the pipeline which is a docker image we using. Will highly approach the support here
t
AFAICT, the Kotlin dependencies used by Kotlin DSL itself are embedded into Gradle. It might take some time to generate some Kotlin APIs though (without needing network access AFAIK); no idea if that could be triggered while building your docker image though…
a
I see that there alot of network access actually specially requesting the kotlin complier embeddable. Log lines as follow
Copy code
Evaluating project ':build-logic' using build file '......./build-logic/build.gradle.kts'.
Build cache key for Kotlin DSL script compilation (Project/TopLevel/stage1) is 6f5acc01949542d82e494788a011365a
Stored cache entry for Kotlin DSL script compilation (Project/TopLevel/stage1) with cache key 6f5acc01949542d82e494788a011365a
Downloading <https://plugins.gradle.org/m2/org/gradle/kotlin/kotlin-dsl/org.gradle.kotlin.kotlin-dsl.gradle.plugin/4.3.1/org.gradle.kotlin.kotlin-dsl.gradle.plugin-4.3.1.pom> to /builds/tangram/tangram/.gradle/.tmp/gradle_download18074616375016209805bin
Resource missing. [HTTP HEAD: <https://plugins.gradle.org/m2/org/gradle/kotlin/kotlin-dsl/org.gradle.kotlin.kotlin-dsl.gradle.plugin/4.3.1/org.gradle.kotlin.kotlin-dsl.gradle.plugin-4.3.1.jar>]
Downloading <https://plugins.gradle.org/m2/org/gradle/kotlin/gradle-kotlin-dsl-plugins/4.3.1/gradle-kotlin-dsl-plugins-4.3.1.pom> to /builds/tangram/tangram/.gradle/.tmp/gradle_download15816204093051882418bin
v
Most probably a dependency like the others, so you could probably do the same you do for other dependencies, that is for example using a read-only pre-populated dependency cache, or caching the respective directory. https://docs.gradle.org/current/userguide/dependency_caching.html#sec:ephemeral-ci-cache
a
That can be a good option. Thanks @Vampire
👌 1
@Vampire is there a way to set the Kotlin version of the Kotlin DSL?
t
Assuming you still mean the
kotlin-dsl
plugin, you shouldn't change it. The plugin itself checks whether its version is the one expected by the Gradle version it's applied on and warns if it's not the case. There must be a reason for this (I suppose they don't mind ensuring compatibility with various Gradle versions).
a
Got it! I think I just wanted to avoid downloading two different kotlin versions since I am using a different Kotlin version in my project
v
So you are talking about the Kotlin version used to build your plugin, not the Kotlin version used in a build script right? This can be changed, but also this you shouldn't without really good reasons and the one you mentioned is not. 🙂 If you change the version, Gradle will complain that the Kotlin version is wrong and that it might not work as intended. It might still work, but I wouldn't risk it just for that reason. I did it in a project where I wanted to use a plugin that was compiled with a too new Kotlin version for the built-in one but needed a bug-fix in that newer version.
a
Yea then I will try to keep it sync then.
👌 1