forked from prowide/prowide-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
174 lines (149 loc) · 4.33 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
apply plugin: 'java-library-distribution'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'maven'
apply plugin: 'jacoco'
archivesBaseName = 'pw-swift-core'
def SRU = "2019"
version "SRU${SRU}-8.0.2"
group 'com.prowidesoftware'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
tasks.withType(JavaCompile) {
options.fork = true
if (project.hasProperty('JDK8_HOME')) {
options.forkOptions.executable = "$JDK8_HOME/bin/javac"
} else {
println "*** Compiling with newer version of Java, this is just fine for development; for releases a proper JDK8_HOME variable must be set in gradle.properties ***"
}
options.encoding = 'UTF-8'
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation 'org.apache.commons:commons-lang3:3.8.1'
implementation 'org.apache.commons:commons-text:1.6'
implementation 'com.google.code.gson:gson:2.8.2'
compileOnly 'javax.persistence:javax.persistence-api:2.2'
compileOnly group: 'javax.validation', name: 'validation-api', version: '1.0.0.GA'
testImplementation 'junit:junit:4.12'
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.13.2'
testImplementation group: 'org.xmlunit', name: 'xmlunit-core', version: '2.6.3'
testImplementation group: 'org.xmlunit', name: 'xmlunit-matchers', version: '2.6.3'
testImplementation group: 'org.xmlunit', name: 'xmlunit-assertj', version: '2.6.3'
testImplementation group: 'org.powermock', name: 'powermock-api-mockito2', version: '2.0.0'
testImplementation group: 'org.powermock', name: 'powermock-module-junit4', version: '2.0.0'
}
sourceSets.main.java.srcDirs = ['src/main/java', 'src/generated/java']
def formattedDate() {
new Date().format('dd MMM yyyy')
}
javadoc {
failOnError false
options.overview = "src/main/java/overview.html"
options.header = "${version}"
options.windowTitle = "Prowide Core API Reference"
options.footer="SRU${SRU}, generated ${formattedDate()}"
// this will fail when the option is not available (older JDK)
options.addBooleanOption("-allow-script-in-comments", true)
options.bottom = '<script src="//static.getclicky.com/js"></script><script>try{ clicky.init(101039278); }catch(e){}</script>'
exclude "**/internal/**"
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
tasks.withType(Jar) {
manifest.attributes(
'Specification-Title': 'Prowide Core',
'Specification-Version': project.version,
'Specification-Vendor': "SRU${SRU}",
'Implementation-Title': 'Prowide Core',
'Implementation-Version': project.version,
'Implementation-Vendor': 'www.prowidesoftware.com',
'Built-OS': System.getProperty('os.name'),
'Source-Compatibility': project.sourceCompatibility,
'Target-Compatibility': project.targetCompatibility,
'Built-Date': new Date().format("yyyy-MM-dd")
)
}
task writePom {
doLast {
pom {
project {
groupId "com.prowidesoftware"
artifactId "${rootProject.name}"
version "${version}"
inceptionYear '2006'
licenses {
license {
name 'Apache License Version 2.0'
url 'https://www.apache.org/licenses/LICENSE-2.0'
distribution 'repo'
}
}
developers {
developer {
id 'zubri'
name 'Sebastian Zubrinic'
email 'sebastian@prowidesoftware.com'
}
}
organization {
name 'Prowide'
url 'http://www.prowidesoftware.com'
}
}
}.writeTo("$buildDir/pom.xml")
}
}
distributions {
main {
contents {
from javadocJar
from sourcesJar
into ('lib') {
from (project.configurations.runtime)
}
from files('LICENSE.txt', 'CHANGELOG.txt')
from files("$buildDir/pom.xml")
}
}
}
distTar.enabled = false
distZip {
dependsOn writePom
}
jacocoTestReport {
reports {
xml.enabled true
csv.enabled false
html.enabled false
}
// exclude generated code
afterEvaluate {
getClassDirectories().setFrom(classDirectories.files.collect {
fileTree(dir: it, exclude: [
'**/SchemeConstants**',
'**/mt0xx/**',
'**/mt1xx/**',
'**/mt2xx/**',
'**/mt3xx/**',
'**/mt4xx/**',
'**/mt5xx/**',
'**/mt6xx/**',
'**/mt7xx/**',
'**/mt8xx/**',
'**/mt9xx/**',
'**/dic/**'
])
})
}
}
test.finalizedBy jacocoTestReport