blob: acf68f41908c59a36add17de99c95ebbe669125a [file] [log] [blame]
Yigit Boyarb1356332015-05-21 15:49:58 -07001
Yigit Boyar24bec1c2015-07-09 10:51:54 -07002buildscript {
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}
Yigit Boyar840f0ce2014-12-12 16:45:00 -080012subprojects {
Yigit Boyarf9e51c02015-03-12 14:30:29 -070013 apply plugin: 'maven'
Yigit Boyar24bec1c2015-07-09 10:51:54 -070014 if (config.addRemoteRepos) {
15 apply plugin: 'com.android.databinding.localizemaven'
Yigit Boyar63d47892015-07-10 09:03:05 -070016 }
17
Yigit Boyar24bec1c2015-07-09 10:51:54 -070018 group = config.group
19 version = config.version
Yigit Boyarf9e51c02015-03-12 14:30:29 -070020 uploadArchives {
21 repositories {
22 mavenDeployer {
Yigit Boyare421e292015-03-13 12:57:48 -070023 repository(url: "file://${config.mavenRepoDir}")
Yigit Boyarf9e51c02015-03-12 14:30:29 -070024 }
25 }
26 }
Yigit Boyar24bec1c2015-07-09 10:51:54 -070027 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 }
Yigit Boyarf9e51c02015-03-12 14:30:29 -070040}
41
42task deleteRepo(type: Delete) {
Yigit Boyarb1356332015-05-21 15:49:58 -070043 delete "${config.mavenRepoDir}/${config.group.replace('.', '/')}"
Yigit Boyarf9e51c02015-03-12 14:30:29 -070044}
45
Yigit Boyaree758672015-04-16 15:12:02 -070046task deletePrebuildFolder(type: Delete) {
47 delete "${config.prebuildFolder}"
48}
49
Yigit Boyarc64ae352015-04-21 14:05:41 -070050task deleteEap(type: Delete) {
51 delete "${config.eapOutDir}"
52}
53
54
Yigit Boyara6e45832015-03-13 15:58:53 -070055def buildExtensionsTask = project.tasks.create "buildExtensionsTask", Exec
56buildExtensionsTask.workingDir file('extensions').getAbsolutePath()
Yigit Boyara6e45832015-03-13 15:58:53 -070057buildExtensionsTask.commandLine './gradlew'
58buildExtensionsTask.args 'clean', 'uploadArchives', '--info', '--stacktrace'
59buildExtensionsTask.dependsOn subprojects.uploadArchives
60
Yigit Boyaree758672015-04-16 15:12:02 -070061def 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
Yigit Boyarf9e51c02015-03-12 14:30:29 -070067file('integration-tests').listFiles().findAll { it.isDirectory() }.each {
Yigit Boyara6e45832015-03-13 15:58:53 -070068 println("Creating run test task for ${it.getAbsolutePath()}.")
Yigit Boyarf9e51c02015-03-12 14:30:29 -070069 def testTask = project.tasks.create "runTestsOf${it.getName().capitalize()}", Exec
Yigit Boyara6e45832015-03-13 15:58:53 -070070 testTask.workingDir it.getAbsolutePath()
Yigit Boyarf9e51c02015-03-12 14:30:29 -070071 //on linux
72 testTask.commandLine './gradlew'
Yigit Boyara6e45832015-03-13 15:58:53 -070073 testTask.args 'clean', 'connectedCheck', '--info', '--stacktrace'
Yigit Boyarf9e51c02015-03-12 14:30:29 -070074 testTask.dependsOn subprojects.uploadArchives
Yigit Boyara6e45832015-03-13 15:58:53 -070075 testTask.dependsOn buildExtensionsTask
Yigit Boyarf9e51c02015-03-12 14:30:29 -070076}
77
78task runIntegrationTests {
79 dependsOn tasks.findAll { task -> task.name.startsWith('runTestsOf') }
80}
81
82task runAllTests {
83 dependsOn runIntegrationTests
84}
85
Yigit Boyaree758672015-04-16 15:12:02 -070086task preparePrebuilds() {
87 dependsOn deletePrebuildFolder
88 dependsOn prepareExtensionPrebuilds
89}
90
Yigit Boyarf9e51c02015-03-12 14:30:29 -070091allprojects {
92 afterEvaluate { project ->
93 runAllTests.dependsOn project.tasks.findAll {task -> task.name.equals('test')}
Yigit Boyara6e45832015-03-13 15:58:53 -070094 runAllTests.dependsOn project.tasks.findAll {task -> task.name.equals('connectedCheck')}
Yigit Boyaree758672015-04-16 15:12:02 -070095 preparePrebuilds.dependsOn project.tasks.findAll {task -> task.name.startsWith('prebuild')}
Yigit Boyarf9e51c02015-03-12 14:30:29 -070096 }
97}
98
Yigit Boyara6e45832015-03-13 15:58:53 -070099subprojects.uploadArchives.each { it.shouldRunAfter deleteRepo }
Yigit Boyarae161282015-04-21 11:02:58 -0700100subprojects.uploadArchives.each { it.shouldRunAfter deletePrebuildFolder }
Yigit Boyara6e45832015-03-13 15:58:53 -0700101buildExtensionsTask.shouldRunAfter deleteRepo
Yigit Boyar99a3d312015-03-25 12:46:05 -0700102tasks['runTestsOfMultiModuleTestApp'].dependsOn tasks['runTestsOfIndependentLibrary']
Yigit Boyara6e45832015-03-13 15:58:53 -0700103
Yigit Boyarf9e51c02015-03-12 14:30:29 -0700104
105task rebuildRepo() {
106 dependsOn deleteRepo
107 dependsOn subprojects.uploadArchives
Yigit Boyara6e45832015-03-13 15:58:53 -0700108 dependsOn buildExtensionsTask
Yigit Boyaree758672015-04-16 15:12:02 -0700109}
110
Yigit Boyarc64ae352015-04-21 14:05:41 -0700111task copySamplesToEap(type : Copy) {
112 mustRunAfter deleteEap
113 from ("$projectDir/samples") {
114 exclude "**/build"
Yigit Boyar2939c3b2015-04-23 15:03:56 -0700115 exclude "**/local.properties"
Yigit Boyarc64ae352015-04-21 14:05:41 -0700116 }
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()
Yigit Boyar9399cb42015-05-16 15:42:45 -0700131 props.setProperty('version', config.version)
Yigit Boyarc64ae352015-04-21 14:05:41 -0700132 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
Yigit Boyar24bec1c2015-07-09 10:51:54 -0700142}