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

Absolute paths in `gemPath` can cause build cache miss

Open erichaagdev opened this issue 1 year ago • 0 comments

Given the following build script:

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

repositories {
    mavenCentral()
}

tasks.asciidoctor {
    sources("index.adoc")
    sourceDirProperty.set(layout.projectDirectory.dir("docs"))
    outputDirProperty.set(layout.buildDirectory.dir("docs"))
}

Then an absolute path will be present in the gemPath input property of the asciidoctor task. This will cause build cache misses between machines, or when executed from different directories.

Reproducer: https://github.com/erichaagdev/asciidoctor-cache-miss-reproducer

See the following Build Scan comparison from the reproducer: https://ge.solutions-team.gradle.com/c/b4xfcm2qax6c2/7pytfeyqywhcg/task-inputs?cacheability=cacheable,overlapping-outputs,validation-failure

Another real world example of this issue present in the spring-kafka project: https://ge.solutions-team.gradle.com/c/lw2a3f5v7z2xw/f3pkynntr7b6q/task-inputs?cacheability=cacheable

Relevant spot in the code where the gemPath property is configured: https://github.com/asciidoctor/asciidoctor-gradle-plugin/blob/996df6a028b69e3f7314ed61ca6af317776ace74/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy#L355-L356

erichaagdev avatar May 17 '23 14:05 erichaagdev