Ascension/build.gradle
2022-04-01 18:30:42 +03:00

150 lines
4.5 KiB
Groovy

plugins {
id 'com.github.johnrengelman.shadow' version '7.1.1' apply false
id 'org.cadixdev.licenser' version '0.6.1' apply false
id 'net.kyori.blossom' version '1.2.0' apply false
id 'net.kyori.indra.git' version '2.1.1' apply false
id 'dev.vankka.dependencydownload.plugin' version '1.1.5-SNAPSHOT' apply false
}
version '2.0.0-SNAPSHOT'
ext {
// DependencyDownload (change plugin version above)
ddVersion = '1.2.2-SNAPSHOT'
// MinecraftDependencyDownload
mddVersion = '1.0.0-SNAPSHOT'
// JDA
jdaVersion = '5.0.0-alpha.9'
// Configurate
configurateVersion = '4.1.2'
// Adventure & Adventure Platform
adventureVersion = '4.10.0'
adventurePlatformVersion = '4.1.0'
}
allprojects {
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'org.cadixdev.licenser'
apply plugin: 'net.kyori.indra.git'
apply plugin: 'dev.vankka.dependencydownload.plugin'
group 'com.discordsrv'
version = rootProject.version
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
configurations {
runtimeDownloadApi
compileOnlyApi.extendsFrom runtimeDownloadApi
runtimeDownloadOnly.extendsFrom runtimeDownloadApi
}
generateRuntimeDownloadResourceForRuntimeDownloadOnly {
file = 'dependencies/runtimeDownload-' + project.name + '.txt'
}
repositories {
// Snapshot repositories
//maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
//mavenLocal()
maven {
url 'https://nexus.scarsz.me/content/groups/public/'
content {
includeGroup 'github.scarsz'
includeGroup 'me.scarsz'
}
}
maven {
url 'https://libraries.minecraft.net'
content {
includeGroup 'com.mojang'
}
}
// Get dependencies from central last, everything else should be filtered
mavenCentral()
}
dependencies {
// Test dependencies
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
}
test {
useJUnitPlatform()
}
task deleteJarsDir(type: Delete) {
delete rootProject.file('jars')
}
clean.dependsOn deleteJarsDir
defaultTasks 'build'
jar {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
// If CI then check that licenses are correct, otherwise automatically apply licenses on build
dependsOn (System.getenv('CI') === 'true' ? licenseCheck : licenseFormat)
// Always run shadowJar
finalizedBy shadowJar
manifest.attributes(
"Specification-Title": "DiscordSRV",
"Specification-Vendor": "DiscordSRV",
"Specification-Version": project.version
)
if (project.name != "api") {
manifest.attributes(
"Implementation-Title": "DiscordSRV",
"Implementation-Vendor": "DiscordSRV",
"Implementation-Version": project.version
)
}
if (indraGit.isPresent()) {
indraGit.applyVcsInformationToManifest(manifest)
}
}
shadowJar {
// Merge META-INF/services files where needed
mergeServiceFiles()
// Exclude signatures, maven/ and proguard/ from META-INF
exclude 'META-INF/*.SF'
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.RSA'
exclude 'META-INF/maven/**'
exclude 'META-INF/proguard/**'
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
// Enable compiler warnings for unchecked & deprecation
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
}
}
processResources {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
license {
header = rootProject.file('buildscript/license/LICENSE_HEADER')
properties {
var inception = '2016'
var currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR))
year = inception == currentYear ? currentYear : inception + '-' + currentYear
}
include '**/*.java' // only java files
}
}