asciidoctor-gradle-plugin icon indicating copy to clipboard operation
asciidoctor-gradle-plugin copied to clipboard

What is the equivalent of the `ruby.gems()` repository extensions with the kotlin DSL ?

Open bric3 opened this issue 3 years ago • 3 comments

Nowaday I tend to favor Kotlin DSL as it is type safe, and IntelliJ offers better suggestions.

However when I initiated a new project with asciidoctor revealjs. I had to go back to use the groovy DSL because ruby.gems() raises an unresolvable reference error on the ruby identifier.

plugins {
    id("org.asciidoctor.jvm.revealjs") version "3.3.2"
}

repositories {
    mavenCentral()
    ruby.gems()
}

I suppose the syntax is different, I have tried various combination but I cannot get it right. If you have any clue that would be appreciated. Many thanks in advance.

bric3 avatar Oct 10 '21 16:10 bric3

This is the answer I found somewhere else:

val repositoriesInternal = repositories as ExtensionAware
repositoriesInternal.extensions.configure(com.github.jrubygradle.api.core.RepositoryHandlerExtension::class) {
    gems()
}

However this should be documented imo.

ghilainm avatar Dec 20 '21 17:12 ghilainm

Hi all, I just read the Gradle 7.4 RC1 release note, and this problem might be fixed:

Starting with this version of Gradle, Kotlin DSL generates type-safe model accessors for custom extensions added to the repositories {} block. Custom extensions now have full content assist in the IDE.

So it's now possible to use

repositories {
    ruby {
        gems()
    }
}

bric3 avatar Jan 18 '22 17:01 bric3

Do we just need to document how to do this in < Gradle 7.4?

ysb33r avatar Dec 31 '22 17:12 ysb33r