forked from Minecrell/TerminalConsoleAppender
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
117 lines (95 loc) · 2.95 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
`maven-publish`
signing
id("io.codearte.nexus-staging") version "0.21.0"
id("net.minecrell.licenser") version "0.4.1"
}
val artifactId = project.name.toLowerCase()
base.archivesBaseName = artifactId
java {
sourceCompatibility = JavaVersion.VERSION_1_8
}
repositories {
mavenCentral()
}
dependencies {
compile("org.apache.logging.log4j:log4j-core:2.8.1")
annotationProcessor("org.apache.logging.log4j:log4j-core:2.8.1")
compile("org.jline:jline-reader:3.12.1")
compileOnly("org.checkerframework:checker-qual:2.9.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.5.1")
testRuntime("org.junit.jupiter:junit-jupiter-engine:5.5.1")
}
tasks.withType<Test> {
useJUnitPlatform()
}
val sourceJar = task<Jar>("sourceJar") {
archiveClassifier("sources")
from(sourceSets["main"].allSource)
}
val javadocJar = task<Jar>("javadocJar") {
archiveClassifier("javadoc")
from(tasks["javadoc"])
}
val isSnapshot = version.toString().endsWith("-SNAPSHOT")
publishing {
publications {
register<MavenPublication>("mavenJava") {
from(components["java"])
artifactId = base.archivesBaseName
artifact(sourceJar)
artifact(javadocJar)
pom {
val url: String by project
name(project.name)
description(project.description!!)
url(url)
scm {
url(url)
connection("scm:git:$url.git")
developerConnection.set(connection)
}
issueManagement {
system("GitHub Issues")
url("$url/issues")
}
developers {
developer {
id("minecrell")
name("Minecrell")
email("[email protected]")
}
}
licenses {
license {
name("MIT License")
url("https://opensource.org/licenses/MIT")
distribution("repo")
}
}
}
}
}
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)