How to get sibbling project configuration

Hi,

I am working with an multi-module project.

Here is my project tree :

app

  • build.gradle - mobile - - build.gradle - - src and other stuff - wear - - build.gradle - - src and other stuff

During the mobile build, I would like to retrieve properties of the wear project. Basically, I want to retrieve all the variants of the wear module when i build the mobile module.

Is there a way of retrieving a sibbling module configuration ?

Thanks you for the help.

Do you have a settings.gradle in your root app directory that includes mobile and wear? You can refer to other projects, but that can hurt/break decoupling.

See the chapter in the user guide http://www.gradle.org/docs/current/userguide/multi_project_builds.html

If your goal is to stay DRY (keep variant info in one place), could you inject it from the root build.gradle file? e.g.:

subprojects {
  // put your variant info here
}

mobile and wear would get configured from the same place, but you wouldn’t have to reach across to a ‘sibling’ project.