blob: eeffe0b90aad4a574b0fbbab3f021064aa208856 [file] [log] [blame]
Yigit Boyare421e292015-03-13 12:57:48 -07001Properties databindingProperties = new Properties()
George Mount4c5cc002015-03-12 09:18:12 -07002databindingProperties.load(new FileInputStream("${projectDir}/databinding.properties"))
Yigit Boyare421e292015-03-13 12:57:48 -07003databindingProperties.mavenRepoDir = "${projectDir}/${databindingProperties.mavenRepoName}"
Yigit Boyarc64ae352015-04-21 14:05:41 -07004databindingProperties.eapOutDir = "${projectDir}/${databindingProperties.eapOutFolderName}"
Yigit Boyaree758672015-04-16 15:12:02 -07005databindingProperties.prebuildFolder = "${projectDir}/${databindingProperties.prebuildFolderName}" +
6 "/${databindingProperties.releaseVersion}"
7
Yigit Boyare421e292015-03-13 12:57:48 -07008ext.config = databindingProperties
9
Yigit Boyare421e292015-03-13 12:57:48 -070010println "local maven repo is ${ext.config.mavenRepoDir}."
Yigit Boyaree758672015-04-16 15:12:02 -070011println "local pre-build folder is ${ext.config.prebuildFolder}."
Yigit Boyare421e292015-03-13 12:57:48 -070012
13new File(ext.config.mavenRepoDir).mkdir()
Yigit Boyaree758672015-04-16 15:12:02 -070014new File(ext.config.prebuildFolder).mkdir()
15
Yigit Boyar840f0ce2014-12-12 16:45:00 -080016subprojects {
Yigit Boyarf9e51c02015-03-12 14:30:29 -070017 apply plugin: 'maven'
Yigit Boyara6e45832015-03-13 15:58:53 -070018 group = config.group
Yigit Boyar9399cb42015-05-16 15:42:45 -070019 version = config.version
Yigit Boyar840f0ce2014-12-12 16:45:00 -080020 repositories {
Yigit Boyar840f0ce2014-12-12 16:45:00 -080021 mavenCentral()
Yigit Boyarf9e51c02015-03-12 14:30:29 -070022 maven {
Yigit Boyare421e292015-03-13 12:57:48 -070023 url "file://${config.mavenRepoDir}"
Yigit Boyarf9e51c02015-03-12 14:30:29 -070024 }
Yigit Boyar840f0ce2014-12-12 16:45:00 -080025 }
Yigit Boyarf9e51c02015-03-12 14:30:29 -070026 uploadArchives {
27 repositories {
28 mavenDeployer {
Yigit Boyare421e292015-03-13 12:57:48 -070029 repository(url: "file://${config.mavenRepoDir}")
Yigit Boyarf9e51c02015-03-12 14:30:29 -070030 }
31 }
32 }
33}
34
35task deleteRepo(type: Delete) {
Yigit Boyare421e292015-03-13 12:57:48 -070036 delete "${config.mavenRepoDir}"
Yigit Boyarf9e51c02015-03-12 14:30:29 -070037}
38
Yigit Boyaree758672015-04-16 15:12:02 -070039task deletePrebuildFolder(type: Delete) {
40 delete "${config.prebuildFolder}"
41}
42
Yigit Boyarc64ae352015-04-21 14:05:41 -070043task deleteEap(type: Delete) {
44 delete "${config.eapOutDir}"
45}
46
47
Yigit Boyara6e45832015-03-13 15:58:53 -070048def buildExtensionsTask = project.tasks.create "buildExtensionsTask", Exec
49buildExtensionsTask.workingDir file('extensions').getAbsolutePath()
Yigit Boyara6e45832015-03-13 15:58:53 -070050buildExtensionsTask.commandLine './gradlew'
51buildExtensionsTask.args 'clean', 'uploadArchives', '--info', '--stacktrace'
52buildExtensionsTask.dependsOn subprojects.uploadArchives
53
Yigit Boyaree758672015-04-16 15:12:02 -070054def prepareExtensionPrebuilds = project.tasks.create "prepareExtensionPrebuilds", Exec
55prepareExtensionPrebuilds.workingDir file('extensions').getAbsolutePath()
56prepareExtensionPrebuilds.commandLine './gradlew'
57prepareExtensionPrebuilds.args 'clean', 'preparePrebuilds', '--info', '--stacktrace'
58prepareExtensionPrebuilds.dependsOn subprojects.uploadArchives
59
Yigit Boyarf9e51c02015-03-12 14:30:29 -070060file('integration-tests').listFiles().findAll { it.isDirectory() }.each {
Yigit Boyara6e45832015-03-13 15:58:53 -070061 println("Creating run test task for ${it.getAbsolutePath()}.")
Yigit Boyarf9e51c02015-03-12 14:30:29 -070062 def testTask = project.tasks.create "runTestsOf${it.getName().capitalize()}", Exec
Yigit Boyara6e45832015-03-13 15:58:53 -070063 testTask.workingDir it.getAbsolutePath()
Yigit Boyarf9e51c02015-03-12 14:30:29 -070064 //on linux
65 testTask.commandLine './gradlew'
Yigit Boyara6e45832015-03-13 15:58:53 -070066 testTask.args 'clean', 'connectedCheck', '--info', '--stacktrace'
Yigit Boyarf9e51c02015-03-12 14:30:29 -070067 testTask.dependsOn subprojects.uploadArchives
Yigit Boyara6e45832015-03-13 15:58:53 -070068 testTask.dependsOn buildExtensionsTask
Yigit Boyarf9e51c02015-03-12 14:30:29 -070069}
70
71task runIntegrationTests {
72 dependsOn tasks.findAll { task -> task.name.startsWith('runTestsOf') }
73}
74
75task runAllTests {
76 dependsOn runIntegrationTests
77}
78
Yigit Boyaree758672015-04-16 15:12:02 -070079task preparePrebuilds() {
80 dependsOn deletePrebuildFolder
81 dependsOn prepareExtensionPrebuilds
82}
83
Yigit Boyarf9e51c02015-03-12 14:30:29 -070084allprojects {
85 afterEvaluate { project ->
86 runAllTests.dependsOn project.tasks.findAll {task -> task.name.equals('test')}
Yigit Boyara6e45832015-03-13 15:58:53 -070087 runAllTests.dependsOn project.tasks.findAll {task -> task.name.equals('connectedCheck')}
Yigit Boyaree758672015-04-16 15:12:02 -070088 preparePrebuilds.dependsOn project.tasks.findAll {task -> task.name.startsWith('prebuild')}
Yigit Boyarf9e51c02015-03-12 14:30:29 -070089 }
90}
91
Yigit Boyara6e45832015-03-13 15:58:53 -070092subprojects.uploadArchives.each { it.shouldRunAfter deleteRepo }
Yigit Boyarae161282015-04-21 11:02:58 -070093subprojects.uploadArchives.each { it.shouldRunAfter deletePrebuildFolder }
Yigit Boyara6e45832015-03-13 15:58:53 -070094buildExtensionsTask.shouldRunAfter deleteRepo
Yigit Boyar99a3d312015-03-25 12:46:05 -070095tasks['runTestsOfMultiModuleTestApp'].dependsOn tasks['runTestsOfIndependentLibrary']
Yigit Boyara6e45832015-03-13 15:58:53 -070096
Yigit Boyarf9e51c02015-03-12 14:30:29 -070097
98task rebuildRepo() {
99 dependsOn deleteRepo
100 dependsOn subprojects.uploadArchives
Yigit Boyara6e45832015-03-13 15:58:53 -0700101 dependsOn buildExtensionsTask
Yigit Boyaree758672015-04-16 15:12:02 -0700102}
103
Yigit Boyarc64ae352015-04-21 14:05:41 -0700104task copySamplesToEap(type : Copy) {
105 mustRunAfter deleteEap
106 from ("$projectDir/samples") {
107 exclude "**/build"
Yigit Boyar2939c3b2015-04-23 15:03:56 -0700108 exclude "**/local.properties"
Yigit Boyarc64ae352015-04-21 14:05:41 -0700109 }
110 into "${config.eapOutDir}/samples"
111}
112
113
114task copyMavenRepoToEap(type : Copy) {
115 mustRunAfter deleteEap
116 dependsOn rebuildRepo
117 from(config.mavenRepoDir)
118 into "${config.eapOutDir}/${config.mavenRepoName}"
119}
120
121tasks.create(name : 'createEapConfigFile') << {
122 def propsFile = new File("${config.eapOutDir}/databinding.properties")
123 Properties props = new Properties()
Yigit Boyar9399cb42015-05-16 15:42:45 -0700124 props.setProperty('version', config.version)
Yigit Boyarc64ae352015-04-21 14:05:41 -0700125 props.setProperty('mavenRepoName', config.mavenRepoName)
126 props.store(propsFile.newWriter(), null)
127}
128
129
130task batchEAP() {
131 dependsOn deleteEap
132 dependsOn copyMavenRepoToEap
133 dependsOn copySamplesToEap
134 dependsOn createEapConfigFile
135
136}