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

BuildServiceParameters fails with convention plugins #27099

Closed
dima-avdeev-jb opened this issue Nov 20, 2023 · 5 comments · Fixed by #29364
Closed

BuildServiceParameters fails with convention plugins #27099

dima-avdeev-jb opened this issue Nov 20, 2023 · 5 comments · Fixed by #29364
Assignees
Labels
a:bug has:reproducer DON'T USE in:build-services Shared Build Services
Milestone

Comments

@dima-avdeev-jb
Copy link

Current Behavior

BuildServiceParameters fails with convention plugins

org.gradle.internal.snapshot.impl.IsolationException: Could not isolate value org.example.MyParameters_Decorated@33db25b2 of type MyParameters

where MyParameters - it is my own interface

interface MyParameters : BuildServiceParameters {
    val someInt: Property<Int>
}

Expected Behavior

Better to support usage of BuildServiceParameters without workaround

Context (optional)

I found workaround to call all paratemers in my custom BuildServiceParameters at least once.
All described in reproducer repository.

Maybe where are some documentation that describe this behavior, or maybe related Issue already created?

Steps to Reproduce

Made reproducer here:
https://github.com/dima-avdeev-jb/gradle-build-service-parameters-issue

Gradle version

8.4

Build scan URL (optional)

https://gradle.com/s/voqsbvcxhvfcc

Your Environment (optional)

  • MacOS 13.5.2 (22G91)
  • openjdk 17.0.8 2023-07-18 LTS
@cobexer
Copy link
Member

cobexer commented Nov 21, 2023

Thank you for providing a valid report.

The issue is in the backlog of the relevant team and is prioritized by them.

@dima-avdeev-jb
Copy link
Author

Is it good to access all properties at least once as a workaround for now?

dima-avdeev-jb added a commit to JetBrains/compose-multiplatform that referenced this issue Nov 24, 2023
dima-avdeev-jb added a commit to JetBrains/compose-multiplatform that referenced this issue Nov 24, 2023
dima-avdeev-jb added a commit to JetBrains/compose-multiplatform that referenced this issue Nov 24, 2023
Fix for Issue
#3933

Applyed workaround described in Gradle Issue:
gradle/gradle#27099
We just need to call all functions (getters in our case) in our
interface based on BuildServiceParameters at least once
@mlopatkin mlopatkin added this to the 8.6 RC1 milestone Nov 28, 2023
@eskatos
Copy link
Member

eskatos commented Dec 7, 2023

FWIW, this impacts the org.jetbrains.compose plugin and makes its usage from convention plugins a pain because the build fails after having succeeded if precompiled kotlin scripts have been built during the invocation.

 * What went wrong:
Could not isolate value org.jetbrains.compose.internal.service.ConfigurationProblemReporterService$Parameters_Decorated@ccc1163 of type ConfigurationProblemReporterService.Parameters
> BuildScopeServices has been closed.

Exception is the same as in the buildscan from the description.

Workaround was to move the application of the plugin with build services out of the convention plugin down on the using projects instead. The precompiled plugin then reacts with pluginManager.withPlugin("offending-plugin-id") {}.

@LionZXY
Copy link

LionZXY commented May 29, 2024

Since Kotlin 2.0 compose the plugin from JetBrains has been used for Android as well.
So this problem is acute for android-pure Compose applications as well

@mlopatkin
Copy link
Member

@dima-avdeev-jb thank you for the accurate reproducer, it has just enough pieces to trigger the issue. With it, getting to the root cause was almost a walk in the park.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug has:reproducer DON'T USE in:build-services Shared Build Services
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants