-
Notifications
You must be signed in to change notification settings - Fork 275
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
Remove generate proto task link to compile on #586
Conversation
Now: Java/kotlin: compile task implicit depends on generate proto task via source sets Android: compile tasks depends on generate proto task via registerJavaGeneratingTask
ca818fd
to
f4f6689
Compare
1a668b2
to
e24e2f2
Compare
@@ -258,11 +256,6 @@ public abstract class GenerateProtoTask extends DefaultTask { | |||
this.outputBaseDir = outputBaseDir | |||
} | |||
|
|||
@OutputDirectory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you remove this, then you need to add in OutputFiles for the descriptor and for .zip outputs. The way I did that before:
- For DescriptorSetOptions, make
path
an@Input
and make a new method that returns the non-null output file name. That new method gets@OutputFile
. - I made PluginOptions non-static which requires passing a factory method to domainObjectContainer for
builtins
andplugins
. Then I made two@Optional
methods in PluginOptions, one that wasOutputFile
and one that was `OutputDirectory. This approach takes some refactoring, but overall seemed cleaner- The quicker approach is to add a new method
getOutputSourceFiles()
that has@OutputFiles
and returns the files filtered duringgetOutputSourceDirectories()
- The quicker approach is to add a new method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What problem are we trying to solve with this logic? Looks too complicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the outputs need to be tracked. If you remove the output base dir as an output, then you must track all the individual files/directories. But getOutputSourceDirectories()
doesn't return any of the files. Thus you need some other mechanism to expose the output files. There's multiple ways to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plugins/Buildins generate files in subfolders. Descriptor is tracked by getDescriptorSetOptionsForCaching
. Does anything write files directly to outputBaseDir
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plugins/Buildins generate files in subfolders
Often. But protoc can also generate a zip or jar file directly. Those outputs are filtered out from getOutputSourceDirectories()
.
Descriptor is tracked by getDescriptorSetOptionsForCaching
Not entirely. DescriptorSetOptions.path
is an @OutputFile
, but it is only used if the user overrides the path. If the user uses the default path then that path would be untracked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see comments in the code
protoc is capable of output generated files directly to a JAR file or ZIP archive if the output location ends with .jar/.zip
However, I do not see any documentation of this feature in the protobuf-gradle-plugin. I also do not see any tests for this feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not entirely. DescriptorSetOptions.path is an @OutputFile, but it is only used if the user overrides the path. If the user uses the default path then that path would be untracked.
Sounds like a bug, doesn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see any documentation of this feature in the protobuf-gradle-plugin
All the background I see: #480 and #533 .
Sounds like a bug, doesn't it?
Not on master. If there is an output descriptor, then it is either a child of the base directory or it is the user-configured name. This PR removes the base directory as an output so that introduces a bug.
Java/kotlin: compile task implicit depends on generate proto task via source sets
Android: compile tasks depends on generate proto task via registerJavaGeneratingTask