1 2buildscript { 3 ext.rootFolder = project.projectDir 4 apply from: 'propLoader.gradle' 5 ext.addRepos(repositories) 6 if (ext.config.addRemoteRepos) { 7 dependencies { 8 classpath "com.android.databinding:localizemaven:${config.extraPluginsVersion}" 9 } 10 } 11} 12subprojects { 13 apply plugin: 'maven' 14 if (config.addRemoteRepos) { 15 apply plugin: 'com.android.databinding.localizemaven' 16 } 17 18 group = config.group 19 version = config.version 20 uploadArchives { 21 repositories { 22 mavenDeployer { 23 repository(url: "file://${config.mavenRepoDir}") 24 } 25 } 26 } 27 buildscript { 28 addRepos(repositories) 29 dependencies { 30 classpath "com.android.databinding:bintray:${config.extraPluginsVersion}" 31 } 32 } 33} 34 35if (config.addRemoteRepos) { 36 localizeMaven { 37 localRepoDir = file(config.megaRepoDir) 38 otherRepoDirs = config.localRepositories 39 } 40} 41 42task deleteRepo(type: Delete) { 43 delete "${config.mavenRepoDir}/${config.group.replace('.', '/')}" 44} 45 46task deletePrebuildFolder(type: Delete) { 47 delete "${config.prebuildFolder}" 48} 49 50task deleteEap(type: Delete) { 51 delete "${config.eapOutDir}" 52} 53 54 55def buildExtensionsTask = project.tasks.create "buildExtensionsTask", Exec 56buildExtensionsTask.workingDir file('extensions').getAbsolutePath() 57buildExtensionsTask.commandLine './gradlew' 58buildExtensionsTask.args 'clean', 'uploadArchives', '--info', '--stacktrace' 59buildExtensionsTask.dependsOn subprojects.uploadArchives 60 61def prepareExtensionPrebuilds = project.tasks.create "prepareExtensionPrebuilds", Exec 62prepareExtensionPrebuilds.workingDir file('extensions').getAbsolutePath() 63prepareExtensionPrebuilds.commandLine './gradlew' 64prepareExtensionPrebuilds.args 'clean', 'preparePrebuilds', '--info', '--stacktrace' 65prepareExtensionPrebuilds.dependsOn subprojects.uploadArchives 66 67file('integration-tests').listFiles().findAll { it.isDirectory() }.each { 68 println("Creating run test task for ${it.getAbsolutePath()}.") 69 def testTask = project.tasks.create "runTestsOf${it.getName().capitalize()}", Exec 70 testTask.workingDir it.getAbsolutePath() 71 //on linux 72 testTask.commandLine './gradlew' 73 testTask.args 'clean', 'connectedCheck', '--info', '--stacktrace' 74 testTask.dependsOn subprojects.uploadArchives 75 testTask.dependsOn buildExtensionsTask 76} 77 78task runIntegrationTests { 79 dependsOn tasks.findAll { task -> task.name.startsWith('runTestsOf') } 80} 81 82task runAllTests { 83 dependsOn runIntegrationTests 84} 85 86task preparePrebuilds() { 87 dependsOn deletePrebuildFolder 88 dependsOn prepareExtensionPrebuilds 89} 90 91allprojects { 92 afterEvaluate { project -> 93 runAllTests.dependsOn project.tasks.findAll {task -> task.name.equals('test')} 94 runAllTests.dependsOn project.tasks.findAll {task -> task.name.equals('connectedCheck')} 95 preparePrebuilds.dependsOn project.tasks.findAll {task -> task.name.startsWith('prebuild')} 96 } 97} 98 99subprojects.uploadArchives.each { it.shouldRunAfter deleteRepo } 100subprojects.uploadArchives.each { it.shouldRunAfter deletePrebuildFolder } 101buildExtensionsTask.shouldRunAfter deleteRepo 102tasks['runTestsOfMultiModuleTestApp'].dependsOn tasks['runTestsOfIndependentLibrary'] 103 104 105task rebuildRepo() { 106 dependsOn deleteRepo 107 dependsOn subprojects.uploadArchives 108 dependsOn buildExtensionsTask 109} 110 111task copySamplesToEap(type : Copy) { 112 mustRunAfter deleteEap 113 from ("$projectDir/samples") { 114 exclude "**/build" 115 exclude "**/local.properties" 116 } 117 into "${config.eapOutDir}/samples" 118} 119 120 121task copyMavenRepoToEap(type : Copy) { 122 mustRunAfter deleteEap 123 dependsOn rebuildRepo 124 from(config.mavenRepoDir) 125 into "${config.eapOutDir}/${config.mavenRepoName}" 126} 127 128tasks.create(name : 'createEapConfigFile') << { 129 def propsFile = new File("${config.eapOutDir}/databinding.properties") 130 Properties props = new Properties() 131 props.setProperty('version', config.version) 132 props.setProperty('mavenRepoName', config.mavenRepoName) 133 props.store(propsFile.newWriter(), null) 134} 135 136 137task batchEAP() { 138 dependsOn deleteEap 139 dependsOn copyMavenRepoToEap 140 dependsOn copySamplesToEap 141 dependsOn createEapConfigFile 142} 143