-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle
234 lines (198 loc) · 6.66 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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
apply plugin: 'application'
apply plugin: 'org.springframework.boot'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.sonarqube'
apply plugin: 'nebula.rpm'
apply plugin: 'nebula.deb'
apply plugin: "com.github.hierynomus.license"
//apply plugin: 'nebula.lint'
// rpm/deb package variables
def _vendor = 'Dell'
def _license = 'Apache License 2.0'
def _group = ''
def _url = 'http://support.dell.com'
def _arch = 'x86_64'
def _os = 'LINUX'
def _release = 1
def _sourcePaths=[]
sourceCompatibility = 1.8
version = "${version}"
dockerTag = "${dockerTag}"
group = 'com.dell.isg.smi'
buildscript {
ext {
springVersion = '4.3.6.RELEASE'
springBootVersion = '1.5.1.RELEASE'
springCloudVersion = 'Camden.SR5'
}
repositories {
mavenLocal()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "io.spring.gradle:dependency-management-plugin:1.0.2.RELEASE"
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath(group: 'com.netflix.nebula', name: 'gradle-ospackage-plugin', version: '4.4.0' )
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.1"
classpath "gradle.plugin.nl.javadude.gradle.plugins:license-gradle-plugin:0.13.1"
//classpath 'com.netflix.nebula:gradle-lint-plugin:latest.release'
}
}
//gradleLint {
// rules = ['dependency-parentheses','overridden-dependency-version','duplicate-dependency-class', 'all-dependency','unused-dependency']
//}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
springBoot {
executable = true
}
sonarqube {
properties {
property "sonar.projectName", "SMI :: Service :: Power-thermal monitoring"
property "sonar.projectKey", "org.sonarqube:service-powerthermal-monitoring"
}
}
jar {
manifest {
attributes 'Implementation-Title': 'Dell server powerthermal monitoring jar',
'Implementation-Version': version
}
baseName = 'service-powerthermal-monitoring'
}
repositories {
mavenLocal()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
url "https://oss.sonatype.org/content/repositories/releases"
url "https://repo.maven.apache.org/maven2"
}
}
dependencies {
compile 'com.dell.isg.smi:adapter-server:'+adapterServerVersion
compile 'com.dell.isg.smi:commons-elm:'+commonsElmVersion
compile 'com.dell.isg.smi:commons-utilities:'+commonsUtilitiesVersion
compile 'com.dell.isg.smi:commons-model:'+commonsModelVersion
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile 'org.springframework.cloud:spring-cloud-starter-consul-all'
compile "org.springframework:spring-web"
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.5'
compile group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.3'
compile group: "io.springfox", name: "springfox-swagger2", version: "2.6.1"
compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.6.1'
compile group: 'org.samba.jcifs', name: 'jcifs', version: '1.3.14-kohsuke-1'
testCompile('org.springframework.boot:spring-boot-starter-test')
}
license {
header rootProject.file('license-template')
includes(["**/*.java", "**/*.properties"])
strictCheck true
ignoreFailures true
ext.year = Calendar.getInstance().get(Calendar.YEAR)
ext.name = 'DELL Inc.'
}
task generateRpm(type: Rpm){
destinationDir = project.file('build/distributions')
destinationDir.mkdirs()
vendor = _vendor
license = _license
group = _group
summary = 'Dell powerthermal-monitoring service'
description = 'Installs and runs the powerthermal-monitoring microservice as a linux service'
url = _url
packageName = 'dell-smi-service-powerthermal-monitoring'
release = _release
arch = _arch
os = _os
from fileTree( "build/libs" ), {
include "*.jar"
fileMode = 0755
user = "root"
addParentDirs = false
into '/opt/dell/smi/service-powerthermal-monitoring'
}
from fileTree("./"), {
include "application.yml"
fileMode = 0755
//user = "root"
//addParentDirs = true
into '/opt/dell/smi/service-powerthermal-monitoring'
}
from fileTree( "pkg" ), {
include "dell-powerthermal-monitoring.service"
fileMode = 0777
into '/etc/systemd/system'
}
link('/etc/systemd/system/multi-user.target.wants/dell-powerthermal-monitoring.service', '/etc/systemd/system/dell-powerthermal-monitoring.service')
}
task generateDeb(type: Deb){
destinationDir = project.file('build/distributions')
destinationDir.mkdirs()
vendor = _vendor
license = _license
group = _group
summary = 'Dell powerthermal-monitoring service'
description = 'Installs and runs the powerthermal-monitoring microservice as a linux service'
url = _url
requires( 'postgresql', '9.4', GREATER | EQUAL)
packageName = 'dell-smi-service-powerthermal-monitoring'
release = _release
arch = 'all'
os = _os
from fileTree( "build/libs" ), {
include "*.jar"
fileMode = 0755
user = "root"
addParentDirs = true
into '/opt/dell/smi/service-powerthermal-monitoring'
}
from fileTree("./"), {
include "application.yml"
fileMode = 0755
//user = "root"
//addParentDirs = true
into '/opt/dell/smi/service-powerthermal-monitoring'
}
from fileTree( "pkg" ), {
include "dell-powerthermal-monitoring.service"
fileMode = 0777
into '/etc/systemd/system'
}
link('/etc/systemd/system/multi-user.target.wants/dell-powerthermal-monitoring.service', '/etc/systemd/system/dell-powerthermal-monitoring.service')
}
task buildSourcePathsArray(dependsOn: 'eclipseClasspath' ){
doLast{
def classpathFile = file('.classpath')
if( classpathFile.exists() ) {
def cpXml = new XmlParser().parse(classpathFile)
cpXml.classpathentry.each {
if('lib' == it.@kind ) {
if( it.@sourcepath == null ){
println 'missing source jar for:' + it.@path
}
else{
_sourcePaths.add(it.@sourcepath)
}
}
}
}
def arrayLength = _sourcePaths.size()
println 'sourcePaths length is:' + arrayLength
}
}
task dependencySourcesZip(type: Zip, dependsOn: 'buildSourcePathsArray' ) {
destinationDir = project.file('build/distributions')
destinationDir.mkdirs()
baseName = "smi-service-dell-server-powerthermal-monitoring-dependency-sources"
version = "${dockerTag}"
outputs.upToDateWhen { false }
from _sourcePaths
}