How do I use multiple gradle.properties files?

I have a build.gradle file and two gradle.properties files I’d like to use with it. So far everything I’ve tried (that doesn’t involve making two copies of the build.gradle and maintaining both) hasn’t worked out.

What I’ve tried:

  • put the configuration in a subprojects block, which tried to access properties without pulling them from each version
  • use apply from: common.gradle which seemed to struggle due to various reasons
  • most options on stackoverflow

File structure:

build.gradle  <- contains build configuration for both
settings.gradle  <- contains 'include ":versions:api_1.x"' and 
                             'include ":versions:api_2.x"'
versions/
- api_1.x/
  - gradle.properties
- api_2.x/
  - gradle.properties