Hi everyone, Is there a way to hook into Gradle'...
# community-support
t
Hi everyone, Is there a way to hook into Gradle's resolution of up to date checking? For example, I have a Settings plugin that would like to detect whether one of its subprojects have changed, in order to do some logic
p
I don’t think there is such option, why do you need it?
t
So I'm trying to build a plugin that caters to monorepos And the use case is detecting whether the subprojects have changed in order to bump the version number of the root project
p
Well, as a workaround you can always write the subproject names to a file and compare them, but how are your subprojects related to the version number? Personally, I often change subprojects, for example creating a new feature results into a new subproject, or I rename/refactor them without public changes.
t
Huhm So I'm creating a Settings plugin that parses conventional commits of the subprojects and bumping the version of the root project according to commit messages. So if I detect that there has been commits to the subprojects starting with "feat:", for example, I will do a minor bump on the root project.
v
And what do you do with subprojects in that regard? And what does "have changed" even mean in that context? Gradle has no meaning of "project has changed". Gradle's up-to-date checks only determine whether a single task is up-to-date or needs to be run when requested to run.
t
Huhm "Have changed" for this plugin means a commit has landed in one of its subprojects So because I'm just reading the git commits to determine whether a project itself has changed ... My plugin would operate independently from Gradle's up-to-date checks
v
Exactly, Gradle knows nothing about Git commits
k
We just open sourced this plugin which internally does what you're looking for. It definitely is geared towards merge queues but I wonder if it's helpful to crib from: https://github.com/Faire/build-targets-gradle-plugin