-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
153 lines (127 loc) · 3.88 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
plugins {
id 'java'
id 'maven-publish'
id 'signing'
id 'jacoco'
id 'com.github.kt3k.coveralls' version '2.8.4'
id 'biz.aQute.bnd.builder' version '5.1.2'
}
group = 'com.github.netomi'
archivesBaseName = 'uom'
version = '0.1-SNAPSHOT'
sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
withJavadocJar()
withSourcesJar()
}
jar {
manifest {
attributes('-exportcontents': 'com.github.netomi.uom.*')
}
}
javadoc {
if(JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
sourceSets {
main {
resources {
srcDirs "src/main/resources"
include "uom.properties"
include "**/*.units"
include "**/*.system"
}
}
}
compileJava {
options.compilerArgs << '-Xlint:unchecked'
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}
test {
jacoco {
excludes += ['com/github/netomi/uom/util/ConcurrentReferenceHashMap**']
}
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: '**/ConcurrentReferenceHashMap**')
}))
}
}
// publishing configuration
def isReleaseVersion = !version.endsWith("SNAPSHOT")
def SONATYPE_USERNAME = project.hasProperty('sonatypeUsername') ? project.property('sonatypeUsername') : System.getenv('SONATYPE_USERNAME')
def SONATYPE_PASSWORD = project.hasProperty('sonatypePassword') ? project.property('sonatypePassword') : System.getenv('SONATYPE_PASSWORD')
publishing {
publications {
maven(MavenPublication) {
from components.java
pom {
name = 'Units of Measurements'
description = 'A library to represent quantities and perform conversions between' +
'units of measurements with double or arbitray precision.'
url = 'https://github.com/netomi/uom'
inceptionYear = '2020'
scm {
url = 'https://github.com/netomi/uom'
connection = 'scm:https://github.com/netomi/uom.git'
developerConnection = 'scm:[email protected]:netomi/uom.git'
}
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
developers {
developer {
id = 'netomi'
name = 'Thomas Neidhart'
email = '[email protected]'
}
}
}
}
}
repositories {
def releaseUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotUrl = "https://oss.sonatype.org/content/repositories/snapshots"
maven {
url = isReleaseVersion ? releaseUrl : snapshotUrl
credentials {
username = SONATYPE_USERNAME
password = SONATYPE_PASSWORD
}
}
}
}
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }
sign publishing.publications.maven
}
tasks.withType(Sign) {
onlyIf { isReleaseVersion }
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'lib')
testImplementation('org.junit.jupiter:junit-jupiter:5.6.1')
testImplementation('com.google.guava:guava-testlib:28.2-jre')
testImplementation('org.assertj:assertj-core:3.15.0')
}