Home | History | Annotate | Download | only in data-binding
      1 /**
      2  * Helper build script that reads data binding variables and sets up the projects.
      3  */
      4 def root = ext.rootFolder
      5 Properties databindingProperties = new Properties()
      6 databindingProperties.load(new FileInputStream("${root}/databinding.properties"))
      7 def repoBase = databindingProperties.mavenRepoAbsolutePath == "." ? root : databindingProperties.mavenRepoAbsolutePath
      8 databindingProperties.mavenRepoDir = "${repoBase}/${databindingProperties.mavenRepoName}"
      9 databindingProperties.extraPluginsRepoDir = "${root}/${databindingProperties.extraPluginsRepoName}"
     10 
     11 databindingProperties.eapOutDir = "${root}/${databindingProperties.eapOutFolderName}"
     12 databindingProperties.prebuildFolder = "${root}/${databindingProperties.prebuildFolderName}" +
     13         "/${databindingProperties.releaseVersion}"
     14 
     15 ext.config = databindingProperties
     16 ext.config.externalPrebuiltsBase = "${root}/../../prebuilts"
     17 databindingProperties.megaRepoDir = "${databindingProperties.externalPrebuiltsBase}/tools/common/m2/repository"
     18 
     19 println "local maven repo is ${ext.config.mavenRepoDir}."
     20 println "local pre-build folder is ${ext.config.prebuildFolder}."
     21 println "mega-repo folder is ${ext.config.megaRepoDir}."
     22 
     23 new File(ext.config.mavenRepoDir).mkdir()
     24 new File(ext.config.prebuildFolder).mkdir()
     25 
     26 def addRemoteRepos = !project.hasProperty('addRemoteRepos') || project.getProperty('addRemoteRepos').equals("true")
     27 ext.config.addRemoteRepos = addRemoteRepos
     28 def config = ext.config
     29 def 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"]
     35 ext.config.localRepositories = localRepositories
     36 def addRepos(RepositoryHandler handler) {
     37     config.localRepositories.each { repo ->
     38         handler.maven {
     39             url repo
     40         }
     41     }
     42     handler.jcenter()
     43     handler.mavenCentral()
     44 }
     45 ext.addRepos = this.&addRepos
     46 subprojects {
     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