Reputation: 9953
I have two separate projects which I want to keep separate. However, sometimes I want to be able to combine them, briefly, into a composite build. Sometimes it's nice if I can do that for a while without affecting other devs. So, I want something like this:
My main settings.gradle, which would be checked into version control, would look like this:
// normal stuff
if (File('extra-settings.gradle).exists()) {
// This is what I don't know how to do
includeOtherSettingsFile('extra-settings.gradle')
}
Then extra-settings.gradle, which is not checked into source control, might look like this:
includeBuild('../anxml') {
dependencySubstitution {
substitute module('com.analyticspot.ml:framework') with project(':framework')
}
}
This way I could add an extra-settings.gradle file to make a temporary composite build. Keep it that way for several commits without affecting other programmers or worrying that I'd accidentally commit my temporary changes to settings.gradle and then, when I'm done, I could just delete it.
I know about Prezi Pride and it seems great but won't work for our current build (we use buildSrc, rootDir, etc.)
Can it be done?
Upvotes: 0
Views: 1406
Reputation: 27984
settings.gradle is executed against a Settings instance which has an apply(Map) method so I'm guessing you can do:
// use Settings.getRootDir() so that it doesn't matter which directory you are executing from
File extraSettings = new File(rootDir, 'extra-settings.gradle')
if (extraSettings.exists()) {
apply from: extraSettings
}
Upvotes: 1