You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 19, 2020. It is now read-only.
Unable to use shared constants (or shared properties) with Kotlin Script in Gradle.
Expected Behavior
As project developer I can:
Create object (in Kotlin terms) with list of the shared constants (such as project version, list of dependency versions, etc.). Or possible any contruction, which can be injected by simple into the all projects.
Use this object across all other kts files with compile-time check.
As a result I can use dependency string line implementation(group="org.jetbrains.kotlin", name= "kotlin-stdlib", version=Shared.KotlinVersion)
Current Behavior
It is unable simple to share common constants between kts files, becaue of the following issues:
It is unable to simple create object (or any other Java/Kotlin type) in the one project (for example - in root project) and use it in the another.
I can create buildSrc, which requires a lot of non-trivial constructs to work in isolation with public repositories (e.g. we use own Artifactory, instead of direct plugin download).
There are monstrous constructions for property usage, which can be checked here and here. I'd like to have simple insertion with compile-time checks.
Context
I'd like to achieve:
All project and plugin dependency versions are extract to the simple file.
All dependency constants can be used without boilerplate copy-pasting code (for example - Groovy does not require this)
Using buildSrc or an included build is the canonical way to share types including constants to make them available to all your build scripts. It currently requires some ceremony but this will be made easier over time.
Note that extra properties are very dynamic by nature, a shared static Kotlin object will bring much nicer benefits.
@eskatos , however how can I simple share constant (for example - kotlin version) in buildSrc scripts (to have ability to apply plugin) and in the main gradle scripts?
As I found, buildSrc scripts ignores shared object, which is created inside it. Therefore I could not create the following:
Create N projects
Create shared script in the buildSrc, which will install some plugin (for example - kotlin plugin)
Last item require kotlin version determine in the buildSrc folder, which is difficult for now.
Unable to use shared constants (or shared properties) with Kotlin Script in Gradle.
Expected Behavior
As project developer I can:
implementation(group="org.jetbrains.kotlin", name= "kotlin-stdlib", version=Shared.KotlinVersion)
Current Behavior
It is unable simple to share common constants between kts files, becaue of the following issues:
object
(or any other Java/Kotlin type) in the one project (for example - in root project) and use it in the another.Context
I'd like to achieve:
Steps to Reproduce (for bugs)
Can be checked here or here
Your Environment
n/a
The text was updated successfully, but these errors were encountered: