-
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
Revert work-around removal from #719 and properly fix #711 #770
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
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.
It's not clear what your primary goal is, but excluded tasks seem to still be broken: gradle/gradle#21179 . So I don't know why you are removing the workaround.
I don't remove any work-around. |
Also, since 0521fe7 the original reproducer does not reproduce with the work-around removed. |
The original reproducer still reproduces if one wants to I played with the code and if you really want to support excluding random tasks and configuration cache, there is an even uglier work-around variant of the original work-around by introducing a dummy no-action task that is used as a task dependency for If you want that version instead, I can change this PR to reintroduce the original work-around including that extension. |
I pushed that new work-around version here that I mentioned |
3f60efc
to
62cbb4e
Compare
The CodeNarc violation is because |
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'm paging all this back into my memory. I see more now what your earlier commit did. The whims of the configuration cache still partly elude me, such that I still don't follow how #713 made it better, but I also suspect that AGP is partly to blame. I do follow this change though, that the task delays resolution.
In general I'm not too partial to supporting excluding tasks, but I also understand there's performance impacts to parts of the plugin behavior.
Codenarc is complaining about too many parameters to a method? @SuppressWarnings
and codenarc-disable
don't seem to work for our configuration, so let's just disable that check.
diff --git a/config/codenarc/codenarc.xml b/config/codenarc/codenarc.xml
index 12e743c..7feebb8 100644
--- a/config/codenarc/codenarc.xml
+++ b/config/codenarc/codenarc.xml
@@ -77,6 +77,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<exclude name="CyclomaticComplexity"/>
<exclude name="NestedBlockDepth"/>
<exclude name="MethodCount"/>
+ <exclude name="ParameterCount"/>
</ruleset-ref>
<ruleset-ref path='rulesets/unused.xml'/>
<ruleset-ref path='rulesets/unnecessary.xml'>
src/main/groovy/com/google/protobuf/gradle/ProtobufPlugin.groovy
Outdated
Show resolved
Hide resolved
Well, that's actually not that complex once you got the grip, attribute-/variant-aware resolution is a hard nut to crack. Configuration cache tries to save as much time as possible up to execution phase. Resolving external dependencies? => Does not need to be done at execution time as it would always give the same result, so can be done before saving CC entry and result persisted. Artifact transforms of external dependencies? => Does not need to be done at execution time, as it would always give the same result, so can be done before saving CC entry and result persisted. A provider chain that evaluates to a certain value? => Does not need to be done at execution time, as it should always give the same result, so all the providers are evaluated to their final value at CC entry store time and the result persisted. There is one exception though. #713 / #719 were effectively a revert of the workaround for #550 just leaving out some bits which were then useless, i.e. what I originally changed in this PR. #713 / #719 reverted it back to the idiomatic state where Now the problem is, with the excluded tasks. If you call With the work-around that was in place before #713 / #719 and with this PR in its current state merged you basically just disable this warning, telling Gradle "I know for sure that everyone that is using my plugin is a very knowledgable Gradle expert that is fully and totally aware of what he is doing when he excludes a task and it is fine to work on non-existent or stale files in this case". You have the same problem in other places like when copying task outputs around and so on, you just do not get an error for that yet. Or when resolving a configuration that uses artifact transforms and depends on projects in the same build, during configuration time. Even without task exclusion these artifact transforms are then executed on the absent or stale task outputs and this result is persisted and used later on, even after the respective task was actually executed already later on. And additionally the task dependency in that configuration is marked as fulfilled even if the task was not executed, so if no other part of the build depends on that task, it additionally is like the task was excluded. Actually Gradle folks even have plans to deprecate I said "not yet" because after gradle/gradle#11100 is done - and I actually hope it comes as it would make many inherently broken and unreliable builds fail instead so they can properly be fixed, just hopefully without sacrificing |
Doh, sorry for the delay merging. I missed rougsig's very-speedy review 😄. Thank you for the explanation, I've not gotten through it yet, but I do plan to. I definitely believe the configuration cache is easier than attribute-/variant-aware resolution; I've found that resolution to be avoided even before getting into its complexities, since there's games being played with it (that Gradle contributed to Guava) and there's weak/broken diagnostics. |
?!? With GMM you can e.g. have different dependencies depending on Java version you use (e.g. when you need a dependency providing classes that were present in JDK 8 but are now removed and in a separate dependency when using JDK 17), or can resolve different variants for different use-cases explicitly, or can use have a proper separation which dependencies you need downstream for compilation vs. runtime to reduce compilation times, increase up-to-dateness cases, and cache entry reusability, .... But well, your project, your decision. :-) |
As a library GMM doesn't add any value and can only cause problems. Library consumers will often use Maven so there's no way for us to leverage its capabilities (not that I've seen a compelling case outside of Kotlin native, which is a different discussion). As a library we don't choose the version of Java, api/implementation already provides a good separation of dependencies, and I'm very doubtful it could offer up-to-dateness and cache reusability improvements (or rather, if it can, I don't want to know about it because it is going to be too complicated and fickle). We'd benefit most if our dependencies used Gradle so their |
No description provided.