import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
|
|
plugins {
|
|
idea
|
|
application
|
|
|
|
kotlin("jvm") version "1.7.20"
|
|
id("com.github.johnrengelman.shadow") version "7.1.2"
|
|
id("com.github.gmazzo.buildconfig") version "3.1.0"
|
|
}
|
|
|
|
val commit = runCommand(arrayListOf("git", "rev-parse", "HEAD"))
|
|
val changes = runCommand(arrayListOf("git", "diff", "--shortstat"))
|
|
|
|
group = "xyz.brettb.discord"
|
|
version = "${rootProject.findProperty("major")}.${rootProject.findProperty("minor")}.${rootProject.findProperty("patch")}"
|
|
|
|
application {
|
|
mainClass.set("xyz.brettb.discord.ieeevents.IEEEventsKt")
|
|
}
|
|
|
|
buildConfig {
|
|
packageName("xyz.brettb.discord.ieeevents")
|
|
className("IEEEventsBotInfo")
|
|
buildConfigField("String", "VERSION", "\"${version}\"")
|
|
buildConfigField("String", "COMMIT", "\"$commit\"")
|
|
buildConfigField("String", "LOCAL_CHANGES", "\"$changes\"")
|
|
buildConfigField("long", "BUILD_TIME", "${System.currentTimeMillis()}L")
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
|
|
maven {
|
|
name = "brettb-repo"
|
|
url = uri("https://repo.brettb.xyz")
|
|
}
|
|
|
|
maven("https://m2.dv8tion.net/releases") {
|
|
name = "m2-dv8tion"
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
listOf("stdlib-jdk8", "reflect").forEach { implementation(kotlin(it)) }
|
|
|
|
// Discord
|
|
implementation("net.dv8tion:JDA:4.4.0_350")
|
|
implementation("tech.junodevs.discord:kriess:0.14.0")
|
|
|
|
// Utilities
|
|
implementation("ch.qos.logback:logback-classic:1.4.4")
|
|
implementation("org.reflections:reflections:0.10.2")
|
|
implementation("com.squareup.okhttp3:okhttp:4.10.0")
|
|
|
|
// Calendar
|
|
implementation("org.mnode.ical4j:ical4j:3.2.6")
|
|
|
|
// Data
|
|
implementation("org.litote.kmongo:kmongo:4.7.2")
|
|
implementation("com.sksamuel.hoplite:hoplite-core:1.4.16")
|
|
implementation("com.sksamuel.hoplite:hoplite-yaml:1.4.16")
|
|
|
|
|
|
implementation(kotlin("stdlib-jdk8"))
|
|
}
|
|
|
|
tasks.test {
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
tasks.withType<KotlinCompile> {
|
|
kotlinOptions.jvmTarget = "1.8"
|
|
}
|
|
|
|
|
|
fun runCommand(commands: List<String>): String {
|
|
val stdout = org.apache.commons.io.output.ByteArrayOutputStream()
|
|
exec {
|
|
commandLine = commands
|
|
standardOutput = stdout
|
|
}
|
|
return stdout.toString("utf-8").trim()
|
|
}
|