Skip to content

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

Merged
ejona86 merged 1 commit into
google:masterfrom
ejona86:exclude-error
Jul 15, 2022
Merged

Workaround mapped value before task completed error for excluded task#576
ejona86 merged 1 commit into
google:masterfrom
ejona86:exclude-error

Conversation

@ejona86

@ejona86 ejona86 commented Jul 6, 2022

Copy link
Copy Markdown
Collaborator

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

rougsig commented Jul 6, 2022

Copy link
Copy Markdown
Collaborator

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

ejona86 commented Jul 6, 2022

Copy link
Copy Markdown
Collaborator Author

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

ejona86 commented Jul 6, 2022

Copy link
Copy Markdown
Collaborator Author

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

rougsig commented Jul 10, 2022

Copy link
Copy Markdown
Collaborator

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