-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
175 lines (151 loc) · 5.15 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
170
171
172
173
174
175
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
repositories {
mavenCentral()
maven(url = "https://repo.spring.io/plugins-release")
}
dependencies {
classpath("io.spring.gradle:propdeps-plugin:0.0.9.RELEASE")
}
}
apply(plugin = "propdeps")
apply(plugin = "propdeps-idea")
val springBootDependencies: String by extra
val kotlinVersion: String by extra
plugins {
id("org.sonarqube").version("3.1.1")
id("io.spring.dependency-management")
kotlin("jvm")
kotlin("plugin.spring")
kotlin("kapt")
id("maven-publish")
id("idea")
id("signing")
jacoco
id("io.hndrs.publishing-info").version("2.0.0")
}
val isRelease = project.hasProperty("release")
group = "io.hndrs"
version = "1.0.0".plus(if (isRelease) "" else "-SNAPSHOT")
java.sourceCompatibility = JavaVersion.VERSION_11
java.targetCompatibility = JavaVersion.VERSION_11
repositories {
mavenCentral()
}
sonarqube {
properties {
property("sonar.projectKey", "hndrs_spring-data-generated-kotlin-repository")
property("sonar.organization", "hndrs")
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.exclusions", "**/sample/**")
}
}
java {
withJavadocJar()
}
configure<JacocoPluginExtension> {
toolVersion = "0.8.6"
}
tasks.withType<JacocoReport> {
reports {
xml.apply {
isEnabled = true
}
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "11"
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
dependencies {
kapt(group = "com.google.auto.service", name = "auto-service", version = "1.0-rc7")
implementation(group = "com.google.auto.service", name = "auto-service", version = "1.0-rc7")
implementation("org.springframework.boot:spring-boot-starter-data-mongodb")
implementation(project(":annotations"))
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
testImplementation(platform("org.junit:junit-bom:5.7.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("io.mockk:mockk:1.10.6")
testImplementation("org.assertj:assertj-core:3.19.0")
testImplementation("com.github.tschuchortdev:kotlin-compile-testing:1.3.6")
//For the test to compile the generated repository we need the spring dependencies
testImplementation("org.springframework.boot:spring-boot-starter-data-mongodb")
}
dependencyManagement {
resolutionStrategy {
cacheChangingModulesFor(0, "seconds")
}
imports {
mavenBom("org.springframework.boot:spring-boot-dependencies:$springBootDependencies") {
bomProperty("kotlin.version", kotlinVersion)
}
}
}
val sourcesJarSubProject by tasks.creating(Jar::class) {
dependsOn("classes")
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}
publishing {
repositories {
if (isRelease) {
maven {
name = "release"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
credentials {
username = System.getenv("SONATYPE_USER")
password = System.getenv("SONATYPE_PASSWORD")
}
}
} else {
maven {
name = "snapshot"
url = uri("https://maven.pkg.github.com/hndrs/spring-data-mongodb-kotlin-extensior")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
publications {
create<MavenPublication>(project.name) {
from(components["java"])
artifact(sourcesJarSubProject)
groupId = rootProject.group as? String
artifactId = rootProject.name
version = "${rootProject.version}${project.findProperty("version.appendix") ?: ""}"
}
}
val signingKey: String? = System.getenv("SIGNING_KEY")
val signingPassword: String? = System.getenv("SIGNING_PASSWORD")
if (signingKey != null && signingPassword != null) {
signing {
useInMemoryPgpKeys(groovy.json.StringEscapeUtils.unescapeJava(signingKey), signingPassword)
sign(publications[project.name])
}
}
}
publishingInfo {
name = rootProject.name
description = "Kotlin Extensions for Spring Data"
url = "https://github.com/hndrs/spring-data-generated-kotlin-repository"
license = io.hndrs.gradle.plugin.License(
"https://github.com/hndrs/spring-data-generated-kotlin-repository/blob/main/LICENSE",
"MIT License"
)
developers = listOf(
io.hndrs.gradle.plugin.Developer("marvinschramm", "Marvin Schramm", "[email protected]")
)
organization = io.hndrs.gradle.plugin.Organization("hndrs", "https://oss.hndrs.io")
scm = io.hndrs.gradle.plugin.Scm(
"scm:git:git://github.com/hndrs/spring-data-generated-kotlin-repository",
"https://github.com/hndrs/spring-data-generated-kotlin-repository"
)
}