Skip to content

Instantly share code, notes, and snippets.

@nontravis
Created April 18, 2018 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nontravis/01e685f330c4d2f11ff5e6a4e75a6e87 to your computer and use it in GitHub Desktop.
Save nontravis/01e685f330c4d2f11ff5e6a4e75a6e87 to your computer and use it in GitHub Desktop.
settings.gradle
/** Add module here **/
includeFlat 'TabCommon'
List<Module> myModuleList = new ArrayList<>()
myModuleList.with {
add(new Module(name: ":AppProjectStructure", path: ":app"))
add(new Module(name: ":Common", path: "../TabCommon/Common"))
add(new Module(name: ":CommonApplication", path: "../TabCommon/CommonApplication"))
add(new Module(name: ":Library1", path: "../TabCommon/Library1"))
add(new Module(name: ":Library2", path: "../TabCommon/Library2"))
}
myModuleList.forEach {
addProject(it.getName(), it.getPath())
}
/** Method call **/
void addProject(String name, String path) {
include name
if (path != null) {
if( path == ":app"){
project(name).projectDir = new File('app')
}else{
project(name).projectDir = new File(settingsDir, path)
}
}
}
class Module {
String name
String path
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment