-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathbuild.gradle.kts
121 lines (107 loc) · 3.37 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
plugins {
kotlin("jvm")
kotlin("kapt")
id("java-gradle-plugin")
`kotlin-dsl`
id("com.gradle.plugin-publish") version "1.2.1"
id("com.vanniktech.maven.publish")
id("org.jlleitschuh.gradle.ktlint")
}
allprojects {
repositories {
mavenLocal()
mavenCentral()
maven("https://maven.google.com")
maven("https://plugins.gradle.org/m2/")
google()
}
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
dependencies {
add("compileOnly", kotlin("gradle-plugin"))
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
dependencies {
implementation(libs.kotlin.gradle.plugin.api)
}
gradlePlugin {
website.set("https://github.com/Foso/Ktorfit")
vcsUrl.set("https://github.com/Foso/Ktorfit")
plugins {
create("ktorfitPlugin") {
id = "de.jensklingenberg.ktorfit" // users will do `apply plugin: "de.jensklingenberg.ktorfit"`
implementationClass = "de.jensklingenberg.ktorfit.gradle.KtorfitGradlePlugin" // entry-point class
displayName = "Ktorfit Gradle Plugin"
description = "Gradle Plugin for Ktorfit"
tags.set(listOf("http", "kotlin", "kotlin-mpp", "ktor", "rest"))
}
}
}
val enableSigning = project.hasProperty("signingInMemoryKey")
mavenPublishing {
coordinates(
libs.versions.groupId.get(),
"ktorfit-gradle-plugin",
libs.versions.ktorfitGradle.get(),
)
publishToMavenCentral()
// publishToMavenCentral(SonatypeHost.S01) for publishing through s01.oss.sonatype.org
if (enableSigning) {
signAllPublications()
}
}
publishing {
publications {
create<MavenPublication>("default") {
from(components["java"])
pom {
name.set("ktorfit-gradle-plugin")
description.set("Gradle plugin for Ktorfit")
url.set("https://github.com/Foso/Ktorfit")
licenses {
license {
name.set("Apache License 2.0")
url.set("https://github.com/Foso/Ktorfit/blob/master/LICENSE.txt")
}
}
scm {
url.set("https://github.com/Foso/Ktorfit")
connection.set("scm:git:git://github.com/Foso/Ktorfit.git")
}
developers {
developer {
name.set("Jens Klingenberg")
url.set("https://github.com/Foso")
}
}
}
}
}
repositories {
if (
hasProperty("sonatypeUsername") &&
hasProperty("sonatypePassword") &&
hasProperty("sonatypeSnapshotUrl") &&
hasProperty("sonatypeReleaseUrl")
) {
maven {
val url =
when {
"SNAPSHOT" in version.toString() -> property("sonatypeSnapshotUrl")
else -> property("sonatypeReleaseUrl")
} as String
setUrl(url)
credentials {
username = property("sonatypeUsername") as String
password = property("sonatypePassword") as String
}
}
}
}
}