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 configuration cache #59

Closed
C-Otto opened this issue Apr 2, 2021 · 3 comments
Closed

Support configuration cache #59

C-Otto opened this issue Apr 2, 2021 · 3 comments

Comments

@C-Otto
Copy link

C-Otto commented Apr 2, 2021

When using version 2.0.1 of the plugin with Gradle 7 (RC2) with --configuration-cache, the configuration cache can be created, but the project does not build when it is used. Key error message:
> Extension with name 'errorprone' does not exist. Currently registered extension names: [ext]

Reproducer: https://github.com/C-Otto/playground/tree/errorprone-configuration-cache

Creating configuration cache (successful):

$ ./gradlew clean build --no-build-cache --configuration-cache
Configuration cache is an incubating feature.
Calculating task graph as no configuration cache is available for tasks: clean build

BUILD SUCCESSFUL in 4s
12 actionable tasks: 12 executed
Configuration cache entry stored.

Second build, reusing configuration cache (fails):

$ ./gradlew clean build --no-build-cache --configuration-cache
Configuration cache is an incubating feature.
Reusing configuration cache.
> Task :subproject-one:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':subproject-one:compileJava'.
> Extension with name 'errorprone' does not exist. Currently registered extension names: [ext]

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 679ms
4 actionable tasks: 4 executed
Configuration cache entry reused.
@tbroyer
Copy link
Owner

tbroyer commented Jun 24, 2021

I must say I'm a bit surprised, because there's a test that should cover that:

AFAICT, the main difference is that the test doesn't explicitly configure options.errorprone, and that probably explains the difference in behavior here.

@tbroyer
Copy link
Owner

tbroyer commented Jun 27, 2021

OK, finally understood what goes wrong: for some reason, the extension is (unexpectedly) not registered when the task is executed, so the doFirst action cannot get it out from the task. The extension object is "in scope" though so simply using it rather than retrieving it from the ExtensionContainer is enough to workaround the problem.

This is unrelated to whether the build script explicitly configures the extension or not, and the reason the test didn't caught it is because it didn't actually re-run the task (it's up to date).

@tbroyer
Copy link
Owner

tbroyer commented Jun 28, 2021

I published v2.0.2 with that change.

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

No branches or pull requests

2 participants