louiscad
02/16/2019, 12:53 AMbuild.gradle.kts
files in a multi-modules project using buildSrc
, but this code relies on some gradle plugins like Kotlin multiplatform and maven publish.
How can I access those in the Kotlin sources of the buildSrc
? Thanks for your help!snowe
02/16/2019, 12:54 AMbuildSrc/build.gradle.kts
and then you can access them in your code.louiscad
02/16/2019, 12:55 AMdependencies
block?snowe
02/16/2019, 12:55 AMsnowe
02/16/2019, 12:55 AMlouiscad
02/16/2019, 1:01 AMsnowe
02/16/2019, 1:15 AMsnowe
02/16/2019, 1:16 AMlouiscad
02/16/2019, 1:27 AMbuild.gradle.kts
file helped:
repositories {
google()
jcenter()
gradlePluginPortal()
}
dependencies {
implementation("com.android.tools.build:gradle:3.3.1")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.21")
}
Also, I realized I do not need to use the plugin ids I'd use in the plugins DSL, but only what I usually put in the `builscript`'s dependencies using the classpath
configuration (but using the implementation
configuration here).
Thanks for the hints, it was helpful!gildor
02/16/2019, 3:55 AMgildor
02/16/2019, 3:57 AMgildor
02/16/2019, 4:00 AMbuildSrc is just a pluginTo be morr correct "buildSrc" is not a plugin itself. It's just a JVM module that will be added to your project's gradle classpath. But because everything in buildSrc becomes part of build config classpath you also can add any dependencies to it, including third party or own plugins and they will be available to application to your own modules
snowe
02/16/2019, 4:46 AMbuildSrc
folder into a plugin directly? You can even reference it with a plugin id.gildor
02/16/2019, 10:04 AMgildor
02/16/2019, 10:04 AMgildor
02/16/2019, 10:05 AMlouiscad
02/16/2019, 10:39 AMgildor
02/16/2019, 5:29 PMgildor
02/16/2019, 5:30 PMgildor
02/16/2019, 5:32 PMlouiscad
02/16/2019, 5:45 PMpublishing { … }
extension for Project
with no luck, but it seems to only affect accessors, I can access the types from the maven-publish
plugin.gildor
02/16/2019, 5:48 PMgildor
02/16/2019, 5:48 PMgildor
02/16/2019, 5:49 PMgildor
02/16/2019, 5:50 PMgildor
02/16/2019, 5:52 PMkotlin-dsl
plugin to your buildSrc, you will have access to some non-generated helper methods of kotlin-dslsnowe
02/16/2019, 6:07 PMsnowe
02/16/2019, 6:09 PMlouiscad
02/16/2019, 9:15 PMgildor
02/17/2019, 12:47 AMgildor
02/17/2019, 12:49 AMsnowe
02/17/2019, 1:10 AMgildor
02/17/2019, 1:28 AMsnowe
02/17/2019, 1:29 AMgildor
02/17/2019, 1:31 AMgildor
02/17/2019, 1:32 AMgildor
02/17/2019, 1:33 AMsnowe
02/17/2019, 1:33 AMgildor
02/17/2019, 1:33 AMsnowe
02/17/2019, 1:33 AMgildor
02/17/2019, 1:34 AMgildor
02/17/2019, 1:36 AMhad to include buildSrc as wellbuildScr included by default, but if you have plugin in buildSrc you have to apply it same as any other plugin
snowe
02/17/2019, 1:38 AMgildor
02/17/2019, 1:39 AMsnowe
02/17/2019, 7:35 PMgildor
02/17/2019, 11:29 PM