-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathbuild.gradle
More file actions
204 lines (180 loc) · 5.49 KB
/
build.gradle
File metadata and controls
204 lines (180 loc) · 5.49 KB
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
plugins {
id 'java-library'
id 'idea'
id 'eclipse'
id 'jacoco'
id 'maven-publish'
id 'signing'
id 'checkstyle'
id 'com.github.spotbugs' version '6.0.9'
}
group = 'io.github.navdeep-g'
version = findProperty('releaseVersion') ?: '0.1.0-SNAPSHOT'
base {
archivesName = 'tslib'
}
description = 'tslib - Time series analysis and forecasting utilities for Java'
repositories {
mavenCentral()
}
dependencies {
api 'org.apache.commons:commons-math3:3.6.1'
testImplementation platform('org.junit:junit-bom:5.10.2')
testImplementation 'org.junit.jupiter:junit-jupiter'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
withSourcesJar()
withJavadocJar()
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
tasks.withType(Test).configureEach {
useJUnitPlatform()
testLogging {
events 'passed', 'skipped', 'failed'
exceptionFormat 'full'
showCauses true
showExceptions true
showStackTraces true
}
}
jacoco {
toolVersion = '0.8.12'
}
tasks.named('jacocoTestReport') {
dependsOn tasks.test
reports {
xml.required = true
html.required = true
}
}
tasks.named('jacocoTestCoverageVerification') {
dependsOn tasks.jacocoTestReport
violationRules {
rule {
limit {
counter = 'LINE'
value = 'COVEREDRATIO'
minimum = 0.70
}
}
}
}
checkstyle {
toolVersion = '10.17.0'
configFile = file("${rootDir}/config/checkstyle/checkstyle.xml")
ignoreFailures = true
}
spotbugs {
ignoreFailures = true
}
tasks.withType(com.github.spotbugs.snom.SpotBugsTask).configureEach {
reports {
xml.required = false
html.required = true
}
}
jar {
manifest {
attributes(
'Implementation-Title': 'tslib',
'Implementation-Version': project.version,
'Automatic-Module-Name': 'tslib'
)
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifactId = base.archivesName.get()
pom {
name = 'tslib'
description = project.description
url = 'https://github.com/navdeep-G/tslib'
licenses {
license {
name = 'MIT License'
url = 'https://opensource.org/licenses/MIT'
}
}
developers {
developer {
id = 'navdeep-g'
name = 'Navdeep G'
}
}
scm {
connection = 'scm:git:git://github.com/navdeep-G/tslib.git'
developerConnection = 'scm:git:ssh://[email protected]/navdeep-G/tslib.git'
url = 'https://github.com/navdeep-G/tslib'
}
}
}
}
repositories {
maven {
name = 'buildRepo'
url = layout.buildDirectory.dir('repo')
}
if (System.getenv('OSSRH_USERNAME') && System.getenv('OSSRH_PASSWORD')) {
maven {
name = 'OSSRH'
url = version.toString().endsWith('SNAPSHOT')
? uri('https://s01.oss.sonatype.org/content/repositories/snapshots/')
: uri('https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/')
credentials {
username = System.getenv('OSSRH_USERNAME')
password = System.getenv('OSSRH_PASSWORD')
}
}
}
if (System.getenv('GITHUB_ACTOR') && System.getenv('GITHUB_TOKEN')) {
maven {
name = 'GitHubPackages'
url = uri('https://maven.pkg.github.com/navdeep-G/tslib')
credentials {
username = System.getenv('GITHUB_ACTOR')
password = System.getenv('GITHUB_TOKEN')
}
}
}
}
}
signing {
def signingKey = findProperty('signingKey') ?: System.getenv('SIGNING_KEY')
def signingPassword = findProperty('signingPassword') ?: System.getenv('SIGNING_PASSWORD')
required { !version.toString().endsWith('SNAPSHOT') && gradle.taskGraph.allTasks*.name.any { it.startsWith('publish') } }
if (signingKey && signingPassword) {
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}
}
tasks.register('printReleaseCoords') {
group = 'release'
description = 'Prints the Maven coordinates for this build.'
doLast {
println "${project.group}:${base.archivesName.get()}:${project.version}"
}
}
tasks.register('compileExamples', JavaCompile) {
group = 'examples'
description = 'Compile all usage examples in the examples/ directory.'
source = fileTree('examples') { include '**/*.java' }
classpath = sourceSets.main.runtimeClasspath
destinationDirectory = layout.buildDirectory.dir('examples')
options.encoding = 'UTF-8'
dependsOn classes
}
tasks.register('runExamples', JavaExec) {
group = 'examples'
description = 'Compile and run all tslib usage examples.'
dependsOn 'compileExamples'
classpath = files(layout.buildDirectory.dir('examples')) + sourceSets.main.runtimeClasspath
mainClass = 'TslibExamples'
}