blob: da2f10e35d6ac6125174f4cde249cfe9e060409b [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 Boyarb1356332015-05-21 15:49:58 -07003def repoBase = databindingProperties.mavenRepoAbsolutePath == "." ? projectDir : databindingProperties.mavenRepoAbsolutePath
4databindingProperties.mavenRepoDir = "${repoBase}/${databindingProperties.mavenRepoName}"
5
Yigit Boyarc64ae352015-04-21 14:05:41 -07006databindingProperties.eapOutDir = "${projectDir}/${databindingProperties.eapOutFolderName}"
Yigit Boyaree758672015-04-16 15:12:02 -07007databindingProperties.prebuildFolder = "${projectDir}/${databindingProperties.prebuildFolderName}" +
8 "/${databindingProperties.releaseVersion}"
Yigit Boyare421e292015-03-13 12:57:48 -07009ext.config = databindingProperties
10
Yigit Boyare421e292015-03-13 12:57:48 -070011println "local maven repo is ${ext.config.mavenRepoDir}."
Yigit Boyaree758672015-04-16 15:12:02 -070012println "local pre-build folder is ${ext.config.prebuildFolder}."
Yigit Boyare421e292015-03-13 12:57:48 -070013
14new File(ext.config.mavenRepoDir).mkdir()
Yigit Boyaree758672015-04-16 15:12:02 -070015new File(ext.config.prebuildFolder).mkdir()
16
Yigit Boyar840f0ce2014-12-12 16:45:00 -080017subprojects {
Yigit Boyarf9e51c02015-03-12 14:30:29 -070018 apply plugin: 'maven'
Yigit Boyara6e45832015-03-13 15:58:53 -070019 group = config.group
Yigit Boyar9399cb42015-05-16 15:42:45 -070020 version = config.version
Yigit Boyar840f0ce2014-12-12 16:45:00 -080021 repositories {
Yigit Boyar840f0ce2014-12-12 16:45:00 -080022 mavenCentral()
Yigit Boyarf9e51c02015-03-12 14:30:29 -070023 maven {
Yigit Boyare421e292015-03-13 12:57:48 -070024 url "file://${config.mavenRepoDir}"
Yigit Boyarf9e51c02015-03-12 14:30:29 -070025 }
Yigit Boyar840f0ce2014-12-12 16:45:00 -080026 }
Yigit Boyarf9e51c02015-03-12 14:30:29 -070027 uploadArchives {
28 repositories {
29 mavenDeployer {
Yigit Boyare421e292015-03-13 12:57:48 -070030 repository(url: "file://${config.mavenRepoDir}")
Yigit Boyarf9e51c02015-03-12 14:30:29 -070031 }
32 }
33 }
34}
35
Yigit Boyarb1356332015-05-21 15:49:58 -070036
Yigit Boyarf9e51c02015-03-12 14:30:29 -070037task deleteRepo(type: Delete) {
Yigit Boyarb1356332015-05-21 15:49:58 -070038 delete "${config.mavenRepoDir}/${config.group.replace('.', '/')}"
Yigit Boyarf9e51c02015-03-12 14:30:29 -070039}
40
Yigit Boyaree758672015-04-16 15:12:02 -070041task deletePrebuildFolder(type: Delete) {
42 delete "${config.prebuildFolder}"
43}
44
Yigit Boyarc64ae352015-04-21 14:05:41 -070045task deleteEap(type: Delete) {
46 delete "${config.eapOutDir}"
47}
48
49
Yigit Boyara6e45832015-03-13 15:58:53 -070050def buildExtensionsTask = project.tasks.create "buildExtensionsTask", Exec
51buildExtensionsTask.workingDir file('extensions').getAbsolutePath()
Yigit Boyara6e45832015-03-13 15:58:53 -070052buildExtensionsTask.commandLine './gradlew'
53buildExtensionsTask.args 'clean', 'uploadArchives', '--info', '--stacktrace'
54buildExtensionsTask.dependsOn subprojects.uploadArchives
55
Yigit Boyaree758672015-04-16 15:12:02 -070056def prepareExtensionPrebuilds = project.tasks.create "prepareExtensionPrebuilds", Exec
57prepareExtensionPrebuilds.workingDir file('extensions').getAbsolutePath()
58prepareExtensionPrebuilds.commandLine './gradlew'
59prepareExtensionPrebuilds.args 'clean', 'preparePrebuilds', '--info', '--stacktrace'
60prepareExtensionPrebuilds.dependsOn subprojects.uploadArchives
61
Yigit Boyarf9e51c02015-03-12 14:30:29 -070062file('integration-tests').listFiles().findAll { it.isDirectory() }.each {
Yigit Boyara6e45832015-03-13 15:58:53 -070063 println("Creating run test task for ${it.getAbsolutePath()}.")
Yigit Boyarf9e51c02015-03-12 14:30:29 -070064 def testTask = project.tasks.create "runTestsOf${it.getName().capitalize()}", Exec
Yigit Boyara6e45832015-03-13 15:58:53 -070065 testTask.workingDir it.getAbsolutePath()
Yigit Boyarf9e51c02015-03-12 14:30:29 -070066 //on linux
67 testTask.commandLine './gradlew'
Yigit Boyara6e45832015-03-13 15:58:53 -070068 testTask.args 'clean', 'connectedCheck', '--info', '--stacktrace'
Yigit Boyarf9e51c02015-03-12 14:30:29 -070069 testTask.dependsOn subprojects.uploadArchives
Yigit Boyara6e45832015-03-13 15:58:53 -070070 testTask.dependsOn buildExtensionsTask
Yigit Boyarf9e51c02015-03-12 14:30:29 -070071}
72
73task runIntegrationTests {
74 dependsOn tasks.findAll { task -> task.name.startsWith('runTestsOf') }
75}
76
77task runAllTests {
78 dependsOn runIntegrationTests
79}
80
Yigit Boyaree758672015-04-16 15:12:02 -070081task preparePrebuilds() {
82 dependsOn deletePrebuildFolder
83 dependsOn prepareExtensionPrebuilds
84}
85
Yigit Boyarf9e51c02015-03-12 14:30:29 -070086allprojects {
87 afterEvaluate { project ->
88 runAllTests.dependsOn project.tasks.findAll {task -> task.name.equals('test')}
Yigit Boyara6e45832015-03-13 15:58:53 -070089 runAllTests.dependsOn project.tasks.findAll {task -> task.name.equals('connectedCheck')}
Yigit Boyaree758672015-04-16 15:12:02 -070090 preparePrebuilds.dependsOn project.tasks.findAll {task -> task.name.startsWith('prebuild')}
Yigit Boyarf9e51c02015-03-12 14:30:29 -070091 }
92}
93
Yigit Boyara6e45832015-03-13 15:58:53 -070094subprojects.uploadArchives.each { it.shouldRunAfter deleteRepo }
Yigit Boyarae161282015-04-21 11:02:58 -070095subprojects.uploadArchives.each { it.shouldRunAfter deletePrebuildFolder }
Yigit Boyara6e45832015-03-13 15:58:53 -070096buildExtensionsTask.shouldRunAfter deleteRepo
Yigit Boyar99a3d312015-03-25 12:46:05 -070097tasks['runTestsOfMultiModuleTestApp'].dependsOn tasks['runTestsOfIndependentLibrary']
Yigit Boyara6e45832015-03-13 15:58:53 -070098
Yigit Boyarf9e51c02015-03-12 14:30:29 -070099
100task rebuildRepo() {
101 dependsOn deleteRepo
102 dependsOn subprojects.uploadArchives
Yigit Boyara6e45832015-03-13 15:58:53 -0700103 dependsOn buildExtensionsTask
Yigit Boyaree758672015-04-16 15:12:02 -0700104}
105
Yigit Boyarc64ae352015-04-21 14:05:41 -0700106task copySamplesToEap(type : Copy) {
107 mustRunAfter deleteEap
108 from ("$projectDir/samples") {
109 exclude "**/build"
Yigit Boyar2939c3b2015-04-23 15:03:56 -0700110 exclude "**/local.properties"
Yigit Boyarc64ae352015-04-21 14:05:41 -0700111 }
112 into "${config.eapOutDir}/samples"
113}
114
115
116task copyMavenRepoToEap(type : Copy) {
117 mustRunAfter deleteEap
118 dependsOn rebuildRepo
119 from(config.mavenRepoDir)
120 into "${config.eapOutDir}/${config.mavenRepoName}"
121}
122
123tasks.create(name : 'createEapConfigFile') << {
124 def propsFile = new File("${config.eapOutDir}/databinding.properties")
125 Properties props = new Properties()
Yigit Boyar9399cb42015-05-16 15:42:45 -0700126 props.setProperty('version', config.version)
Yigit Boyarc64ae352015-04-21 14:05:41 -0700127 props.setProperty('mavenRepoName', config.mavenRepoName)
128 props.store(propsFile.newWriter(), null)
129}
130
131
132task batchEAP() {
133 dependsOn deleteEap
134 dependsOn copyMavenRepoToEap
135 dependsOn copySamplesToEap
136 dependsOn createEapConfigFile
Yigit Boyarc64ae352015-04-21 14:05:41 -0700137}