Usually, we do partial builds, invoking gradle from one of the subrpojects.
Except for project-specific configurations, all our build logic is in the master project. Is there a way to know from there which project was gradle invoked from?
Example: We have projects A, B, C and master. We invoke gradle from project A. master’s project build.gradle is executed. We would like to identify from there that project A is where gradle was invoked from.
in your root project build.gradle and go into one of your subprojects and run “gradle whoami”, it will print out the subproject project path and project dir in the whoami task. Also, if you need to get hold of the calling project location outside of any tasks, the startParameter invocation above might be a solution.
The startParameter.currentDir is exactly what I was looking for. I can compare it to projectDir in subprojects{} and know if I am configuring the invoked project or not.