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

Workaround mapped value before task completed error for excluded task #576

Merged
merged 1 commit into from
Jul 15, 2022

Conversation

ejona86
Copy link
Collaborator

@ejona86 ejona86 commented Jul 6, 2022

When using provider.map, Gradle has checks that can fail if the provider
is used too early. For example:

Querying the mapped value of provider(interface java.util.Set) before
task ':p1:compileScala' has completed is not supported

However, it seems those checks can also fire even if the incomplete task
is a properly registered dependency and only when accessed from an
action. This is possible when using -x to exclude a task. This deserves
a Gradle bug, but let's workaround it in the meantime.

Fixes #550

CC @rougsig, @Thrillpool

This will workaround whatever problem @Toldry experienced, but I expect that was a different issue compared to that seen by Thrillpool. There's a strong risk that there was a legitimate issue in Toldry's build that now will be silent. But without a reproduction not much we can do for something this nuanced.

When using provider.map, Gradle has checks that can fail if the provider
is used too early. For example:
> Querying the mapped value of provider(interface java.util.Set) before
> task ':p1:compileScala' has completed is not supported

However, it seems those checks can also fire even if the incomplete task
is a properly registered dependency and only when accessed from an
action. This is possible when using -x to exclude a task. This deserves
a Gradle bug, but let's workaround it in the meantime.

Fixes google#550
@rougsig
Copy link
Collaborator

rougsig commented Jul 6, 2022

I think we should not depend on compile and processResources tasks. We should depend only on own tasks.

We are currently requesting an artifact with the following attributes: LibraryElement=resources, UsageAttribute=javaRuntime. An artifact with that attributes will be created by the processResources task. We can create our own unique attributes to request an artifact from project dependencies. Artifact will be built by own task. Leave as is for non-project dependencies.

Actually is not a solution for the bug, it's a bit change for plugin logic.

@ejona86
Copy link
Collaborator Author

ejona86 commented Jul 6, 2022

We are currently requesting an artifact with the following attributes

I'm fuzzy on how that is plumbed, but I agree. Right now if you try to add directories generated by GenerateProtoTask to SourceSet.java then you get an infinite loop.

@ejona86
Copy link
Collaborator Author

ejona86 commented Jul 6, 2022

gradle/gradle#21179 is bug I filed with Gradle. We'll see where that leads.

@ejona86 ejona86 requested a review from YifeiZhuang July 6, 2022 16:10
@rougsig
Copy link
Collaborator

rougsig commented Jul 10, 2022

See details about compile task here #578

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

Successfully merging this pull request may close these issues.

version 0.8.15 causes extractIncludeProto to fail in Gradle 7
3 participants