-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
202 lines (165 loc) · 5.3 KB
/
build.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
apply plugin: 'java'
apply plugin: 'rpm'
sourceCompatibility = 1.8
jar.baseName = 'bdshr-terminology-server'
def tomcatVersion = "7.0.64";
def openmrsVersion = "2.1.0";
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.netflix.nebula:gradle-ospackage-plugin:2.2.+'
}
}
repositories {
mavenCentral()
jcenter()
maven {
url 'https://openmrs.jfrog.io/openmrs/public/'
}
maven {
url 'https://oss.sonatype.org/content/repositories'
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.12'
}
task extractWar(dependsOn: ['downloadMRSWar'], type: Copy) {
from zipTree(file("${buildDir}/resources/main/openmrs.war"))
into file("${buildDir}/openmrs")
}
def properties = new Properties()
properties.setProperty("SERVER_PORT", "9080")
properties.setProperty("BASE_DIR", "${buildDir}")
properties.setProperty("CONTEXT_PATH", "openmrs")
properties.setProperty("WAR_DIRECTORY", "${buildDir}/openmrs")
properties.setProperty("OPENMRS_RUNTIME_PROPERTIES_FILE", "${projectDir}/local/openmrs-runtime.properties")
task launch(dependsOn: ['build', 'extractWar'], type: JavaExec) {
main "org.freeshr.terminology.launch.Main"
classpath sourceSets.main.runtimeClasspath
environment properties
}
configurations {
mrsWar
}
jar {
manifest {
attributes 'Main-Class': "org.freeshr.terminology.launch.Main"
}
from {
configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
}
}
}
task execute(dependsOn: 'build', type: JavaExec) {
main = "org.freeshr.terminology.launch.Main"
classpath = sourceSets.main.runtimeClasspath
standardOutput = System.out
}
task normalizeJarName(type: Copy) {
from "${buildDir}" + "/libs/"
into "${buildDir}" + "/libs/"
include(jar.baseName + '-' + version + '.jar')
rename(jar.baseName + '-' + version + '.jar', 'bdshr-terminology-server.jar')
}
task dist(dependsOn: ['build','downloadMRSWar','normalizeJarName'], type: Rpm) {
packageName 'bdshr-terminology-server'
version '2.7'
release project.hasProperty('release') ? project.release : '1'
arch NOARCH
os LINUX
into '/opt/bdshr-terminology-server'
requires('unzip')
postInstall file("${projectDir}/scripts/postinstall.sh")
preUninstall file("${projectDir}/scripts/preuninstall.sh")
postUninstall file("${projectDir}/scripts/postuninstall.sh")
from("${buildDir}/libs/bdshr-terminology-server.jar") {
fileMode = 0755
createDirectoryEntry = true
into 'lib/'
}
from("${projectDir}/resources/") {
fileMode = 0755
createDirectoryEntry = true
into 'etc'
}
from("${projectDir}/scripts/rpm/") {
fileMode = 0755
createDirectoryEntry = true
into 'bin'
}
from("${projectDir}/resources/placeholder") {
fileMode = 0755
createDirectoryEntry = true
into 'run'
}
from("${projectDir}/resources/placeholder") {
fileMode = 0755
createDirectoryEntry = true
into 'log'
}
from("${buildDir}/resources/main/openmrs.war") {
fileMode = 0755
createDirectoryEntry = true
into '.'
}
from("${projectDir}/resources/placeholder") {
fileMode = 0755
createDirectoryEntry = true
into 'modules'
}
from("${projectDir}/resources/placeholder") {
fileMode = 0755
createDirectoryEntry = true
into 'openmrs'
}
}
configurations {
all*.exclude(group: 'com.sun.jdmk', module: 'jmxtools')
all*.exclude(group: 'com.sun.jmx', module: 'jmxri')
all*.exclude(group: 'javax.jms', module: 'jms')
all*.exclude(group: 'javax.mail', module: 'mail')
}
task downloadMRSWar << {
new File("${buildDir}/resources/main").mkdirs();
configurations.mrsWar.resolve().each { file ->
if (file.getName().contains("openmrs")) {
file.renameTo(new File("${buildDir}/resources/main/openmrs.war"))
}
}
}
task updateMRSLogger << {
copy {
def zipFile = file("${buildDir}/resources/main/openmrs_std.war")
def outputDir = file("${buildDir}/resources/main/openmrs")
from zipTree(zipFile)
into outputDir
}
copy {
from "${projectDir}/resources/log4j.xml"
into "${buildDir}/resources/main/openmrs/WEB-INF/classes/"
}
task ('rePackageOpenMRS', type: Zip) {
from "${buildDir}/resources/main/openmrs"
archiveName 'openmrs.war'
destinationDir file("${buildDir}/resources/main/")
}.execute()
delete {
delete "${buildDir}/resources/main/openmrs", "${buildDir}/resources/main/openmrs_std.war"
}
}
task copyMRSLogFile(type: Copy) {
from "${projectDir}/resources/log4j.xml"
into "${buildDir}/resources/main/openmrs/WEB-INF/classes/"
}
dependencies {
compile "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}",
"org.apache.tomcat:tomcat-jasper:${tomcatVersion}",
"org.apache.tomcat:tomcat-jasper-el:${tomcatVersion}",
"org.apache.tomcat:tomcat-jsp-api:${tomcatVersion}"
mrsWar "org.openmrs.web:openmrs-webapp:${openmrsVersion}@war"
}