is there any reason to be concerned, from a CC or ...
# configuration-cache
t
is there any reason to be concerned, from a CC or IP perspective (or anything else), with usage of the
Project.findProperty()
(and related) APIs? Tracing that code, it looks like a holdover from the old Groovy/dynamic days, as it accesses project "properties" hierarchically from closest to farthest, all the way back to the root if necessary. use-case: it is pretty common in a lot of repos to have
subproject/gradle.properties
files to define properties that aren't global. However, properties defined there aren't available via
providers.gradleProperty()
, they're only available via
project.findProperty()
and whatnot.
e
j
as you said,
findProperty()
searches upward through parent projects, so it will cause isolated projects violations if that happens
t
I'm actually shocked to discover it is NOT working its way up through the hierarchy. If it doesn't find it in the local project, it appears to get it from the global property (according to my debugger)
I must have something weird in my environment. I literally just validated the hierarchy thing via a test
j
Thats surprising given the very clear claims in the docs for it ๐Ÿ˜„ I just remember recently having to replace a few cases of it with
providers.gradleProperty()
where the intent was to read from root
gradle.properties
and it triggered Isolated Projects errors when using findProperty()
also TIL that this can return tasks ๐Ÿ™ƒ
t
well Cash is screwed then, as is every project using the Vanniktech publish plugin and relying on local gradle.properties files
oh yeah, that sounds like an old Gradleism for sure
ok I figured it out. If there is a ROOT properties file AND NOT a local properties file, then
findProperty()
will get the value from the ROOT. It does NOT walk up the hierarchy getting the nearest value
a
@tony, I wonder if there is confusion as to what source of properties are considered by
findProperty()
overall. If what you observe is the case, then it seems like a bug. At the same time, the contract in the
Project.findProperty()
javadoc is rather elaborate and, probably, very historical. Could you provide a minimal reproducer and create an issue if thatโ€™s the case?
t
I can reproduce it in a test case, so I can probably repro it to file an issue as well