-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
190 lines (161 loc) · 5.36 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
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.17"
}
}
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.0'
id 'org.jetbrains.dokka' version '0.9.17'
id 'maven'
id 'signing'
}
def username = hasProperty('ossrhUsername') ? ossrhUsername : System.getenv('ossrhUsername')
def password = hasProperty('ossrhPassword') ? ossrhPassword : System.getenv('ossrhPassword')
project.ext.version = "0.0.4"
group 'io.github.boc-tothefuture'
version project.ext.version
repositories {
mavenCentral()
}
//Add integration tests
sourceSets {
integrationTest {
compileClasspath += main.output
runtimeClasspath += main.output
}
}
task("integrationTest", type: Test) {
description = "Runs the integration tests"
group = "verification"
testClassesDirs = sourceSets["integrationTest"].output.classesDirs
classpath = sourceSets["integrationTest"].runtimeClasspath
mustRunAfter(tasks["test"])
useJUnitPlatform()
}
configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntime.extendsFrom testRuntime
}
dependencies {
compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8",
'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0',
'io.github.microutils:kotlin-logging:1.4.9'
)
testCompile(
"org.assertj:assertj-core:3.11.1",
"com.github.stefanbirkner:system-rules:1.17.2"
)
testImplementation(
'org.junit.jupiter:junit-jupiter-api:5.3.1',
'org.junit.jupiter:junit-jupiter-params:5.3.1',
"io.mockk:mockk:1.8.10.kotlin13"
)
testRuntimeOnly(
'org.junit.jupiter:junit-jupiter-engine:5.3.1',
'ch.qos.logback:logback-classic:1.1.3',
'ch.qos.logback:logback-core:1.1.3'
)
integrationTestImplementation(
'org.testcontainers:junit-jupiter:1.10.1',
'org.awaitility:awaitility:3.1.3',
'org.awaitility:awaitility-kotlin:3.1.3',
'org.junit.jupiter:junit-jupiter-engine:5.3.1',
'org.junit.jupiter:junit-jupiter-api:5.3.1',
'org.junit.jupiter:junit-jupiter-params:5.3.1',
"io.mockk:mockk:1.8.10.kotlin13",
'ch.qos.logback:logback-classic:1.1.3',
'ch.qos.logback:logback-core:1.1.3'
)
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
test {
useJUnitPlatform()
}
//Clean up leftover files from testcontainers
clean.doLast {
fileTree(dir: "${rootDir}", include: "*tcplocalhost*").visit {
FileVisitDetails details -> details.file.deleteDir()
}
}
check.dependsOn integrationTest
// For Github pages documentation
dokka {
outputFormat = "html"
outputDirectory = "build/docs"
}
//For maven javadoc
task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
outputFormat = 'javadoc'
outputDirectory = "$buildDir/javadoc"
}
task sourcesJar(type: Jar) {
classifier "sources"
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
classifier "javadoc"
from "build/javadoc"
}
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
signing {
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: username, password: password)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: username, password: password)
}
pom.project {
name "Kotlin Homie"
packaging 'jar'
description = "An opinionated Kotlin client implementation of the Homie IoT protocol"
url = "https://github.com/boc-tothefuture/kotlin-homieiot"
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'boc-tothefuture'
name = "Brian O'Connell"
email = '[email protected]'
}
}
scm {
connection = 'scm:git:https://github.com/boc-tothefuture/kotlin-homieiot.git'
developerConnection = 'scm:git:https://github.com/boc-tothefuture/kotlin-homieiot.git'
url = 'https://github.com/boc-tothefuture/kotlin-homieiot'
}
}
pom.withXml {
asNode().dependencies.'*'.findAll() {
it.scope.text() == 'runtime' && project.configurations.compile.allDependencies.find { dep ->
dep.name == it.artifactId.text()
}
}.each() {
it.scope*.value = 'compile'
}
}
}
}
}