asciidoctor / asciidoctor-gradle-plugin

A Gradle plugin that uses Asciidoctor via JRuby to process AsciiDoc source files within the project.
https://asciidoctor.github.io/asciidoctor-gradle-plugin/
Apache License 2.0
286 stars 122 forks source link

Execution optimizations have been disabled for task ':asciidoctor' when converting document at the project root #607

Closed bric3 closed 1 year ago

bric3 commented 3 years ago

I have a file CHANGELOG.adoc at the root of my project (and at the root of the git repository).

My build script converts this file and use it's content in some other task.

The problem is that it seems that gradle is not happy about the way the task access this single file (actually I have a second one) and as such disable the cache for asciidoctor, and all subsequent tasks.

The task is declared this way

asciidoctor {
    sourceDir file('.')    // <== I suppose this is causing the issue with gradle
    sources {
        include 'CHANGELOG.adoc'
        include 'DESCRIPTION.adoc'
    }
    outputDir file('build/docs')
}

Is there a way around it ? Keeping the files in place (ie not moving them in a different folder) ? If not, maybe that's something that could be improved.

Execution optimizations disabled log ``` > Task :asciidoctor Execution optimizations have been disabled for task ':asciidoctor' to ensure correctness due to the following reasons: - Gradle detected a problem with the following location: '/home/runner/work/jd-intellij/jd-intellij'. Reason: Task ':asciidoctor' uses this output of task ':compileJava' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.0.2/userguide/validation_problems.html#implicit_dependency for more details about this problem. Gradle detected a problem with the following location: '/home/runner/work/jd-intellij/jd-intellij'. Reason: Task ':asciidoctor' uses this output of task ':compileJava' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.0.2/userguide/validation_problems.html#implicit_dependency for more details about this problem. This behaviour has been deprecated and is scheduled to be removed in Gradle 8.0. Execution optimizations are disabled to ensure correctness. See https://docs.gradle.org/7.0.2/userguide/more_about_tasks.html#sec:up_to_date_checks for more details. ```


Gradle 7.0.2

Build time: 2021-05-14 12:02:31 UTC Revision: 1ef1b260d39daacbf9357f9d8594a8a743e2152e

Kotlin: 1.4.31 Groovy: 3.0.7 Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020 JVM: 11.0.11 (AdoptOpenJDK 11.0.11+9) OS: Mac OS X 10.15.7 x86_64



* org.asciidoctor.jvm.convert : 3.3.2
ysb33r commented 3 years ago

There is a workaround for this. Somethin like the following.

A a changelog.adoc to a source directory and then include the files from the project directory.

= Changelog & Release Notes {revnumber}

include::{projectdir}/CHANGELOG.adoc[tags=changelog,leveloffset=-1]
bric3 commented 3 years ago

Nice trick! This does fix the cache issue !