Yigit Boyar | b135633 | 2015-05-21 15:49:58 -0700 | [diff] [blame] | 1 | |
Yigit Boyar | 24bec1c | 2015-07-09 10:51:54 -0700 | [diff] [blame] | 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 | } |
Yigit Boyar | 840f0ce | 2014-12-12 16:45:00 -0800 | [diff] [blame] | 12 | subprojects { |
Yigit Boyar | f9e51c0 | 2015-03-12 14:30:29 -0700 | [diff] [blame] | 13 | apply plugin: 'maven' |
Yigit Boyar | 24bec1c | 2015-07-09 10:51:54 -0700 | [diff] [blame] | 14 | if (config.addRemoteRepos) { |
| 15 | apply plugin: 'com.android.databinding.localizemaven' |
Yigit Boyar | 63d4789 | 2015-07-10 09:03:05 -0700 | [diff] [blame] | 16 | } |
| 17 | |
Yigit Boyar | 24bec1c | 2015-07-09 10:51:54 -0700 | [diff] [blame] | 18 | group = config.group |
| 19 | version = config.version |
Yigit Boyar | f9e51c0 | 2015-03-12 14:30:29 -0700 | [diff] [blame] | 20 | uploadArchives { |
| 21 | repositories { |
| 22 | mavenDeployer { |
Yigit Boyar | e421e29 | 2015-03-13 12:57:48 -0700 | [diff] [blame] | 23 | repository(url: "file://${config.mavenRepoDir}") |
Yigit Boyar | f9e51c0 | 2015-03-12 14:30:29 -0700 | [diff] [blame] | 24 | } |
| 25 | } |
| 26 | } |
Yigit Boyar | 24bec1c | 2015-07-09 10:51:54 -0700 | [diff] [blame] | 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 | } |
Yigit Boyar | f9e51c0 | 2015-03-12 14:30:29 -0700 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | task deleteRepo(type: Delete) { |
Yigit Boyar | b135633 | 2015-05-21 15:49:58 -0700 | [diff] [blame] | 43 | delete "${config.mavenRepoDir}/${config.group.replace('.', '/')}" |
Yigit Boyar | f9e51c0 | 2015-03-12 14:30:29 -0700 | [diff] [blame] | 44 | } |
| 45 | |
Yigit Boyar | ee75867 | 2015-04-16 15:12:02 -0700 | [diff] [blame] | 46 | task deletePrebuildFolder(type: Delete) { |
| 47 | delete "${config.prebuildFolder}" |
| 48 | } |
| 49 | |
Yigit Boyar | c64ae35 | 2015-04-21 14:05:41 -0700 | [diff] [blame] | 50 | task deleteEap(type: Delete) { |
| 51 | delete "${config.eapOutDir}" |
| 52 | } |
| 53 | |
| 54 | |
Yigit Boyar | a6e4583 | 2015-03-13 15:58:53 -0700 | [diff] [blame] | 55 | def buildExtensionsTask = project.tasks.create "buildExtensionsTask", Exec |
| 56 | buildExtensionsTask.workingDir file('extensions').getAbsolutePath() |
Yigit Boyar | a6e4583 | 2015-03-13 15:58:53 -0700 | [diff] [blame] | 57 | buildExtensionsTask.commandLine './gradlew' |
| 58 | buildExtensionsTask.args 'clean', 'uploadArchives', '--info', '--stacktrace' |
| 59 | buildExtensionsTask.dependsOn subprojects.uploadArchives |
| 60 | |
Yigit Boyar | ee75867 | 2015-04-16 15:12:02 -0700 | [diff] [blame] | 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 | |
Yigit Boyar | f9e51c0 | 2015-03-12 14:30:29 -0700 | [diff] [blame] | 67 | file('integration-tests').listFiles().findAll { it.isDirectory() }.each { |
Yigit Boyar | a6e4583 | 2015-03-13 15:58:53 -0700 | [diff] [blame] | 68 | println("Creating run test task for ${it.getAbsolutePath()}.") |
Yigit Boyar | f9e51c0 | 2015-03-12 14:30:29 -0700 | [diff] [blame] | 69 | def testTask = project.tasks.create "runTestsOf${it.getName().capitalize()}", Exec |
Yigit Boyar | a6e4583 | 2015-03-13 15:58:53 -0700 | [diff] [blame] | 70 | testTask.workingDir it.getAbsolutePath() |
Yigit Boyar | f9e51c0 | 2015-03-12 14:30:29 -0700 | [diff] [blame] | 71 | //on linux |
| 72 | testTask.commandLine './gradlew' |
Yigit Boyar | a6e4583 | 2015-03-13 15:58:53 -0700 | [diff] [blame] | 73 | testTask.args 'clean', 'connectedCheck', '--info', '--stacktrace' |
Yigit Boyar | f9e51c0 | 2015-03-12 14:30:29 -0700 | [diff] [blame] | 74 | testTask.dependsOn subprojects.uploadArchives |
Yigit Boyar | a6e4583 | 2015-03-13 15:58:53 -0700 | [diff] [blame] | 75 | testTask.dependsOn buildExtensionsTask |
Yigit Boyar | f9e51c0 | 2015-03-12 14:30:29 -0700 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | task runIntegrationTests { |
| 79 | dependsOn tasks.findAll { task -> task.name.startsWith('runTestsOf') } |
| 80 | } |
| 81 | |
| 82 | task runAllTests { |
| 83 | dependsOn runIntegrationTests |
| 84 | } |
| 85 | |
Yigit Boyar | ee75867 | 2015-04-16 15:12:02 -0700 | [diff] [blame] | 86 | task preparePrebuilds() { |
| 87 | dependsOn deletePrebuildFolder |
| 88 | dependsOn prepareExtensionPrebuilds |
| 89 | } |
| 90 | |
Yigit Boyar | f9e51c0 | 2015-03-12 14:30:29 -0700 | [diff] [blame] | 91 | allprojects { |
| 92 | afterEvaluate { project -> |
| 93 | runAllTests.dependsOn project.tasks.findAll {task -> task.name.equals('test')} |
Yigit Boyar | a6e4583 | 2015-03-13 15:58:53 -0700 | [diff] [blame] | 94 | runAllTests.dependsOn project.tasks.findAll {task -> task.name.equals('connectedCheck')} |
Yigit Boyar | ee75867 | 2015-04-16 15:12:02 -0700 | [diff] [blame] | 95 | preparePrebuilds.dependsOn project.tasks.findAll {task -> task.name.startsWith('prebuild')} |
Yigit Boyar | f9e51c0 | 2015-03-12 14:30:29 -0700 | [diff] [blame] | 96 | } |
| 97 | } |
| 98 | |
Yigit Boyar | a6e4583 | 2015-03-13 15:58:53 -0700 | [diff] [blame] | 99 | subprojects.uploadArchives.each { it.shouldRunAfter deleteRepo } |
Yigit Boyar | ae16128 | 2015-04-21 11:02:58 -0700 | [diff] [blame] | 100 | subprojects.uploadArchives.each { it.shouldRunAfter deletePrebuildFolder } |
Yigit Boyar | a6e4583 | 2015-03-13 15:58:53 -0700 | [diff] [blame] | 101 | buildExtensionsTask.shouldRunAfter deleteRepo |
Yigit Boyar | 99a3d31 | 2015-03-25 12:46:05 -0700 | [diff] [blame] | 102 | tasks['runTestsOfMultiModuleTestApp'].dependsOn tasks['runTestsOfIndependentLibrary'] |
Yigit Boyar | a6e4583 | 2015-03-13 15:58:53 -0700 | [diff] [blame] | 103 | |
Yigit Boyar | f9e51c0 | 2015-03-12 14:30:29 -0700 | [diff] [blame] | 104 | |
| 105 | task rebuildRepo() { |
| 106 | dependsOn deleteRepo |
| 107 | dependsOn subprojects.uploadArchives |
Yigit Boyar | a6e4583 | 2015-03-13 15:58:53 -0700 | [diff] [blame] | 108 | dependsOn buildExtensionsTask |
Yigit Boyar | ee75867 | 2015-04-16 15:12:02 -0700 | [diff] [blame] | 109 | } |
| 110 | |
Yigit Boyar | c64ae35 | 2015-04-21 14:05:41 -0700 | [diff] [blame] | 111 | task copySamplesToEap(type : Copy) { |
| 112 | mustRunAfter deleteEap |
| 113 | from ("$projectDir/samples") { |
| 114 | exclude "**/build" |
Yigit Boyar | 2939c3b | 2015-04-23 15:03:56 -0700 | [diff] [blame] | 115 | exclude "**/local.properties" |
Yigit Boyar | c64ae35 | 2015-04-21 14:05:41 -0700 | [diff] [blame] | 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() |
Yigit Boyar | 9399cb4 | 2015-05-16 15:42:45 -0700 | [diff] [blame] | 131 | props.setProperty('version', config.version) |
Yigit Boyar | c64ae35 | 2015-04-21 14:05:41 -0700 | [diff] [blame] | 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 |
Yigit Boyar | 24bec1c | 2015-07-09 10:51:54 -0700 | [diff] [blame] | 142 | } |