This repository has been archived by the owner on Jul 21, 2021. It is now read-only.
generated from Kord-Extensions/template-module
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
154 lines (118 loc) · 3.69 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
import de.undercouch.gradle.tasks.download.Download
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
repositories {
maven {
name = "KotDis"
url = uri("https://maven.kotlindiscord.com/repository/maven-public/")
}
}
}
// Load properties
val moduleGroup: String by project
val moduleVersion: String by project
val detektVersion: String by project
val kordExVersion: String by project
val kotlinVersion: String by project
val linkieVersion: String by project
plugins {
`maven-publish`
id("io.gitlab.arturbosch.detekt")
id("de.undercouch.download")
kotlin("jvm")
}
repositories {
maven {
name = "KotDis"
url = uri("https://maven.kotlindiscord.com/repository/maven-public/")
}
maven {
name = "FabricMC"
url = uri("https://maven.fabricmc.net/")
}
maven {
name = "Bintray (Linkie)"
url = uri("https://dl.bintray.com/shedaniel/linkie")
}
maven {
name = "JitPack"
url = uri("https://jitpack.io")
}
}
dependencies {
// Linkie
api("me.shedaniel:linkie-core:$linkieVersion")
// Linting
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion")
// Configuration
implementation("com.uchuhimo:konf:0.23.0")
implementation("com.uchuhimo:konf-toml:0.23.0")
// KordEx
implementation("com.kotlindiscord.kord.extensions:kord-extensions:$kordExVersion")
// Logging
implementation("io.github.microutils:kotlin-logging:2.0.3")
// Kotlin libs
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2")
}
/**
* You probably don't want to touch anything below this line. It contains mostly boilerplate, and expands variables
* from the gradle.properties file.
*/
group = "com.kotlindiscord.kordex.$moduleGroup"
version = moduleVersion
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
val sourceJar = task("sourceJar", Jar::class) {
dependsOn(tasks["classes"])
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}
val downloadDetektConfig = task("downloadDetektConfig", Download::class) {
src("https://github.com/Kord-Extensions/kord-extensions/raw/root/kord-extensions/detekt.yml")
dest(projectDir)
onlyIfModified(true)
}
val printVersion = task("printVersion") {
logger.quiet(version.toString())
}
downloadDetektConfig.download()
detekt {
buildUponDefaultConfig = true
config = rootProject.files("detekt.yml")
}
tasks.build {
this.finalizedBy(sourceJar)
}
publishing {
repositories {
maven {
name = "KotDis"
url = if (version.toString().contains("SNAPSHOT")) {
uri("https://maven.kotlindiscord.com/repository/maven-snapshots/")
} else {
uri("https://maven.kotlindiscord.com/repository/maven-releases/")
}
credentials {
username = project.findProperty("kotdis.user") as String?
?: System.getenv("KOTLIN_DISCORD_USER")
password = project.findProperty("kotdis.password") as String?
?: System.getenv("KOTLIN_DISCORD_PASSWORD")
}
version = version
}
}
publications {
create<MavenPublication>("maven") {
from(components.getByName("java"))
artifact(sourceJar)
}
}
}