-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
169 lines (151 loc) · 5.67 KB
/
build.gradle.kts
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
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
version = "1.1"
group = "io.github.thiyagu06"
plugins {
id("org.jetbrains.kotlin.jvm") version "1.5.20"
`java-library`
id("io.gitlab.arturbosch.detekt") version "1.17.1"
jacoco
`maven-publish`
signing
id("io.codearte.nexus-staging") version "0.30.0"
id ("org.jetbrains.dokka") version "0.10.1"
}
repositories {
jcenter()
mavenCentral()
}
sourceSets {
create("integrationTest") {
withConvention(KotlinSourceSet::class) {
kotlin.srcDir("src/it/kotlin")
kotlin.srcDir("src/it/resources")
compileClasspath += sourceSets.main.get().output + sourceSets.test.get().output + configurations.testRuntimeClasspath
runtimeClasspath += output + compileClasspath + sourceSets.test.get().runtimeClasspath
}
}
}
val integrationTestImplementation by configurations.getting {
extendsFrom(configurations.testImplementation.get())
}
configurations["integrationTestRuntimeOnly"].extendsFrom(configurations.testRuntimeOnly.get())
dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("software.amazon.awssdk:sqs:2.16.95")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.5.0-native-mt")
testImplementation(kotlin("test"))
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.1-native-mt")
testImplementation("io.mockk:mockk:1.12.0")
testImplementation(kotlin("test-junit5"))
testImplementation("org.junit.jupiter:junit-jupiter:5.7.2")
testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.4.2")
integrationTestImplementation("org.testcontainers:localstack:1.15.3")
integrationTestImplementation("cloud.localstack:localstack-utils:0.2.13")
}
tasks {
named<Task>("check") {
dependsOn(named<Task>("jacocoTestReport"))
}
named<Test>("test") {
useJUnitPlatform()
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "12"
}
withType<JacocoReport> {
reports {
xml.isEnabled = true
html.isEnabled = true
xml.destination = file("$buildDir/reports/jacoco/jacocoTestReport.xml")
html.destination = file("$buildDir/reports/jacoco")
}
classDirectories.setFrom(
sourceSets.main.get().output.asFileTree.matching {
exclude("org/thiyagu/reactive/FlowUtilsKt.class")
exclude("org/thiyagu/reactive/core/MessageListener.class")
exclude("org/thiyagu/reactive/SqsListener.class")
exclude("org/thiyagu/reactive/core/MessageHandler.class")
exclude("org/thiyagu/reactive/domain/*")
exclude()
}
)
}
}
val integrationTest = task<Test>("integrationTest") {
description = "Run integration test"
group = "verification"
testClassesDirs = sourceSets["integrationTest"].output.classesDirs
classpath = sourceSets["integrationTest"].runtimeClasspath
shouldRunAfter("test")
useJUnitPlatform()
}
//tasks.check { dependsOn(integrationTest) }
val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.getByName("main").allSource)
}
val javadocJar by tasks.creating(Jar::class) {
archiveClassifier.set ("javadoc")
from("$buildDir/reports/javadoc")
}
val ossrhUsername: String by project
val ossrhPassword: String by project
val projectName="reactive-sqs-consumer"
nexusStaging {
username = ossrhUsername
password = ossrhPassword
}
publishing {
publications {
create<MavenPublication>("lib") {
artifactId = projectName
from(components["java"])
artifact(sourcesJar)
artifact(javadocJar)
pom {
name.set(projectName)
description.set("reactive sqs consumer using kotlin flow")
url.set("https://github.com/thiyagu06/reactive-sqs-consumer")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("thiyagu06")
name.set("Thiyagu")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/thiyagu06/reactive-sqs-consumer.git")
developerConnection.set("scm:git:ssh://github.com/thiyagu06/reactive-sqs-consumer.git")
url.set("https://github.com/thiyagu06/reactive-sqs-consumer")
}
}
}
}
repositories {
maven {
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
}
}
extra["isReleaseVersion"] = !version.toString().endsWith("SNAPSHOT")
signing {
setRequired({
(project.extra["isReleaseVersion"] as Boolean) && gradle.taskGraph.hasTask("publish")
})
sign(publishing.publications["lib"])
}