-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle.kts
117 lines (97 loc) · 2.9 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
plugins {
`java-library`
signing
`maven-publish`
id("net.minecrell.licenser") version "0.4.1"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
}
repositories {
mavenCentral()
}
dependencies {
api("org.cadixdev:bombe:0.3.4")
compileOnly("org.cadixdev:lorenz:0.5.5")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.3.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.3.1")
}
tasks.withType<Test> {
useJUnitPlatform()
}
val sourceJar = task<Jar>("sourceJar") {
classifier = "sources"
from(sourceSets["main"].allSource)
}
val javadocJar = task<Jar>("javadocJar") {
classifier = "javadoc"
from(tasks["javadoc"])
}
artifacts {
add("archives", sourceJar)
add("archives", javadocJar)
}
val isSnapshot = version.toString().endsWith("-SNAPSHOT")
publishing {
publications {
register<MavenPublication>("mavenJava") {
from(components["java"])
artifact(sourceJar)
artifact(javadocJar)
pom {
val name: String by project
val description: String by project
val url: String by project
name(name)
description(description)
url(url)
scm {
url(url)
connection("scm:git:$url.git")
developerConnection.set(connection)
}
issueManagement {
system("GitHub Issues")
url("$url/issues")
}
licenses {
license {
name("MIT License")
url("https://opensource.org/licenses/MIT")
distribution("repo")
}
}
developers {
developer {
id("jamierocks")
name("Jamie Mansfield")
email("[email protected]")
url("https://www.jamiemansfield.me/")
timezone("Europe/London")
}
}
}
}
}
repositories {
val sonatypeUsername: String? by project
val sonatypePassword: String? by project
if (sonatypeUsername != null && sonatypePassword != null) {
val url = if (isSnapshot) "https://oss.sonatype.org/content/repositories/snapshots/"
else "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
maven(url) {
credentials {
username = sonatypeUsername
password = sonatypePassword
}
}
}
}
}
signing {
sign(publishing.publications["mavenJava"])
}
tasks.withType<Sign> {
onlyIf { !isSnapshot }
}
operator fun Property<String>.invoke(v: String) = set(v)