This repository has been archived by the owner on May 25, 2023. It is now read-only.
forked from getodk/aggregate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gae.gradle
95 lines (80 loc) · 3.78 KB
/
gae.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import org.opendatakit.aggregate.gradle.gae.Rollback
import org.opendatakit.aggregate.gradle.gae.Update
import static org.opendatakit.aggregate.gradle.Util.setPropertiesValue
import static org.opendatakit.aggregate.gradle.Util.setXmlValue
import static org.opendatakit.aggregate.gradle.Util.truncate
task gaeDownloadSDK() {
doLast {
if (!file('installer/appEngineSDK.zip').exists()) {
println("Downloading App Engine SDK 1.9.63")
download {
src 'https://storage.googleapis.com/appengine-sdks/featured/appengine-java-sdk-1.9.63.zip'
dest 'installer/appEngineSDK.zip'
}
} else
println("App Engine SDK is already present")
}
}
task gaeClean() {
delete "${buildDir}/gae"
}
task gaeCopyFiles(dependsOn: explodedWar, type: Copy) {
into "${buildDir}/gae/ear"
from fileTree(dir: 'src/main/gae_ear')
into("background") {
from fileTree(dir: "${buildDir}/exploded")
exclude "WEB-INF/classes/odk-settings.xml"
exclude "WEB-INF/classes/security.properties"
}
into("default") {
from fileTree(dir: "${buildDir}/exploded")
exclude "WEB-INF/classes/odk-settings.xml"
exclude "WEB-INF/classes/security.properties"
}
doLast {
delete "default/WEB-INF/lib/guava-jdk5-17.0.jar"
delete "background/WEB-INF/lib/guava-jdk5-17.0.jar"
}
}
task gaeCopySDK(dependsOn: gaeDownloadSDK, type: Copy) {
into "${buildDir}/gae"
from zipTree("${projectDir}/installer/appEngineSDK.zip")
}
task gaeCopyDummyApp(type: Copy) {
into "${buildDir}/gae/dummyApp"
from fileTree(dir: 'installer/dummyApp')
}
task gaePrepare(dependsOn: [gaeCopyFiles, gaeCopySDK, gaeCopyDummyApp]) {
doLast {
setXmlValue("${buildDir}/gae/dummyApp/WEB-INF/appengine-web.xml", "application", gaeAppId)
setXmlValue("${buildDir}/gae/ear/default/WEB-INF/appengine-web.xml", "application", gaeAppId)
setXmlValue("${buildDir}/gae/ear/background/WEB-INF/appengine-web.xml", "application", gaeAppId)
setXmlValue("${buildDir}/gae/ear/META-INF/appengine-application.xml", "application", gaeAppId)
setXmlValue("${buildDir}/gae/ear/META-INF/application.xml", "display-name", aggregateInstanceName)
setPropertiesValue("${buildDir}/gae/ear/default/WEB-INF/classes/security.properties", "security.server.hostname", "${gaeAppId}.appspot.com")
setPropertiesValue("${buildDir}/gae/ear/default/WEB-INF/classes/security.properties", "security.server.realm.realmString", "${aggregateInstanceName} ODK Aggregate")
setPropertiesValue("${buildDir}/gae/ear/default/WEB-INF/classes/security.properties", "security.server.superUserUsername", "${aggregateUsername}")
setPropertiesValue("${buildDir}/gae/ear/background/WEB-INF/classes/security.properties", "security.server.hostname", "${gaeAppId}.appspot.com")
setPropertiesValue("${buildDir}/gae/ear/background/WEB-INF/classes/security.properties", "security.server.realm.realmString", "${aggregateInstanceName} ODK Aggregate")
setPropertiesValue("${buildDir}/gae/ear/background/WEB-INF/classes/security.properties", "security.server.superUserUsername", "${aggregateUsername}")
truncate("${buildDir}/gae/ear/default/WEB-INF/classes/jdbc.properties")
truncate("${buildDir}/gae/ear/background/WEB-INF/classes/jdbc.properties")
}
}
Task gaeRollbackModule(String moduleName) {
task("gaeRollback_${moduleName}", dependsOn: gaePrepare, type: Rollback) {
email = "${-> gaeEmail}"
workingDir = "${buildDir}/gae"
module = moduleName
}
}
task gaeRollback(dependsOn: [gaePrepare, gaeRollbackModule("default"), gaeRollbackModule("background")]) {
}
task gaeUpdate(dependsOn: gaePrepare, type: Update) {
email = "${-> gaeEmail}"
workingDir = "${buildDir}/gae"
doLast {
println "Finished updating your Aggregate instance in AppEngine"
println "Now you should be able to access it at https://${gaeAppId}.appspot.com"
}
}