-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
119 lines (100 loc) · 3.56 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
import org.jetbrains.dokka.gradle.DokkaTask
plugins {
`build-scan`
`maven-publish`
signing
kotlin("jvm") version "1.3.50"
id("org.jetbrains.dokka") version "0.10.0"
}
group = "com.github.achrafamil"
version = "1.0.1"
val sourceSets: SourceSetContainer by project
//sonatype login
val REPOSITORY_USER_NAME: String by project
val REPOSITORY_PASSWORD: String by project
//Artifact signing PGP key
val SIGNING_KEY_ID: String by project
val SIGNING_PASSWORD: String by project
val SIGNING_SECRET_KEY_RING_FILE: String by project
allprojects {
extra["signing.keyId"] = SIGNING_KEY_ID
extra["signing.password"] = SIGNING_PASSWORD
extra["signing.secretKeyRingFile"] = SIGNING_SECRET_KEY_RING_FILE
}
repositories {
jcenter()
}
dependencies {
implementation(kotlin("stdlib", "1.3.41"))
testImplementation("junit:junit:4.12")
testImplementation("org.mockito:mockito-core:2.1.0")
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0")
}
buildScan {
setTermsOfServiceUrl("https://gradle.com/terms-of-service")
setTermsOfServiceAgree("yes")
publishAlways()
}
tasks {
val sourcesJar by creating(Jar::class) {
dependsOn(JavaPlugin.CLASSES_TASK_NAME)
classifier = "sources"
from(sourceSets["main"].allSource)
}
val dokka by getting(DokkaTask::class) {
outputFormat = "html"
outputDirectory = "$buildDir/javadoc"
}
val dokkaJar by tasks.creating(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Assembles Kotlin docs with Dokka"
classifier = "javadoc"
from(dokka)
}
publishing {
publications {
create<MavenPublication>("default") {
pom {
name.set("Splendor API")
description.set("Kotlin library to play (and experiment) Splendor, the board game.")
url.set("https://github.com/achrafamil/splendor-api")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("achrafamil")
name.set("Achraf Amil")
email.set("achraf.amil@gmail.com")
}
}
scm {
connection.set("scm:git@github.com:achrafamil/splendor-api.git")
developerConnection.set("scm:git@github.com:achrafamil/splendor-api.git")
url.set("https://github.com/achrafamil/splendor-api")
}
}
from(components["java"])
artifact(sourcesJar)
artifact(dokkaJar)
}
signing {
sign(publishing.publications["default"])
}
}
repositories {
maven {
val snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
val releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl)
credentials {
username = REPOSITORY_USER_NAME
password = REPOSITORY_PASSWORD
}
}
}
}
}