This message was deleted.
# community-support
s
This message was deleted.
m
I think you should stray from using
Task.project
as much as possible
a
agreed, just trying to determine what my situation is currently 🙂
a
using
Task.getProject()
or any instance of
Project
is a problem because of Configuration Cache https://docs.gradle.org/8.1.1/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution Config cache tries to store the Gradle config to disk using Java Serialization, but it can’t store a Project because it’s too big and complicated. But if you’re only running tasks that aren’t loaded from the config cache, then you’re not going to have a problem. But maybe those warnings were coming from Gradle plugins that were updated in 8.1.1 to be Config Cache compatible, or maybe you updated some other plugins as well that also fixed Config Cache problems?
a
ok but again, that doesn't address my question
a
if your build is running okay then there’s no problem 👍 But yes, the “don’t use Project” restriction still applies.
a
again, I'm skeptical that it's "running ok" because this was a warning in 7.6 that it would cause deprecation failure and that didn't seem to happen...because there's a disconnect I'm looking for some verification from the gradle community about whether or not this deprecation failure should have happened or not
a
https://docs.gradle.org/current/userguide/upgrading_version_7.html#task_project
Calling Task.getProject() from a task action at execution time is now deprecated and will be made an error in Gradle 8.0. This method can be used during configuration time, but it is recommended to avoid doing this.
does that help with your question?
a
no, you're repeating part of my question
if you read my original question, I stated that have deprecation warnings about task.project in gradle 7.6, yet I was able to upgrade to 8.1.1 without encountering any build errors. This is not consistent with my expectations, so I am seeking clarification about whether this should have actually failed, or if it is no longer a build error in gradle 8.1.1
a
what sort of clarification are you looking for? I’m not sure what else can answer your question more than a link to the docs
a
I stated what I'm trying to get for clarification...if you can only link me to the docs, then kindly wait for someone else to answer
thanks
a
do you know what the causes were for the warnings you saw?
v
Did you enable the
STABLE_CONFIGURATION_CACHE
feature preview when on 7.6 and removed this during the upgrade to 8.1.1?
âś… 1
Iirc that deprecation warning only comes if you enable that feature preview and if you enable configuration cache with Gradle 8 it should indeed fail iirc.
a
yes, it's enabled in gradle.settings but set to false in our gradle.properties
ok awesome...thanks Vampire
👌 1
that's an easy test then, I'll enable it in my 8.1.1 env and that should fail
otherwise looks like the 8.1.1 upgrade is fine, but our config caching will be busted...no surprise...super legacy project that needs a LOT of TLC
v
Actually if
STABLE_CONFIGURATION_CACHE
is still enabled, you should still get the depreaction warning even if you disabled the configuration cache.
I just tried with 8.1.1. Without the preview feature and without CC => all green With the preview feature and without CC => deprecation warning With CC => failure
If you have the feature enabled but do not get the deprecation warning, you most probably do not reach the code path where the project instance is used at execution time, for example because the task being up-to-date or served from-cache
a
interesting ok...I might want to just remove it to be safe then until I can rewrite the plugins responsible for that pesky task.project stuff
thanks again Vampire
👌 1