My source repository has a flat layout for “top-level” projects within a particular branch ‘location(topProjectName) = $repoRoot/$topProjectName/$branchName/src’ that does not allow the root project to be discovered automatically. The root project has to be another top-level project such as ‘$repoRoot/master/$branchName/src’, and I want to avoid any branch-specific settings in the source tree.
I have tried putting a settings.gradle in each top-level project as follows:
settings.gradle - “rootProject.projectDir = settingsDir.parentFile”
build.gradle - “apply plugin: MyPlugin”
It turns out that buildSrc is not built abd my plugin is not available in MyTop. Although this is a hacky way of finding the shared buildSrc, I think it should work.
Otherwise, how can I get gradle to find the root project in ‘master/$branchName/src’ when running gradle in ‘$topProjectName/$branchName/src’ without having to hardcode the branch name or script outside gradle?