-
Notifications
You must be signed in to change notification settings - Fork 15
/
common.gradle
86 lines (74 loc) · 2.79 KB
/
common.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
// define all path and variables used in gradle
project.ext{
PROJECT_TAG = project.name + '-' + version
root = '.'
build = root + '/build'
libXtremWeb = root + '/libXtremWeb'
src = root + '/src'
res = src + '/main/resources'
conf = res + '/conf'
benchmark = res + '/benchmark'
templates = res + '/templates'
doc = res + '/doc'
docker = res + '/docker'
installers = res + '/installers'
misc = res + '/misc'
scripts = res + '/scripts'
linuxInstallers = installers + '/linux'
macInstallers = installers + '/macosx'
opt = '/opt'
dist = build + '/dist/' + PROJECT_TAG
distBin = dist + '/bin'
distLib = dist + '/lib'
distDoc = dist + '/doc'
distMacInstallers = dist + "/installers/macosx"
privateEtc = '/private/etc'
}
def envuid=UUID.randomUUID().toString()
def adminuid=UUID.randomUUID().toString()
def workeruid=UUID.randomUUID().toString()
def vworkeruid=UUID.randomUUID().toString()
def admingroupuid=UUID.randomUUID().toString()
def publicworkersgroup=UUID.randomUUID().toString()
def gitShortCommit = 'git rev-parse --short HEAD'.execute().text.trim()
def isSnapshotVersion = project.version.contains("SNAPSHOT")
project.ext.getDockerImageVersion = {
if(isSnapshotVersion){
return project.version + "-" + gitShortCommit
} else {
return project.version
}
}
// Define custom properties that can be used everywhere
project.ext.getCustomProperties = {
def props = new Properties()
// add all properties from conf file
file(conf + "/xwconfigure.values").withInputStream { props.load(it) }
for (String key : props.stringPropertyNames()) {
props.setProperty(key, props.getProperty(key).replace('\'', ''))
}
// add other custom properties
props.setProperty("ENVUID", envuid)
props.setProperty("ADMINUID", adminuid)
props.setProperty("WORKERUID", workeruid)
props.setProperty("VWORKERUID", vworkeruid)
props.setProperty("ADMINGROUPUID", admingroupuid)
props.setProperty("PUBLICWORKERSGROUPUID", publicworkersgroup)
props.setProperty("XWVERSION", version)
props.setProperty("DOCKER_IMAGE_VERSION", getDockerImageVersion())
props.setProperty("INSTALLDIR", opt)
def path = 'pwd'.execute().text.trim()
def keystore = path + "/build/dist/" + PROJECT_TAG + "/keystore/"
def docker = path + "/build/dist/" + PROJECT_TAG + "/docker/"
props.setProperty("CERTIFICATE", docker + "xwscheduler.pem")
props.setProperty("SSLTRUSTSTORE", keystore + "cacerts")
def certname = "cn=" + props.CERTCN + ",o=" + props.CERTO + ",c=" + props.CERTC
if (props.CERTOU != "") {
certname += ",ou=" + props.CERTOU
}
if (props.CERTL != "") {
certname += ",l=" + props.CERTL
}
props.setProperty("CERTNAME", certname)
return props
}