-
-
Notifications
You must be signed in to change notification settings - Fork 83
/
build.gradle.kts
122 lines (105 loc) · 4.11 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
plugins {
java
`maven-publish`
signing
alias(libs.plugins.nexus.publish)
}
group = "com.github.gavlyukovskiy"
version = version.takeUnless { it == "unspecified" } ?: "0.1.0-SNAPSHOT"
val sonatypeUser: String? = project.properties["sonatype_user"]?.toString()
?: System.getenv("SONATYPE_USER")
val sonatypePassword: String? = project.properties["sonatype_password"]?.toString()
?: System.getenv("SONATYPE_PASSWORD")
val gpgKey: String? = project.properties["gpg_key_path"]?.toString()?.let { File(it).readText() }
?: System.getenv("GPG_KEY")
val gpgPassphrase: String? = project.properties["gpg_passphrase"] as String?
?: System.getenv("GPG_PASSPHRASE")
nexusPublishing {
repositories {
sonatype {
username.set(sonatypeUser)
password.set(sonatypePassword)
}
}
}
subprojects {
apply(plugin = "java")
extra["release"] = listOf(
"datasource-decorator-spring-boot-autoconfigure",
"datasource-proxy-spring-boot-starter",
"flexy-pool-spring-boot-starter",
"p6spy-spring-boot-starter"
).contains(project.name)
java.sourceCompatibility = JavaVersion.VERSION_17
group = rootProject.group
repositories {
mavenCentral()
}
if (extra["release"] as Boolean) {
apply(plugin = "maven-publish")
apply(plugin = "signing")
val sourceJar by tasks.registering(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}
val javadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
from(tasks["javadoc"])
}
tasks.withType<Jar> {
from(rootProject.projectDir) {
include("LICENSE.txt")
into("META-INF")
}
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
artifact(sourceJar.get())
artifact(javadocJar.get())
if (version.toString() == "0.1.0-SNAPSHOT") {
throw IllegalStateException("'-Pversion' must be set")
}
pom {
name.set(project.name)
description.set("Spring Boot integration with p6spy, datasource-proxy and flexy-pool")
url.set("https://github.com/gavlyukovskiy/spring-boot-data-source-decorator")
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("gavlyukovskiy")
name.set("Arthur Gavlyukovskiy")
email.set("[email protected]")
}
}
scm {
url.set("https://github.com/gavlyukovskiy/spring-boot-data-source-decorator")
}
issueManagement {
url.set("https://github.com/gavlyukovskiy/spring-boot-data-source-decorator/issues")
}
}
}
}
}
signing {
isRequired = gpgKey != null
useInMemoryPgpKeys(gpgKey, gpgPassphrase)
sign(*publishing.publications.toTypedArray())
}
}
if (project.name.contains("sample")) {
tasks.withType<JavaCompile> {
dependsOn(":datasource-decorator-spring-boot-autoconfigure:publishToMavenLocal")
dependsOn(":datasource-proxy-spring-boot-starter:publishToMavenLocal")
dependsOn(":flexy-pool-spring-boot-starter:publishToMavenLocal")
dependsOn(":p6spy-spring-boot-starter:publishToMavenLocal")
}
}
}