-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
114 lines (100 loc) · 3.3 KB
/
build.gradle.kts
File metadata and controls
114 lines (100 loc) · 3.3 KB
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
plugins {
id("java")
id("maven-publish")
id("signing")
id("io.github.gradle-nexus.publish-plugin") version "1.0.0"
}
group = "io.github.abvadabra"
version = "1.3.1"
repositories {
mavenCentral()
}
dependencies {
compileOnly("org.jetbrains:annotations:23.0.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.1")
}
tasks.getByName<Test>("test") {
useJUnitPlatform()
}
val sourceJar by tasks.registering(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.main.get().allJava)
}
val javadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
from(tasks.javadoc)
}
artifacts {
archives(tasks.jar.get())
archives(sourceJar.get())
}
signing {
val signingKey = File(properties["GPG_KEY_FILE"] as String).readText(Charsets.UTF_8)
val signingPassphase = properties["GPG_SIGNING_PASSPHRASE"] as String
useInMemoryPgpKeys(signingKey, signingPassphase)
sign(publishing.publications)
}
object ArtifactMeta {
const val desc = "A simple/fast stacking box layout library."
const val license = "Unlicense"
const val licenseUrl = "https://opensource.org/licenses/unlicense"
const val githubRepo = "github.com/abvadabra/layout-java"
const val release = "https://s01.oss.sonatype.org/service/local/"
const val snapshot = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
const val devId = "abvadabra"
const val devName = "Daniil Dubrovsky"
}
publishing {
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
artifact(sourceJar.get())
artifact(javadocJar.get())
pom {
name.set(project.name)
description.set(ArtifactMeta.desc)
url.set("https://" + ArtifactMeta.githubRepo)
licenses {
license {
name.set(ArtifactMeta.license)
url.set(ArtifactMeta.licenseUrl)
}
}
developers {
developer {
id.set(ArtifactMeta.devId)
name.set(ArtifactMeta.devName)
}
}
scm {
url.set(
"https://${ArtifactMeta.githubRepo}.git"
)
connection.set(
"scm:git:git://${ArtifactMeta.githubRepo}.git"
)
developerConnection.set(
"scm:git:git://${ArtifactMeta.githubRepo}.git"
)
}
issueManagement {
url.set("https://${ArtifactMeta.githubRepo}/issues")
}
}
}
}
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri(ArtifactMeta.release))
snapshotRepositoryUrl.set(uri(ArtifactMeta.snapshot))
username.set(properties["OSSRH_USERNAME"] as String)
password.set(properties["OSSRH_PASSWORD"] as String)
}
}
}