-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.gradle.kts
102 lines (93 loc) · 3.4 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
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.4.32"
`maven-publish`
id("org.jetbrains.dokka") version "1.4.32"
id("com.github.johnrengelman.shadow") version "5.1.0" apply false
}
val dokkaJarConfig: (TaskProvider<DokkaTask>) -> Jar.() -> Unit by extra {
{ task: TaskProvider<DokkaTask> ->
{
group = JavaBasePlugin.DOCUMENTATION_GROUP
setProperty("classifier", "javadoc")
from(task)
}
}
}
val sourcesJarConfig: Jar.() -> Unit by extra {
{
group = JavaBasePlugin.BUILD_TASK_NAME
dependsOn(JavaPlugin.CLASSES_TASK_NAME)
setProperty("classifier", "sources")
from(project.sourceSets["main"].allSource)
}
}
val publicationConfig by extra {
{ project: Project, publication: String, artifactsToUse: List<Jar> ->
Action<PublishingExtension> {
publications {
create<MavenPublication>(publication) {
from(project.components["kotlin"])
groupId = project.group.toString()
artifactId = publication
version = project.version.toString()
pom {
name.set("kotlin-shell")
description.set("Tool for performing shell-like programing in Kotlin")
url.set("https://github.com/jakubriegel/kotlin-shell")
licenses {
license {
name.set("Apache License")
url.set("https://raw.githubusercontent.com/jakubriegel/kotlin-shell/master/LICENSE")
}
}
scm {
url.set("https://github.com/jakubriegel/kotlin-shell")
}
developers {
developer {
name.set("Jakub Riegel")
url.set("https://github.com/jakubriegel")
}
}
}
setArtifacts(artifactsToUse)
}
}
repositories {
maven {
name = "ossStaging"
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = System.getenv("SONATYPE_NEXUS_USERNAME")
password = System.getenv("SONATYPE_NEXUS_PASSWORD")
}
}
}
}
}
}
allprojects {
group = "eu.jrie.jetbrains"
version = "0.2.1"
repositories {
mavenCentral()
}
}
subprojects {
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
apply(plugin = "signing")
afterEvaluate {
configure<SigningExtension> {
useInMemoryPgpKeys(System.getenv("GPG_PRIVATE_KEY"), System.getenv("GPG_PRIVATE_KEY_PASSWORD"))
val publicationsContainer = (extensions.getByName("publishing") as PublishingExtension).publications
sign(publicationsContainer)
}
tasks.withType(Sign::class.java).configureEach {
isEnabled = !System.getenv("GPG_PRIVATE_KEY").isNullOrBlank()
}
}
}