Hello,
I work on Gradle integration in Android Studio and I am looking to find and understand the resolution logic for user defined properties in ext blocks and gradle.properties files. I have a project with the below listed hierarchy.
| <GRADLE_USER_HOME>/gradle.properties
| RootProject| - - build.gradle
| - - gradle.properties
| - - FirstLevelChildProject
| - - - - build.gradle
| - - - - gradle.properties
| - - - - SecondLevelChildProject
| - - - - - - build.gradle
| - - - - - - gralde.properties
| - - - - - - ThirdLevelChildProject
| - - - - - - - - build.gradle
| - - - - - - - - gradle.properties
When I tried to use a user defined property in ThirdLevelChildProject's build.gradle file, the value is resolved to the properties defined in the following order (i.e if it's not defined in the first file, it will be looked for the next one and so on)
- ThirdLevelChildProject/build.gradle
- <GRADLE_USER_HOME>/gradle.properties
- ThirdLevelChildProject/gradle.properties
- RootProject/gradle.properties
- SecondLevelChildProject/build.gradle
- SecondLevelChildProject/gradle.properties
- FirstLevelChildProject/build.gradle
- FirstLevelChildProject/gradle.properties
- RootProject/build.gradle
The order looks fine for the most of the files except for two entries. I am not sure why the <GRADLE_USER_HOME>/gradle.properties and RootProject/gradle.properties has higher precedence over many other places inside the project.
Is this resolution order is working as intended? If so could some please explain the reason behind the higher precedence given to the two locations I motioned above.
Thanks,
Thirumal.
-- Thirumala Reddy Mutchukota | Software Engineer, Google Inc. | Mountain View, CA.