This repository has been archived by the owner on Feb 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle.kts
212 lines (189 loc) · 5.46 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
import org.jetbrains.dokka.gradle.PackageOptions
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
`kotlin-dsl`
`maven-publish`
id("com.gradle.build-scan") version "2.4.2"
id("com.gradle.plugin-publish") version "0.10.1"
id("com.diffplug.gradle.spotless") version "3.24.2"
id("com.github.johnrengelman.shadow") version "5.1.0"
id("org.jetbrains.gradle.plugin.idea-ext")
id("com.github.ben-manes.versions") version "0.25.0"
id("org.jetbrains.dokka") version "0.9.18"
id("org.ajoberstar.stutter") version "0.5.0"
}
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
}
group = "de.marcphilipp.gradle"
version = "0.5.0-SNAPSHOT"
val readableName = "Nexus Publish Plugin"
description = "Gradle Plugin for publishing to Nexus repositories"
val repoUrl = "https://github.com/marcphilipp/nexus-publish-plugin"
pluginBundle {
description = project.description
website = repoUrl
vcsUrl = repoUrl
tags = listOf("publishing", "maven", "nexus", "travis")
}
gradlePlugin {
plugins {
create("nexusPublish") {
id = "de.marcphilipp.nexus-publish"
displayName = readableName
implementationClass = "de.marcphilipp.gradle.nexus.NexusPublishPlugin"
}
}
}
repositories {
mavenCentral()
jcenter()
}
val licenseHeaderFile = file("gradle/license-header.txt")
spotless {
kotlin {
ktlint()
licenseHeaderFile(licenseHeaderFile)
}
}
idea {
project {
settings {
copyright {
useDefault = "Apache-2.0"
profiles {
create("Apache-2.0") {
notice = readCopyrightHeader(licenseHeaderFile)
keyword = "Copyright"
}
}
}
}
}
}
val shadowed by configurations.creating
configurations {
compileOnly {
extendsFrom(shadowed)
}
testImplementation {
extendsFrom(shadowed)
exclude(group = "junit", module = "junit")
}
}
dependencies {
shadowed("com.squareup.retrofit2:retrofit:2.6.1")
shadowed("com.squareup.retrofit2:converter-gson:2.6.1")
val nexusStagingPlugin = create("io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.21.1")
compileOnly(nexusStagingPlugin)
testImplementation(nexusStagingPlugin)
testImplementation("org.junit.jupiter:junit-jupiter:5.5.2")
testImplementation("com.github.tomakehurst:wiremock:2.24.1")
testImplementation("ru.lanwen.wiremock:wiremock-junit5:1.3.1")
testImplementation("org.assertj:assertj-core:3.13.2")
}
stutter {
java(8) {
compatibleRange("4.10")
}
}
configurations {
compatTestCompileClasspath {
extendsFrom(testCompileClasspath.get())
}
compatTestRuntimeClasspath {
extendsFrom(testRuntimeClasspath.get())
}
}
sourceSets {
compatTest {
compileClasspath += sourceSets["test"].output
runtimeClasspath += sourceSets["test"].output
}
}
tasks {
withType<KotlinCompile>().configureEach {
kotlinOptions.jvmTarget = "1.8"
}
shadowJar {
archiveClassifier.set("")
configurations = listOf(shadowed)
exclude("META-INF/maven/**")
listOf("retrofit2", "okhttp3", "okio", "com").forEach {
relocate(it, "${project.group}.nexus.shadow.$it")
}
}
jar {
enabled = false
dependsOn(shadowJar)
}
pluginUnderTestMetadata {
pluginClasspath.from.clear()
pluginClasspath.from(shadowJar)
}
withType<Test>().configureEach {
dependsOn(shadowJar)
useJUnitPlatform()
maxParallelForks = 8
}
dokka {
outputFormat = "javadoc"
outputDirectory = "$buildDir/javadoc"
reportUndocumented = false
jdkVersion = 8
packageOptions(delegateClosureOf<PackageOptions> {
prefix = "de.marcphilipp.gradle.nexus.internal"
suppress = true
})
}
}
val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.main.map { it.allSource })
}
val javadocJar by tasks.creating(Jar::class) {
archiveClassifier.set("javadoc")
from(tasks.dokka)
}
// used by plugin-publish plugin
val archives by configurations.getting
archives.artifacts.clear()
artifacts {
add(archives.name, tasks.shadowJar) {
classifier = ""
}
add(archives.name, sourcesJar)
add(archives.name, javadocJar)
}
publishing {
publications {
afterEvaluate {
named<MavenPublication>("pluginMaven") {
artifact(sourcesJar)
artifact(javadocJar)
pom {
name.set(readableName)
description.set(project.description)
inceptionYear.set("2018")
url.set(repoUrl)
developers {
developer {
name.set("Marc Philipp")
id.set("marcphilipp")
}
}
licenses {
license {
name.set("Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
}
}
}
}
}
tasks.wrapper {
distributionType = Wrapper.DistributionType.ALL
}