-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle
162 lines (131 loc) · 3.83 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
buildscript {
repositories {
maven { url "https://repo.spring.io/libs-release" }
mavenLocal()
mavenCentral()
}
dependencies {
classpath(
'org.springframework.boot:spring-boot-gradle-plugin:1.1.9.RELEASE'
, 'net.saliman:gradle-cobertura-plugin:2.2.4'
, 'com.netflix.nebula:gradle-ospackage-plugin:2.+'
)
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'cobertura'
apply plugin: 'rpm'
apply plugin: 'war'
idea{
project{
jdkName = '1.8'
languageLevel = '1.8'
}
}
jar {
baseName = 'identity-service'
version = '0.1.0'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://repo.spring.io/libs-release" }
jcenter()
}
task wrapper(type: Wrapper) {
gradleVersion = '2.12'
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
compile("org.springframework.boot:spring-boot-starter-actuator"){
exclude group: 'ch.qos.logback', module: "logback-classic"
}
compile("org.apache.commons:commons-lang3:3.3.2")
testCompile("junit:junit")
testCompile("com.github.tomakehurst:wiremock:1.52")
testCompile "org.mockito:mockito-core:1.8.4"
testCompile "org.springframework:spring-test:4.0.3.RELEASE"
testCompile 'com.jayway.restassured:rest-assured:2.4.0'
}
def getRunProcessBuilder() {
def builder = new ProcessBuilder('./gradlew', 'run')
builder.redirectOutput(ProcessBuilder.Redirect.INHERIT)
return builder
}
def getDebugProcessBuilder() {
def builder = new ProcessBuilder('./gradlew', 'run', '--debug', '--debug-jvm')
builder.redirectOutput(ProcessBuilder.Redirect.INHERIT)
return builder
}
task runIS << {
ProcessBuilder builder = getRunProcessBuilder()
Process process = builder.start();
process.waitFor();
}
task debugIS << {
ProcessBuilder builder = getDebugProcessBuilder()
Process process = builder.start();
process.waitFor();
}
cobertura {
coverageFormats = ['html', 'xml']
coverageIgnoreTrivial = true
coverageIgnores = ['org.slf4j.Logger.*']
coverageReportDir = new File("$buildDir/reports/cobertura")
}
test.finalizedBy(project.tasks.cobertura)
mainClassName = "org.freeshr.identity.launch.Application"
war {
from sourceSets.main.resources
manifest {
attributes('Main-Class': mainClassName)
}
}
private Properties loadConfig() {
Properties properties = new Properties()
properties.load(new FileInputStream(file("${projectDir}/env/local.properties")));
properties
}
task assembly(dependsOn: 'build') << {
new File("${buildDir}/etc/").mkdir();
}
task exportProperties(dependsOn: 'assembly') << {
PrintStream output = new PrintStream(new FileOutputStream(file("${buildDir}/etc/identity-server")));
Properties properties = loadConfig()
properties.each { prop, val ->
output.println("export " + prop + "=" + val)
}
}
task dist(dependsOn: 'exportProperties', type: Rpm) {
packageName = 'identity-server'
version = '0.1'
release = project.hasProperty('release') ? project.release : '1'
arch = NOARCH
os = LINUX
into '/opt/identity-server'
postInstall = file('scripts/utils/postInstall.sh')
preUninstall = file('scripts/utils/preUninstall.sh')
postUninstall = file('scripts/utils/postUninstall.sh')
from("${buildDir}/etc") {
fileMode = 0755
into 'etc'
}
from("scripts/rpm") {
fileMode = 0755
exclude 'placeholder'
into 'bin'
}
from("${buildDir}/libs") {
fileMode = 0755
into 'lib'
}
from("scripts/rpm") {
fileMode = 0755
exclude 'identity-server'
into 'var'
}
}