1
0
mirror of https://github.com/sciwhiz12/Janitor.git synced 2024-11-09 22:51:26 +00:00
Janitor/build.gradle

155 lines
4.4 KiB
Groovy
Raw Normal View History

2020-08-31 18:15:21 +00:00
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
}
}
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'org.ajoberstar.grgit'
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'maven-publish'
version = getVersion()
println("Version: ${version}")
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
2020-11-17 17:18:30 +00:00
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
2020-08-31 18:15:21 +00:00
dependencies {
implementation project(':core')
implementation project(path: ':core', configuration: 'api')
runtimeOnly project(':moderation')
runtimeOnly project(path: ':moderation', configuration: 'api')
2020-08-31 18:15:21 +00:00
}
application {
2020-10-16 10:45:34 +00:00
mainClassName = 'sciwhiz12.janitor.BotStartup'
2020-08-31 18:15:21 +00:00
}
jar.finalizedBy 'shadowJar'
shadowJar {
exclude 'META-INF/NOTICE**'
exclude 'META-INF/LICENSE**'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/proguard/**'
exclude 'META-INF/maven/**'
classifier ''
includeEmptyDirs false
}
allprojects {
apply plugin: 'java'
group = 'sciwhiz12.janitor'
version = rootProject.version
repositories {
mavenCentral()
jcenter()
maven {
name = "Minecraft Libraries"
url = "https://libraries.minecraft.net"
}
}
}
subprojects {
sourceSets { api }
configurations {
apiImplementation.extendsFrom apiDependency
api {
canBeConsumed = true
canBeResolved = true
extendsFrom apiDependency
}
implementation.extendsFrom apiImplementation, api
'default' {
extendsFrom api, apiDependency
}
}
dependencies {
api sourceSets.api.output
testImplementation group: 'junit', name: 'junit', version: junit_version
}
jar {
from sourceSets.api.output
finalizedBy 'apiJar', 'sourcesJar'
}
task apiJar(type: Jar, dependsOn: apiClasses) {
from sourceSets.api.allJava
classifier "api"
}
task sourcesJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
from sourceSets.api.allSource
classifier "sources"
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}
project(':core') {
apply plugin: 'com.github.johnrengelman.shadow'
archivesBaseName = 'janitor-core'
dependencies {
apiDependency group: 'net.dv8tion', name: 'JDA', version: jda_version
apiDependency group: 'com.electronwill.night-config', name: 'toml', version: nightconfig_version
apiDependency group: 'net.sf.jopt-simple', name: 'jopt-simple', version: jopt_version
apiDependency group: 'com.google.guava', name: 'guava', version: guava_version
apiDependency group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: jackson_version
apiDependency group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: jackson_version
apiDependency group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: jackson_version
apiDependency group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: log4j_bridge_version
apiDependency group: 'ch.qos.logback', name: 'logback-classic', version: logback_version
apiDependency group: 'com.mojang', name: 'brigadier', version: brigadier_version
}
shadowJar.configurations = [project.configurations.api]
jar.finalizedBy 'shadowJar'
}
project(':moderation') {
archivesBaseName = 'janitor-moderation'
2020-08-31 18:15:21 +00:00
dependencies {
apiDependency project(path: ':core', configuration: 'api')
}
2020-08-31 18:15:21 +00:00
}
def getVersion() {
try {
String raw_version = grgit.describe(longDescr: true, tags: true)
2020-08-31 18:15:21 +00:00
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
}
}