-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
126 lines (115 loc) · 3.97 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
import org.jetbrains.dokka.gradle.DokkaTask
import java.time.Instant
import java.net.URI
import java.util.Properties
plugins {
kotlin("jvm") version "1.4.30"
id("org.jetbrains.dokka") version "1.4.20"
`maven-publish`
signing
}
// Load properties from local.properties
val propertiesFile = project.rootProject.file("local.properties")
if(propertiesFile.exists()) {
val p = Properties()
propertiesFile.inputStream().use {
p.load(it)
}
p.forEach { name, value ->
extra[name.toString()] = value.toString()
}
}
group = "xyz.teogramm"
version = "0.9.0"
repositories {
mavenCentral()
jcenter()
}
val jarComponent: SoftwareComponent = components["kotlin"]
tasks {
jar {
manifest {
attributes["Built-By"] = "Theodoros Grammenos"
attributes["Build-Jdk"] =
"${System.getProperty("java.version")} (${System.getProperty("java.vendor")} ${System.getProperty("java.vm.version")})"
attributes["Build-Timestamp"] = Instant.now().toString()
attributes["Created-By"] = "Gradle ${gradle.gradleVersion}"
attributes["Implementation-Title"] = project.name
attributes["Implementation-Version"] = project.version
}
}
val sourcesJar by registering(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}
val dokkaJavadoc by getting(DokkaTask::class)
val javadocJar by registering(Jar::class) {
archiveClassifier.set("javadoc")
from("$buildDir/dokka/javadoc")
dependsOn(dokkaJavadoc.path)
}
publishing {
publications {
create<MavenPublication>("release") {
from(jarComponent)
artifact(sourcesJar)
artifact(javadocJar)
pom {
name.set("Oasth")
description.set("A library to access the OASTH API.")
url.set("https://github.com/teogramm/oasth")
licenses {
license {
name.set("GNU General Public License v3")
url.set("https://github.com/teogramm/oasth/blob/master/LICENSE")
}
}
developers {
developer {
id.set("teorgamm")
name.set("Theodoros Grammenos")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/teogramm/oasth.git")
developerConnection.set("scm:git:git://github.com/teogramm/oasth.git")
url.set("https://github.com/teogramm/oasth")
}
}
}
}
// The repository to publish to, Sonatype/MavenCentral
repositories {
maven {
name = "mavenCentral"
url = URI("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = System.getenv("SONATYPE_USERNAME")
password = System.getenv("SONATYPE_PASSWORD")
}
}
}
}
}
signing {
setRequired({
gradle.taskGraph.hasTask("publishReleasePublicationToMavenCentralRepository")
})
// Workaround Gradle issue https://github.com/gradle/gradle/issues/5064
// To enable signing set the "signing.gnupg.keyName" property
if(project.hasProperty("signing.gnupg.keyName")) {
useGpgCmd()
}
sign(publishing.publications)
}
sourceSets {
create("debug") {
compileClasspath += sourceSets.main.get().runtimeClasspath
runtimeClasspath += sourceSets.main.get().runtimeClasspath
}
}
dependencies {
implementation(kotlin("stdlib"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2")
}