Closed TWiStErRob closed 6 years ago
Hi @TWiStErRob,
What's your use-case exactly?
All I want is to pull in the latest version of "org.gradle:gradle-kotlin-dsl" to be used in my plugin which uses Kotlin (1.2.20) and hence could benefit from the DSL enhancements.
See https://github.com/gradle/kotlin-dsl/blob/develop/samples/gradle-plugin/plugin/build.gradle.kts
To clarify some confusing here.
This Repo have two active branches. master and develop. develop have currently 0.15.3. Which is pushed to the gradle plugin portal. 0.14.2 is the master branch and declared as "stable" (and or published together with gradle). Maybe that is the reason why it is in the github release section.
The maven Repo (now contains 0.15.3 as well) wasn't updated at this time you have written the issue?! I think it got updated with the plugin portal upload automatically?!
On Jan 20, 2018 10:12 PM, "Rodrigo B. de Oliveira" notifications@github.com wrote:
All I want is to pull in the latest version of "org.gradle:gradle-kotlin-dsl" to be used in my plugin which uses Kotlin (1.2.20) and hence could benefit from the DSL enhancements.
See https://github.com/gradle/kotlin-dsl/blob/develop/ samples/gradle-plugin/plugin/build.gradle.kts
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gradle/kotlin-dsl/issues/689#issuecomment-359202485, or mute the thread https://github.com/notifications/unsubscribe-auth/AJwYeymi72aMZHl60b8LAnHIbOZItFmPks5tMlaugaJpZM4Rldmx .
What's your use-case exactly?
I'm writing a plugin, that I'll upload for others to put on their buildscript.dependencies.classpath
and apply:
, and it's multiple plugins configuring the project. For example I use project.apply<MySubPlugin>()
from the plugin that has a String id
. So far this is the only usage of the dsl
, but I'm expecting to use more as I learn your library.
Consider the following: I write some script that sets up things in build.gradle.kts
and I want to publish/share it between projects, so I copy it to a plugin (I know apply from: url
, but you know, versioning, testing and stuff). At this point it'll be all red, because I quite possibly wrote it in your DSL. So I'll need to add the DSL library to my plugin for it to even compile, or rewrite the whole thing with proper function calls and with()
blocks.
See
samples/gradle-plugin
I found that earlier, but for some reason didn't realize the plugin is actually using the DSL. When you read plugins { "kotlin-dsl" }
it's not obvious that it'll put itself on the compileClasspath of the project. I would go as far as unexpected, but now that I read the source code I'm beginning to understand that kotlin-dsl
is meant for developers and that this DSL project is automatically imported in .gradle.kts
files.
This Repo have two active branches. master and develop.
Thanks, that info clears a lot up, we're using that pattern as well at work.
Maybe that is the reason why it is in the github release section.
Only tags can be releases, and you don't tag your develop
, only master
when you release for the Gradle stable which yields an interesting version history in releases and tags with holes. I would say since the release is publicly accessible it should be merged to master
and tagged.
During the last few days I've been digging deep into the Kotlin DSL/plugin ecosystem trying to convert my build.gradle files to kts. I've managed, but it seems that kotlin-dsl
is doing too much. For example it pulls in kotlin-compiler-embeddable
which is a bit overkill considering I only want to use kotlin.dsl.*
and causes problem at runtime, for example: Caused by: java.lang.NoClassDefFoundError: org/jetbrains/kotlin/utils/CollectionsKt
I resolved this by simply excluding all deps via isTransitive = false
when depending on the DSL module and not using the org.jetbrains
imports, whops.
Hope this clears things up, and quite possible this is a new use case for your project?
I'm writing a plugin, that I'll upload for others to put on their buildscript.dependencies.classpath and apply:, and it's multiple plugins configuring the project.
First things first:
plugin development have nothing to do with the kotlin-dsl
.
You can write your plugin in any language jvm you want. The only thing is it can be compiled to bytecode.
Kotlin-DSL is - in first place - a replacement for "consumers". It want to replace build.gradle
-files (written in groovy) with build.gradle.kts
-files (written in kotlin).
But that has nothing todo with the plugin development.
But - as you already mentioned - the Kotlin-DSL project contains a plugin which is also called kotlin-dsl
.
But that plugin is is also "not really for development". It just setup things for you. E.g. add the kotlin stuff to your dependencies (that's for developing the plugin themself in kotlin).
But you don't have to do it. You can also simply add the kotlin gradle plugin by yourself.
Of course, it will also apply the gradle apis. See here. But that is also another story ;)
To summarize:
Recently I've created a simple example. See here: https://github.com/StefMa/Joka/
This uses also the Kotlin-DSL (for creating my build.gradle.kts
-files) but for nothing more.
To create my plugin (see the buildSrc/
folder there) I've implement kotlin by myself.
Of course, with that implementation I can't use the classes in the org.gradle.kotlin.*
package. But I don't need it for my use case. So I don't apply the kotlin-dsl
plugin (which adds the gradleKotlinDsl()
to the dependencies which lets you use the org.gradle.kotlin.*
package).
The sourcecode can be found here: https://github.com/gradle/kotlin-dsl/tree/master/provider/src/main/kotlin/org/gradle/kotlin/dsl
But if you don't need any of these classes/extensions from there. Don't use it as dependency...
Superseded by #1232
https://github.com/gradle/kotlin-dsl/releases says latest version is 0.14.2 https://plugins.gradle.org/plugin/org.gradle.kotlin.kotlin-dsl says the latest version is 0.15.3 https://mvnrepository.com/artifact/org.gradle/gradle-kotlin-dsl says the latest version is 0.15.2
jcenter()
has none of these. Which one is the official distribution channel? Weirdly the source code releases show the oldest version.All I want is to pull in the latest version of
"org.gradle:gradle-kotlin-dsl"
to be used in my plugin which uses Kotlin (1.2.20) and hence could benefit from the DSL enhancements.The following custom repositories managed to resolve:
Is there a way to consume this properly e.g. via
kotlin("blah")
or from the local distribution similar tolocalGroovy()
?