-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle.kts
135 lines (119 loc) · 3.23 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
plugins {
java
`maven-publish`
signing
id("com.diffplug.gradle.spotless") version "3.27.1"
id("com.github.johnrengelman.shadow") version "5.2.0"
id("de.marcphilipp.nexus-publish") version "0.4.0"
id("io.codearte.nexus-staging") version "0.21.2"
}
repositories {
mavenCentral()
}
dependencies {
implementation("com.amazonaws:aws-java-sdk-rds:1.11.745")
implementation("com.amazonaws:aws-java-sdk-sts:1.11.745")
testImplementation("junit:junit:3.8.1")
testImplementation("org.postgresql:postgresql:42.2.12")
}
group = "io.magj"
val release: String? by project
val baseVersion = "0.1.8"
version = if (release != null && release!!.toBoolean()) {
baseVersion
} else {
"$baseVersion-SNAPSHOT"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}
spotless {
java {
googleJavaFormat().aosp()
removeUnusedImports()
}
kotlinGradle {
ktlint()
}
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
artifact(tasks.shadowJar.get()) {
classifier = "all"
}
pom {
name.set(project.name)
description.set("A generic JDBC driver wrapper connecting using IAM RDS token authentication")
url.set("https://github.com/magJ/iam-jdbc-driver")
licenses {
license {
name.set("MIT License")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("magj")
name.set("Magnus Jason")
email.set("[email protected]")
}
}
scm {
url.set(pom.url)
}
}
}
}
}
nexusPublishing {
repositories {
sonatype()
}
}
val mavenUploadUser: String? by project
val mavenUploadPassword: String? by project
nexusStaging {
username = mavenUploadUser
password = mavenUploadPassword
// Try for 2 minutes
numberOfRetries = 30
delayBetweenRetriesInMillis = 4000
}
tasks.closeRepository.configure {
mustRunAfter(tasks.publish)
}
signing {
val signingKeyId: String? by project
val signingKey: String? by project
val signingPassword: String? by project
if (signingKey != null && signingPassword != null) {
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign(publishing.publications["mavenJava"])
}
}
tasks.javadoc {
if (JavaVersion.current().isJava9Compatible) {
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
}
}
tasks.shadowJar {
listOf(
"com.amazonaws",
"software.amazon",
"com.fasterxml",
"org.apache.commons",
"org.apache.http",
"org.joda",
"com.fasterxml"
).forEach {
relocate(it, "io.magj.iamjdbcdriver.repackaged.$it")
}
}
tasks.assemble {
dependsOn(tasks.shadowJar)
}