-
Notifications
You must be signed in to change notification settings - Fork 0
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
Improve caching of protoc
in GenerateProtoTask
#1
Conversation
35df827
to
aa107a8
Compare
src/main/groovy/com/google/protobuf/gradle/GenerateProtoTask.groovy
Outdated
Show resolved
Hide resolved
c1e0b45
to
07361fd
Compare
} | ||
|
||
outputs.upToDateWhen { | ||
!provider.getOrElse("").endsWith("-SNAPSHOT") |
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.
Couldn't decide if it was worth trying to cache on snapshots. A typical plugin consumer isn't going to utilize them.
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.
this eagerly resolves the provider when this function is called in order to add an output upToDate condition. i don't think this is a good practice.
07361fd
to
4bdd52b
Compare
This change will remove the OS from the input properties of the `GenerateProtoTask`. The expectation is that same versions of `protoc` will produce same outputs regardless of the OS on which it was run. If a protoc `artifact` is defined with GAV parameters, the classifier and extension will not be considered part of the input. An exception is made for snapshots, which will always be considered out of date and be re-run. If a protoc `path` is defined, then the path will be exposed as a File Provider with absolute path normalization since there is no good way to tell the version of `protoc` without running `protoc --version`. See google#457.
4bdd52b
to
8a7e414
Compare
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.
Can you ask Gary or the build tool team if there is a better way of excluding the classifier here?
@InputFile | ||
@PathSensitive(PathSensitivity.ABSOLUTE) | ||
@Optional | ||
Provider<File> getProtocPath() { |
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's the case where this absolute path is relevant to the output? the previous input had PathSensitivity.NONE
} | ||
|
||
outputs.upToDateWhen { | ||
!provider.getOrElse("").endsWith("-SNAPSHOT") |
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.
this eagerly resolves the provider when this function is called in order to add an output upToDate condition. i don't think this is a good practice.
@PathSensitive(PathSensitivity.NONE) | ||
@Input | ||
@Optional | ||
Provider<String> getProtocArtifact() { |
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.
this returns a single string as an input but the previous alternativePaths
property could return a collection of files. do you know what the case is with multiple alternativePaths
?
This change will remove the OS from the input properties of the
GenerateProtoTask
. The expectation is that same versions ofprotoc
will produce same outputs regardless of the OS on which it was run.
If a protoc
artifact
is defined with GAV parameters, the classifierand extension will not be considered part of the input. An exception is
made for snapshots, which will always be considered out of date and be
re-run.
If a protoc
path
is defined, then the path will be exposed as a FileProvider with absolute path normalization since there is no good way to
tell the version of
protoc
without runningprotoc --version
.See google#457.