-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
177 lines (148 loc) · 4.44 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
import java.text.SimpleDateFormat
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'io.spring.gradle:dependency-management-plugin:1.0.8.RELEASE'
classpath "org.springframework.boot:spring-boot-gradle-plugin:2.2.0.RELEASE"
}
}
plugins {
id 'org.springframework.boot' version '2.2.0.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
id 'checkstyle'
id 'jacoco'
id 'pmd'
id 'maven'
id 'maven-publish'
id 'signing'
}
ext {
ossrhUsername = System.getenv("OSSRH_USERNAME")
ossrhPassword = System.getenv("OSSRH_PASSWORD")
}
ext.set("signing.secretKeyRingFile", ".signing/secring.gpg")
ext.set("signing.keyId", System.getenv("SIGNING_KEYID"))
ext.set("signing.password", System.getenv("SIGNING_PASSWORD"))
group = serviceGroup
version = serviceVersion
archivesBaseName = serviceName
project.ext.buildTime = java.time.Instant.now().toString() // for versioning
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
maven { url "https://jaspersoft.jfrog.io/artifactory/third-party-ce-artifacts"}
maven { url "http://jasperreports.sourceforge.net/maven2/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.slf4j:slf4j-ext"
annotationProcessor 'org.projectlombok:lombok:1.16.20'
compile "org.openlmis:openlmis-stockmanagement:5.1.4-SNAPSHOT:exec"
}
bootJar {
enabled = false
}
jar {
enabled = true
}
checkstyle {
toolVersion = "7.1"
}
pmd {
toolVersion = '5.4.0'
consoleOutput= true
ignoreFailures = false
ruleSetFiles = files("config/pmd/ruleset.xml")
reportsDir = file("build/reports/pmd")
}
tasks.withType(Pmd){
reports {
xml.enabled true
html.enabled true
}
}
jacocoTestReport {
group = "reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
xml.enabled false
html.enabled true
csv.enabled false
}
additionalSourceDirs = files(sourceSets.main.allJava.srcDirs)
}
def time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
time.setTimeZone(TimeZone.getTimeZone("GMT"))
def versionToCopy = copySpec {
from 'src/main/resources'
include 'version_template'
}
task generateBuildInfo(type:Copy) {
with versionToCopy
into 'build/resources/main'
rename { 'version.properties' }
expand([
build: "$System.env.BUILD_NUMBER", // ${build}
branch: "$System.env.GIT_BRANCH", // ${branch}
time: time.format(new Date()) + " GMT" // ${time}
])
doLast{
delete 'src/main/resources/version_template'
}
}
signing {
sign configurations.archives
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
signArchives.onlyIf {project.getProperty("signing.keyId") && project.getProperty("signing.password")}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
pom.project {
name projectName
packaging 'jar'
description projectDescription
licenses {
license {
name 'GNU Affero General Public License, Version 3'
url 'https://www.gnu.org/licenses/agpl-3.0.txt'
}
}
}
}
}
}
uploadArchives.onlyIf { project.getProperty("ossrhUsername") && project.getProperty("ossrhPassword") }
assemble {
finalizedBy uploadArchives
}
processResources {
// update version information in build
filesMatching('**/version.properties') {
expand(project.properties)
}
}
//+dopisać task gradlowy który przeniesie tego jara do mainProjectPath/extensions?
//etc/openlmis/extensions