mirror of
https://github.com/sciwhiz12/Janitor.git
synced 2024-11-10 02:21:25 +00:00
72 lines
2.1 KiB
Groovy
72 lines
2.1 KiB
Groovy
buildscript {
|
|
repositories {
|
|
jcenter()
|
|
mavenCentral()
|
|
}
|
|
dependencies {
|
|
classpath group: 'org.ajoberstar.grgit', name: 'grgit-gradle', version: grgit_version
|
|
classpath group: 'com.github.jengelman.gradle.plugins', name: 'shadow', version: shadow_version
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
jcenter()
|
|
}
|
|
|
|
apply plugin: 'com.github.johnrengelman.shadow'
|
|
apply plugin: 'org.ajoberstar.grgit'
|
|
apply plugin: 'idea'
|
|
apply plugin: 'java'
|
|
apply plugin: 'application'
|
|
apply plugin: 'maven-publish'
|
|
|
|
group = 'sciwhiz12.janitor'
|
|
archivesBaseName = 'janitor_bot'
|
|
version = getVersion()
|
|
println("Version: ${version}")
|
|
|
|
shadowJar {
|
|
configurations = [project.configurations.implementation]
|
|
}
|
|
|
|
dependencies {
|
|
implementation "net.dv8tion:JDA:${jda_version}"
|
|
implementation "com.electronwill.night-config:toml:${nightconfig_version}"
|
|
implementation "net.sf.jopt-simple:jopt-simple:${jopt_version}"
|
|
implementation "com.google.guava:guava:${guava_version}"
|
|
implementation "com.google.code.gson:gson:${gson_version}"
|
|
implementation "org.apache.logging.log4j:log4j-api:${log4j_version}"
|
|
implementation "org.apache.logging.log4j:log4j-core:${log4j_version}"
|
|
implementation "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_version}"
|
|
|
|
testImplementation "junit:junit:${junit_version}"
|
|
}
|
|
|
|
application {
|
|
mainClassName = 'sciwhiz12.janitor.JanitorBot'
|
|
}
|
|
|
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
from sourceSets.main.allSource
|
|
classifier "sources"
|
|
}
|
|
jar.finalizedBy('sourcesJar')
|
|
jar.finalizedBy('shadowJar')
|
|
|
|
def getVersion() {
|
|
try {
|
|
def raw_version = grgit.describe(longDescr: true, tags: true)
|
|
def versionSep = raw_version.split "-"
|
|
def startVer = versionSep[0].substring(1)
|
|
return startVer + "." + versionSep[1]
|
|
} catch (Exception e) {
|
|
def ver = 'unknown'
|
|
if (System.getenv("GITHUB_RUN_NUMBER") != null) ver = System.getenv("GITHUB_RUN_NUMBER")
|
|
logger.error("Error getting version information, defaulting to '${ver}': {}", e.getMessage())
|
|
return ver
|
|
}
|
|
}
|
|
|
|
|