Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Gradle configuration cache #159

Closed
Kantis opened this issue May 27, 2024 · 10 comments · Fixed by #160
Closed

Support Gradle configuration cache #159

Kantis opened this issue May 27, 2024 · 10 comments · Fixed by #160

Comments

@Kantis
Copy link

Kantis commented May 27, 2024

Running SkippyAnalyze task in a project which uses Gradle's configuration cache yields the following error:

1 problem was found storing the configuration cache.
- Task `:autoinvoice:skippyAnalyze` of type `io.skippy.gradle.SkippyAnalyzeTask`: invocation of 'Task.project' at execution time is unsupported.
@fmck3516
Copy link
Member

Corresponding E2E test: skippy-io/skippy-regression-suite#2

@fmck3516
Copy link
Member

Quick update: All E2E test except TestFailureTest.java pass with Configuration Cache enabled using the changes in #160 . I'm still investigating why the result property for a failed test is set incorrectly with Configuration Cache enabled.

@Kantis
Copy link
Author

Kantis commented May 29, 2024

My best guess is that it's somehow related to not having the class-dirs as inputs, so Gradle doesn't realize the task is stale (due to classpath changing), and the task is not re-run as a result. Simply adding --rerun-tasks to the arguments here might be enough to validate the hypothesis. https://github.com/skippy-io/skippy-regression-suite/blob/8192a55ca11e9793d3ce803fc7be892d5e10ceb3/src/test/java/io/skippy/test/gradle/TestFailureTest.java#L40C17-L40C73

@fmck3516
Copy link
Member

I added some logging. From what I can tell, it's not due to tasks not being executed.

What I see: SkippyAnalyzeTask and the test tasks use different instances of TestFailedListener. The tests tasks report failed tests to TestFailedListener@00000000. SkippyAnalyzeTask references TestFailedListener@11111111.

@fmck3516
Copy link
Member

I will create a minimal project that demonstrates my problem and reach out to the Gradle folks for help.

@fmck3516
Copy link
Member

fmck3516 commented Jun 1, 2024

@fmck3516 fmck3516 reopened this Jun 4, 2024
@fmck3516
Copy link
Member

fmck3516 commented Jun 4, 2024

Accidentally closed this issue when squashing the PR. Have to add additional tests and figure out how to solve that for Gradle 7.

@Kantis What version of Gradle are you using? This should be fixed in 0.0.21-SNAPSHOT if you use Gradle 8 or above.

@helios66
Copy link

helios66 commented Sep 11, 2024

@fmck3516 Amazing work with this tool. However I have a question, how do I use the snapshot version? I'm currently running some experiments with skippy and will like to test out the gradle cache fix before proceeding. The project uses gradle 8.5

@fmck3516
Copy link
Member

You can use snapshot versions as follows:

buildscript {
    repositories {
        mavenCentral()
        maven { url = 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
    }
    dependencies {
        classpath 'io.skippy:skippy-gradle:0.0.21-SNAPSHOT'
    }
}

apply plugin: io.skippy.gradle.SkippyPlugin

repositories {
    maven { url = 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
}

dependencies {
    testImplementation 'io.skippy:skippy-junit5:0.0.21-SNAPSHOT'
}

@fmck3516 fmck3516 modified the milestones: v0.0.21, v0.0.22 Oct 15, 2024
@fmck3516
Copy link
Member

This has been fixed in release 0.0.22 which has been published to Maven Central and Gradle's Plugin Portal.

PRs:

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

Successfully merging a pull request may close this issue.

3 participants