Skip to content
This repository has been archived by the owner on Aug 19, 2020. It is now read-only.

Custom actions in Kotlin build script break task up-to-date check #263

Closed
stephan-gh opened this issue Feb 14, 2017 · 5 comments
Closed

Comments

@stephan-gh
Copy link

stephan-gh commented Feb 14, 2017

Using the following Groovy build script:

apply plugin: 'java'

task emptyJar(type: Jar) {
    classifier = 'empty'

    doFirst {
        println 'Test'
    }
}

The :emptyJar task is run only once, further invocations of the task report UP-TO-DATE.

When I write the same thing using a Kotlin build script:

import org.gradle.jvm.tasks.Jar

plugins {
    java
}

task<Jar>("emptyJar") {
    classifier = "empty"

    doFirst {
        println("Test")
    }
}

The JAR is always re-built because Gradle detects the task as out-of-date. If I enable debug logging it shows the following:

Executing task ':emptyJar' (up-to-date check took 0.009 secs) due to:
  Task ':emptyJar' has a custom action that was loaded with an unknown classloader

I think adding a custom task action using a Kotlin build script should behave similar to Groovy without affecting the up-to-date check.

Tested with gradle-script-kotlin-3.5-20170207151802+0000

@bamboo
Copy link
Member

bamboo commented Feb 14, 2017

Thanks for the report!

@bamboo
Copy link
Member

bamboo commented Feb 14, 2017

Blocked by #171.

@bamboo bamboo modified the milestones: 0.8.0, 1.0.0 Mar 4, 2017
@bamboo bamboo self-assigned this Mar 4, 2017
@bamboo
Copy link
Member

bamboo commented Mar 4, 2017

Resolved in 174f72c.

@bamboo bamboo closed this as completed Mar 4, 2017
@bamboo
Copy link
Member

bamboo commented Mar 4, 2017

Thanks for the report, @Minecrell!

@stephan-gh
Copy link
Author

@bamboo I've tested it and it works fine using the latest snapshot distribution. Thanks for the fix!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants