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

version 0.8.15 causes extractIncludeProto to fail in Gradle 7 #550

Closed
Toldry opened this issue Feb 22, 2022 · 18 comments · Fixed by #576
Closed

version 0.8.15 causes extractIncludeProto to fail in Gradle 7 #550

Toldry opened this issue Feb 22, 2022 · 18 comments · Fixed by #576
Labels
gradle compatibility Compatibility issues with Gradle

Comments

@Toldry
Copy link

Toldry commented Feb 22, 2022

After upgrading our project to Gradle 7 and upgrading the plugin to 0.8.15 , running ./gradlew extractIncludeProto causes the following error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':socialmedia-server-api:extractIncludeProto'.
> Querying the mapped value of provider(interface java.util.Set) before task ':socialmedia-server-api:processResources' has completed is not supported

Notes

  • This error does not occur in 0.8.14 ✅, but it does in versions 0.8.15 ❌ and above
  • According to the gradle docs:

Querying the value of a mapped output property before the task has completed can cause strange build failures because it indicates stale or non-existent outputs may be used by mistake. This behavior is deprecated and will emit a deprecation warning. This will become an error in Gradle 7.0.

@Toldry
Copy link
Author

Toldry commented Feb 22, 2022

Here's the output when running the task with --full-stacktrace :

Execution failed for task ':socialmedia-server-api:extractIncludeProto'.
> Querying the mapped value of provider(interface java.util.Set) before task ':socialmedia-server-api:processResources' has completed is not supported

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':socialmedia-server-api:extractIncludeProto'.
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:38)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:74)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:333)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:320)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:313)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:299)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:143)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:227)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:218)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:140)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.gradle.api.InvalidUserCodeException: Querying the mapped value of provider(interface java.util.Set) before task ':socialmedia-server-api:processResources' has completed is not supported
	at org.gradle.api.internal.provider.TransformBackedProvider.lambda$beforeRead$0(TransformBackedProvider.java:84)
	at org.gradle.api.internal.provider.BuildableBackedProvider$1.visitProducerTasks(BuildableBackedProvider.java:56)
	at org.gradle.api.internal.provider.ValueSupplier$ValueProducer.visitContentProducerTasks(ValueSupplier.java:59)
	at org.gradle.api.internal.provider.TransformBackedProvider.beforeRead(TransformBackedProvider.java:81)
	at org.gradle.api.internal.provider.TransformBackedProvider.calculateOwnValue(TransformBackedProvider.java:63)
	at org.gradle.api.internal.provider.AbstractMinimalProvider.get(AbstractMinimalProvider.java:84)
	at org.gradle.api.internal.provider.ProviderResolutionStrategy$2.resolve(ProviderResolutionStrategy.java:33)
	at org.gradle.api.internal.file.collections.ProviderBackedFileCollection.visitChildren(ProviderBackedFileCollection.java:63)
	at org.gradle.api.internal.file.CompositeFileCollection.visitContents(CompositeFileCollection.java:119)
	at org.gradle.api.internal.file.AbstractFileCollection.visitStructure(AbstractFileCollection.java:351)
	at org.gradle.api.internal.file.CompositeFileCollection.lambda$visitContents$0(CompositeFileCollection.java:119)
	at org.gradle.api.internal.file.collections.UnpackingVisitor.add(UnpackingVisitor.java:74)
	at org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection$UnresolvedItemsCollector.visitContents(DefaultConfigurableFileCollection.java:372)
	at org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection.visitChildren(DefaultConfigurableFileCollection.java:284)
	at org.gradle.api.internal.file.CompositeFileCollection.visitContents(CompositeFileCollection.java:119)
	at org.gradle.api.internal.file.AbstractFileCollection.visitStructure(AbstractFileCollection.java:351)
	at org.gradle.api.internal.file.FileCollectionBackedFileTree.visitContents(FileCollectionBackedFileTree.java:98)
	at org.gradle.api.internal.file.FileCollectionBackedFileTree.visitContentsAsFileTrees(FileCollectionBackedFileTree.java:73)
	at org.gradle.api.internal.file.FilteredFileTree.visitChildren(FilteredFileTree.java:66)
	at org.gradle.api.internal.file.CompositeFileCollection.visitContents(CompositeFileCollection.java:119)
	at org.gradle.api.internal.file.AbstractFileCollection.visitStructure(AbstractFileCollection.java:351)
	at org.gradle.api.internal.file.CompositeFileCollection.lambda$visitContents$0(CompositeFileCollection.java:119)
	at org.gradle.api.internal.file.collections.UnpackingVisitor.add(UnpackingVisitor.java:64)
	at org.gradle.api.internal.file.collections.UnpackingVisitor.add(UnpackingVisitor.java:89)
	at org.gradle.api.internal.file.DefaultFileCollectionFactory$ResolvingFileCollection.visitChildren(DefaultFileCollectionFactory.java:333)
	at org.gradle.api.internal.file.CompositeFileCollection.visitContents(CompositeFileCollection.java:119)
	at org.gradle.api.internal.file.AbstractFileCollection.visitStructure(AbstractFileCollection.java:351)
	at org.gradle.api.internal.file.CompositeFileCollection.lambda$visitContents$0(CompositeFileCollection.java:119)
	at org.gradle.api.internal.tasks.PropertyFileCollection.visitChildren(PropertyFileCollection.java:48)
	at org.gradle.api.internal.file.CompositeFileCollection.visitContents(CompositeFileCollection.java:119)
	at org.gradle.api.internal.file.AbstractFileCollection.visitStructure(AbstractFileCollection.java:351)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.lambda$detectMissingDependencies$5(LocalTaskNodeExecutor.java:99)
	at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:406)
	at com.google.common.collect.RegularImmutableSortedSet.forEach(RegularImmutableSortedSet.java:86)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.detectMissingDependencies(LocalTaskNodeExecutor.java:97)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.lambda$execute$0(LocalTaskNodeExecutor.java:71)
	at org.gradle.api.internal.tasks.execution.TaskExecution.validate(TaskExecution.java:477)
	at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:78)
	at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:57)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:76)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:50)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.executeWithNoEmptySources(SkipEmptyWorkStep.java:249)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:86)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:54)
	at org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep.execute(RemoveUntrackedExecutionStateStep.java:32)
	at org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep.execute(RemoveUntrackedExecutionStateStep.java:21)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)
	at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:43)
	at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:31)
	at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:40)
	at org.gradle.api.internal.tasks.execution.TaskExecution$4.withWorkspace(TaskExecution.java:287)
	at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:40)
	at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:30)
	at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:37)
	at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:27)
	at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:44)
	at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:33)
	at org.gradle.internal.execution.impl.DefaultExecutionEngine$1.execute(DefaultExecutionEngine.java:76)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:144)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:133)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:77)
	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:74)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:333)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:320)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:313)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:299)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:143)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:227)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:218)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:140)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

@Toldry
Copy link
Author

Toldry commented Apr 12, 2022

Any updates?

@Thrillpool
Copy link

Same issue here. For me it happens if I exclude any task which populates the build directory.

@Thrillpool
Copy link

Really would like this looked at, I would very much like to upgrade and pick up this commit 8df229f, but this is blocking me. I'm sure it's not hard, it must be from this commit bf6301a.

I'll make a fork soon if no response.

@ejona86
Copy link
Collaborator

ejona86 commented Jun 30, 2022

8df229f was released today in v0.8.19

@Thrillpool
Copy link

@ejona86 That's true, appreciated, but it still has the issue this topic concerns, that if you exclude tasks that Gradle knows populates the build directory while running extractIncludeProto, then the task fails. I can't really upgrade until it is resolved, as some of the developers at my work do that sort of thing (i.e. exclude certain tasks) regularly.

@ejona86
Copy link
Collaborator

ejona86 commented Jun 30, 2022

Not that I have any time to look at this, but I'll note it isn't all that actionable as the plugin isn't in the stacktrace and there's no reproduction.

@Thrillpool
Copy link

Thrillpool commented Jun 30, 2022

Fair point re no reproduction.

Here is a (fairly, probably the scala plugin is superfluous) minimal reproduction

Thrillpool/gradle-protobuf-bug@720c56c

Run ./gradlew :p2:build -x compileScala and you will see "Querying the mapped value of provider(interface java.util.Set) before task ':p1:compileScala' has completed is not supported". If you downgrade to 0.8.14 there is no such error.

I will make a fix over the weekend. I'll admit I didn't appreciate before making this reproduction that the java-library plugin was required to make the error happen, that is interesting, but I don't think it is a bug with that plugin.

@ejona86
Copy link
Collaborator

ejona86 commented Jun 30, 2022

That's a pretty compact reproduction. Looks like it is happening before the task runs. I suspected something strange like that might be happening, but it isn't obvious how to resolve the issue if the other task will never be run.

2022-06-30T15:15:42.882-0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Task :p2:extractIncludeProto' started
2022-06-30T15:15:42.882-0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Snapshot inputs and outputs before executing task ':p2:extractIncludeProto'' started
2022-06-30T15:15:42.883-0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Completing Build operation 'Snapshot inputs and outputs before executing task ':p2:extractIncludeProto''
2022-06-30T15:15:42.882-0700 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] 
2022-06-30T15:15:42.882-0700 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] > Task :p2:extractIncludeProto FAILED
2022-06-30T15:15:42.882-0700 [DEBUG] [org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter] Putting task artifact state for task ':p2:extractIncludeProto' into context took 0.0 secs.
2022-06-30T15:15:42.882-0700 [DEBUG] [org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep] Implementation for task ':p2:extractIncludeProto': com.google.protobuf.gradle.ProtobufExtract_Decorated@ffaa5fe2ef2dd247bdaa8dce5cc335ff
2022-06-30T15:15:42.882-0700 [DEBUG] [org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep] Additional implementations for task ':p2:extractIncludeProto': [com.google.protobuf.gradle.ProtobufExtract_Decorated@ffaa5fe2ef2dd247bdaa8dce5cc335ff]
2022-06-30T15:15:42.883-0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Snapshot inputs and outputs before executing task ':p2:extractIncludeProto'' completed

@Thrillpool
Copy link

I have a fix, the troublesome line is this one

bf6301a#diff-ce7f3a5cefd661ce9628d8d55b9ed9a02ff244a8a10dbcfd012818bad47a6e5eR150

inputFiles.getElements().map ... is the 'mapped provider' that Gradle is complaining about.

Is there anything I should know regarding the tests for this project? When I clone the repo as is and run the tests I get 30 pass, 50 fail. The errors themselves are along the lines of

'Caused by: org.gradle.api.GradleException: protoc: stdout: . stderr: test1.proto: File not found.'

I am on Windows, if it is significant. I'm sure I can work it out myself so if it's not something known don't worry.

@rougsig
Copy link
Collaborator

rougsig commented Jul 1, 2022

I will check this issue on sunday.

@rougsig rougsig added the gradle compatibility Compatibility issues with Gradle label Jul 1, 2022
@ejona86
Copy link
Collaborator

ejona86 commented Jul 2, 2022

@Thrillpool, I've not seen failures like that. I honestly don't know if the tests have recently been run on Windows, so that may indeed be the problem.

@rougsig
Copy link
Collaborator

rougsig commented Jul 3, 2022

@Thrillpool
Some ways to workaround the problem:

  1. You cannot exclude compile, processResources tasks. All other tasks can be excluded for that issue without problems.
  2. Don't create dependencies between modules with the protobuf plugin. i.e. in your test project you have p2 dependent on p1. They both have the protobuf plugin, so don't do that.

@Toldry
Could you provide a gradle scan for the extractIncludeProto task? Just add the --scan argument and accept the Gradle publishing terms, then post the scan link in a comment.

If you are unable to provide a scan:
Does the project have modules with the protobuf plugin and does it depend on another module with the protobuf plugin?
Could you please describe structure of your project. I'm interested in cross-module dependencies and plugins.
Project structure example:

├── p1
    ├── plugins: android, scala, protobuf
├── p2
    ├── dependencies: api p1
    ├── plugins: kotlin, java, protobuf
├── p3
    ├── dependencies: api p1, implementaion p2
    ├── plugins: kotlin, java, protobuf

What is actually going on inside:
To add protos-in-dependencies feature, extractIncludeProto task uses source set compile classpath. This means that the task extractIncludeProto depends on the compile task of the dependent module. (yes, the plugin runs a compile task to generate prototypes, it's weird but it's true)

Gradle scan screenshot

https://scans.gradle.com/s/wnbz2soej3hnw/timeline

image

:p2:extractIncludeProto input files from test project

gradle-protobuf-bug/p1/build/resources/main
gradle-protobuf-bug/p1/build/classes/java/main
gradle-protobuf-bug/p1/build/classes/scala/main

So I guess it's a slightly different issue. extractIncludeProto task should not depend on compiled classes, it should depends only on *.proto files.

@Thrillpool
Copy link

Neither of those workarounds sound especially practical for me.

  1. People want to do that, I'm not going to upset their workflow and tell them they can't.
  2. That's how our project is setup, there's no real chance of me reshuffling around such that it isn't this way.

To me it seems like either #452 should be reverted, given that it's just an optimisation anyway.

Or bf6301a#diff-ce7f3a5cefd661ce9628d8d55b9ed9a02ff244a8a10dbcfd012818bad47a6e5eR150 line should be resolved. To me it seemed like it could be fixed just by restructuring the logic a bit.

It wants to do this map of the provider and do a objectFactory.fileCollection().from on the mapped thing. But could we not just eagerly get inputFiles.getElements(), and just do some logic on the resulting Set and objectFactory.fileCollection().from the Set we make.

@rougsig
Copy link
Collaborator

rougsig commented Jul 3, 2022

I'll try to find the best solution for the issue this week.

ejona86 added a commit to ejona86/protobuf-gradle-plugin that referenced this issue 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 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
ejona86 added a commit to ejona86/protobuf-gradle-plugin that referenced this issue 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 google#550
@vlsi
Copy link

vlsi commented Jul 10, 2022

It looks like protobuf plugin attempts to scan compile classpath and find .proto files there.

Is there a real need to scan compile classpath? What if users who want .proto from jars would add the deps to a special protobuf configuration? Then compileClasspath scanning won't be needed, and exclusion of compileScala won't break proto tasks

@rougsig
Copy link
Collaborator

rougsig commented Jul 10, 2022

There is no real need. It is necessary to change the logic of work from dependencies. Stop taking dependencies from implementation, take them only from protobuf.

@rougsig
Copy link
Collaborator

rougsig commented Jul 10, 2022

Details about "don't depend on compilation tasks" here #578.

ejona86 added a commit that referenced this issue Jul 15, 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gradle compatibility Compatibility issues with Gradle
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants