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

Compilation error in task configuration

Open SRechenberger opened this issue 6 years ago • 4 comments

When configuring the asciidoctor task using the Kotlin DSL as described here, i.e.

// My build.gradle.kt file
import org.asciidoctor.gradle.jvm.AsciidoctorTask

plugins {
    id("org.asciidoctor.jvm.convert") version "2.3.0"
}

tasks {
    "asciidoctor"(AsciidoctorTask::class) {
        sourceDir = file("src/docs")
        sources(delegateClosureOf<PatternSet> {
            include("**/*.adoc")
        })
        outputDir = file("$buildDir/docs")
    }
}

The compiler complains, that sourceDir and outputDir cannot be reassigned, due to being vals.

Script compilation errors:

  Line 11:         sourceDir = file("$srcDir/docs")
                   ^ Val cannot be reassigned

  Line 15:         outputDir = file("$buildDir/docs")
                   ^ Val cannot be reassigned

Update

Using setSourceDir(file(...)) and setOutputDir(file(...)) does work.

SRechenberger avatar Oct 30 '19 10:10 SRechenberger

Is there an update on this? I ran into the same issue when migrating from "org.asciidoctor.convert" to "org.asciidoctor.jvm.convert".

Well5a avatar Dec 17 '20 09:12 Well5a

We'll try to deal with this in the next release which is before end of 2020.

ysb33r avatar Dec 17 '20 14:12 ysb33r