1 2 buildscript { 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 } 12 subprojects { 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 35 if (config.addRemoteRepos) { 36 localizeMaven { 37 localRepoDir = file(config.megaRepoDir) 38 otherRepoDirs = config.localRepositories 39 } 40 } 41 42 task deleteRepo(type: Delete) { 43 delete "${config.mavenRepoDir}/${config.group.replace('.', '/')}" 44 } 45 46 task deletePrebuildFolder(type: Delete) { 47 delete "${config.prebuildFolder}" 48 } 49 50 task deleteEap(type: Delete) { 51 delete "${config.eapOutDir}" 52 } 53 54 55 def buildExtensionsTask = project.tasks.create "buildExtensionsTask", Exec 56 buildExtensionsTask.workingDir file('extensions').getAbsolutePath() 57 buildExtensionsTask.commandLine './gradlew' 58 buildExtensionsTask.args 'clean', 'uploadArchives', '--info', '--stacktrace' 59 buildExtensionsTask.dependsOn subprojects.uploadArchives 60 61 def prepareExtensionPrebuilds = project.tasks.create "prepareExtensionPrebuilds", Exec 62 prepareExtensionPrebuilds.workingDir file('extensions').getAbsolutePath() 63 prepareExtensionPrebuilds.commandLine './gradlew' 64 prepareExtensionPrebuilds.args 'clean', 'preparePrebuilds', '--info', '--stacktrace' 65 prepareExtensionPrebuilds.dependsOn subprojects.uploadArchives 66 67 file('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 78 task runIntegrationTests { 79 dependsOn tasks.findAll { task -> task.name.startsWith('runTestsOf') } 80 } 81 82 task runAllTests { 83 dependsOn runIntegrationTests 84 } 85 86 task preparePrebuilds() { 87 dependsOn deletePrebuildFolder 88 dependsOn prepareExtensionPrebuilds 89 } 90 91 allprojects { 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 99 subprojects.uploadArchives.each { it.shouldRunAfter deleteRepo } 100 subprojects.uploadArchives.each { it.shouldRunAfter deletePrebuildFolder } 101 buildExtensionsTask.shouldRunAfter deleteRepo 102 tasks['runTestsOfMultiModuleTestApp'].dependsOn tasks['runTestsOfIndependentLibrary'] 103 104 105 task rebuildRepo() { 106 dependsOn deleteRepo 107 dependsOn subprojects.uploadArchives 108 dependsOn buildExtensionsTask 109 } 110 111 task 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 121 task copyMavenRepoToEap(type : Copy) { 122 mustRunAfter deleteEap 123 dependsOn rebuildRepo 124 from(config.mavenRepoDir) 125 into "${config.eapOutDir}/${config.mavenRepoName}" 126 } 127 128 tasks.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 137 task batchEAP() { 138 dependsOn deleteEap 139 dependsOn copyMavenRepoToEap 140 dependsOn copySamplesToEap 141 dependsOn createEapConfigFile 142 } 143