This message was deleted.
# general
s
This message was deleted.
m
This is a slightly different question than asked above, as i’m trying to just use a more stable syntax within my plugin. I’ve already got the basics down, and it works, it’s just problematic as versions of AGP change.
e
if you're ok with it only being stringly-typed like the Groovy DSL, there is https://gradle.github.io/kotlin-dsl-docs/api/org.gradle.kotlin.dsl/kotlin.-any/with-groovy-builder.html
m
i’d prefer strict typing, just with the actual proper kotlin dsl.
e
if the underlying types change incompatibly you can't be type-safe across different versions in a single build
m
I can hit command-b on the android block in a regular build script and see the extension function that provides it, but for whatever reason, i can’t import that into my kotlin based plugin.
Copy code
package org.gradle.kotlin.dsl

...

/**
 * Configures the [android][com.android.build.gradle.LibraryExtension] extension.
 */
fun org.gradle.api.Project.`android`(configure: Action<com.android.build.gradle.LibraryExtension>): Unit =
    (this as org.gradle.api.plugins.ExtensionAware).extensions.configure("android", configure)
e
generated dsl extensions should be imported automatically if you're writing a precompiled script plugin which includes the plugin, otherwise they're simply not available
m
@ephemient yeah, unfortunately, i’m trying to build this as a standalone plugin that i can publish to a nexus repo and apply it to all our libraries (we have an app that’s very modularized and we want standardized build scripts, hence the need for the plugin). I really just want the syntax of the pre-compiled script plugin, but within a standalone plugin repository.
e
I don't quite understand - you can publish a precompiled script plugin - but if the Android plugin changes its API you're broken either way
m
@ephemient The kotlin DSL tends to stay the same across versions, even though the underlying classnames and stuff might change, That’s what i’m trying to insulate myself from. I’m having some success, but android studio isn’t really liking it very much and despite things working on the command line, it’s showing errors in there.