1/** 2 * Helper build script that reads data binding variables and sets up the projects. 3 */ 4def root = ext.rootFolder 5Properties databindingProperties = new Properties() 6databindingProperties.load(new FileInputStream("${root}/databinding.properties")) 7def repoBase = databindingProperties.mavenRepoAbsolutePath == "." ? root : databindingProperties.mavenRepoAbsolutePath 8databindingProperties.mavenRepoDir = "${repoBase}/${databindingProperties.mavenRepoName}" 9databindingProperties.extraPluginsRepoDir = "${root}/${databindingProperties.extraPluginsRepoName}" 10 11databindingProperties.eapOutDir = "${root}/${databindingProperties.eapOutFolderName}" 12databindingProperties.prebuildFolder = "${root}/${databindingProperties.prebuildFolderName}" + 13 "/${databindingProperties.releaseVersion}" 14 15ext.config = databindingProperties 16ext.config.externalPrebuiltsBase = "${root}/../../prebuilts" 17databindingProperties.megaRepoDir = "${databindingProperties.externalPrebuiltsBase}/tools/common/m2/repository" 18 19println "local maven repo is ${ext.config.mavenRepoDir}." 20println "local pre-build folder is ${ext.config.prebuildFolder}." 21println "mega-repo folder is ${ext.config.megaRepoDir}." 22 23new File(ext.config.mavenRepoDir).mkdir() 24new File(ext.config.prebuildFolder).mkdir() 25 26def addRemoteRepos = !project.hasProperty('addRemoteRepos') || project.getProperty('addRemoteRepos').equals("true") 27ext.config.addRemoteRepos = addRemoteRepos 28def config = ext.config 29def localRepositories = ["${config.extraPluginsRepoDir}", 30 "${config.megaRepoDir}", 31 "${config.mavenRepoDir}", 32 "${config.externalPrebuiltsBase}/maven_repo/android", 33 "${config.externalPrebuiltsBase}/gradle-plugin", 34 "${config.externalPrebuiltsBase}/tools/common/m2/repository"] 35ext.config.localRepositories = localRepositories 36def addRepos(RepositoryHandler handler) { 37 config.localRepositories.each { repo -> 38 handler.maven { 39 url repo 40 } 41 } 42 handler.jcenter() 43 handler.mavenCentral() 44} 45ext.addRepos = this.&addRepos 46subprojects { 47 buildscript { 48 config.localRepositories.each { repo -> 49 repositories.maven { 50 url repo 51 } 52 } 53 repositories { 54 if (config.addRemoteRepos) { 55 jcenter() 56 mavenCentral() 57 } 58 } 59 } 60 repositories { 61 config.localRepositories.each { repo -> 62 repositories.maven { 63 url repo 64 } 65 } 66 if (config.addRemoteRepos) { 67 jcenter() 68 mavenCentral() 69 } 70 } 71} 72