forked from renaudcerrato/appengine-maven-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sanity-checks.gradle
27 lines (21 loc) · 888 Bytes
/
sanity-checks.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
import groovy.xml.DOMBuilder
import groovy.xml.dom.DOMCategory
final DEFAULT_APP_ID = 'your-app-id'
def getApplicationID() {
def reader = new FileReader(file('src/main/webapp/WEB-INF/appengine-web.xml'))
def root = DOMBuilder.parse(reader).documentElement;
use(DOMCategory) {
return root.application.text()
}
}
task checkDefaultApplicationID << {
def appId = getApplicationID();
if(appId == DEFAULT_APP_ID)
throw new InvalidUserDataException(
"Invalid project ID: '$appId'\nYou must edit appengine-web.xml "+
"and copy your Google Cloud project ID inside the <application> element.\n"+
"This is the project ID you register when you create your "+
"project in the Google Cloud Platform Console."
)
}
tasks.getByPath('appengineUpdate').dependsOn checkDefaultApplicationID