-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
139 lines (127 loc) · 4.42 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
127
128
129
130
131
132
133
134
135
136
137
138
139
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
signing
`maven-publish`
`java-library`
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.changelog)
alias(libs.plugins.dokka)
}
group = "net.theevilreaper.dartpoet"
version = System.getenv("TAG_VERSION") ?: "0.0.1-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
compileOnly(libs.jetbrains.annotations)
testImplementation(kotlin("test"))
testImplementation(libs.google.truth)
testImplementation(libs.junit.api)
testImplementation(libs.junit.params)
testRuntimeOnly(libs.junit.engine)
}
tasks {
test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
compileKotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_21)
}
}
}
val sourceJar by tasks.register<Jar>("kotlinJar") {
description = "Creates a JAR archive containing all source files"
group = JavaBasePlugin.BUILD_TASK_NAME
from(sourceSets.main.get().allSource)
archiveClassifier.set("sources")
}
val dokkaJavadocJar by tasks.register<Jar>("dokkaHtmlJar") {
description = "Generates the documentation in the HTML format"
group = JavaBasePlugin.DOCUMENTATION_GROUP
dependsOn(rootProject.tasks.dokkaHtml)
from(rootProject.tasks.dokkaHtml.flatMap { it.outputDirectory })
archiveClassifier.set("html-docs")
}
val dokkaHtmlJar by tasks.register<Jar>("dokkaJavadocJar") {
description = "Generates documentation in Javadoc format"
group = JavaBasePlugin.DOCUMENTATION_GROUP
dependsOn(rootProject.tasks.dokkaJavadoc)
from(rootProject.tasks.dokkaJavadoc.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
}
kotlin {
jvmToolchain(21)
}
changelog {
path.set("${project.projectDir}/CHANGELOG.md")
itemPrefix.set("-")
keepUnreleasedSection.set(true)
unreleasedTerm.set("[Unreleased]")
groups.set(listOf("Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"))
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components.findByName("java"))
groupId = "dev.themeinerlp"
artifactId = "dartpoet"
version = rootProject.version.toString()
artifact(dokkaJavadocJar)
artifact(dokkaHtmlJar)
artifact(sourceJar)
pom {
name.set("DartPoet")
description.set("A Kotlin API which allows the generation of code for dart")
url.set("https://github.com/theEvilReaper/DartPoet")
licenses {
license {
name.set("AGPL-3.0")
url.set("https://github.com/theEvilReaper/DartPoet/blob/develop/LICENSE")
}
}
issueManagement {
system.set("Github")
url.set("https://github.com/theEvilReaper/DartPoet/issues")
}
developers {
developer {
id.set("themeinerlp")
name.set("Phillipp Glanz")
email.set("[email protected]")
}
developer {
id.set("theEvilReaper")
name.set("Steffen Wonning")
email.set("[email protected]")
}
}
scm {
connection.set("scm:[email protected]:theEvilReaper/DartPoet.git")
developerConnection.set("scm:[email protected]:theEvilReaper/DartPoet.git")
url.set("https://github.com/theEvilReaper/DartPoet")
}
}
}
}
repositories {
maven {
val releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
val snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = if (version.toString().endsWith("SNAPSHOT")) uri(snapshotsRepoUrl) else uri(releasesRepoUrl)
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_PASSWORD")
}
}
}
}
signing {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications)
}