-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
114 lines (102 loc) · 3.2 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
plugins {
`kotlin-dsl`
`maven-publish`
`java-gradle-plugin`
kotlin("jvm") version "1.9.24" // Do not update
id("com.gradle.plugin-publish") version "1.2.1"
id("org.jetbrains.dokka") version "1.9.20"
}
group = "xyz.srnyx"
version = "1.3.2"
description = "A Gradle plugin to simplify the process of creating projects"
val projectId: String = "gradle-galaxy"
val vcs: String = "github.com/srnyx/$projectId"
val includeJavadocsSources: Boolean = true
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
implementation(gradleApi())
implementation(kotlin("stdlib-jdk8"))
// Plugins
compileOnly("com.github.jengelman.gradle.plugins", "shadow", "6.1.0")
}
// Set Kotlin JVM version
kotlin.jvmToolchain(8)
// Set Java version, text encoding, & docs/sources jar task dependencies
tasks.withType<JavaCompile> {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
options.encoding = "UTF-8"
if (includeJavadocsSources) {
dependsOn("javadocJar")
dependsOn("sourcesJar")
}
}
// Add docs and sources jars
if (includeJavadocsSources) sourceSets {
tasks.register("javadocJar", Jar::class) {
group = "build"
description = "Assembles a jar archive containing the javadoc files"
val dokkaTask = tasks.getByName("dokkaHtml")
dependsOn(dokkaTask)
from(dokkaTask)
archiveClassifier.set("javadoc")
}
tasks.register("sourcesJar", Jar::class) {
group = "build"
description = "Assembles a jar archive containing the sources"
from(sourceSets["main"].allSource.srcDirs)
archiveClassifier.set("sources")
}
}
@Suppress("UnstableApiUsage")
gradlePlugin {
isAutomatedPublishing = true
website.set("https://${vcs}")
vcsUrl.set("https://${vcs}")
plugins.create(projectId) {
id = "${project.group}.$projectId"
implementationClass = "${project.group}.gradlegalaxy.GradleGalaxy"
version = project.version
displayName = project.name
description = project.description
tags.set(listOf("srnyx", "minecraft", "spigot"))
}
}
publishing.publications.create<MavenPublication>("pluginMaven") {
artifactId = projectId
pom {
name.set(project.name)
description.set(project.description)
url.set("https://${vcs}")
packaging = "jar"
licenses {
license {
name.set("MIT License")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("srnyx")
url.set("https://srnyx.com")
email.set("[email protected]")
timezone.set("America/New_York")
organization.set("Venox Network")
organizationUrl.set("https://venox.network")
}
developer {
id.set("dkim19375")
timezone.set("America/New_York")
roles.add("contributor")
}
}
scm {
connection.set("scm:git:git://${vcs}.git")
developerConnection.set("scm:git:ssh://${vcs}.git")
url.set("https://${vcs}")
}
}
}