Ascension/build.gradle

159 lines
4.5 KiB
Groovy
Raw Normal View History

2021-07-29 03:14:29 +02:00
plugins {
2022-04-22 19:56:11 +02:00
alias(libs.plugins.shadow) apply false
alias(libs.plugins.licenser) apply false
alias(libs.plugins.blossom) apply false
alias(libs.plugins.indra.git) apply false
alias(libs.plugins.dependencydownload.plugin) apply false
2021-07-29 03:14:29 +02:00
}
2022-12-31 15:01:04 +01:00
version '3.0.0-SNAPSHOT'
2021-07-29 03:14:29 +02:00
subprojects {
2021-07-29 03:14:29 +02:00
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'idea'
2021-07-29 03:14:29 +02:00
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'org.cadixdev.licenser'
2022-03-27 18:48:09 +02:00
apply plugin: 'net.kyori.indra.git'
2021-07-29 03:14:29 +02:00
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
2021-10-19 22:17:30 +02:00
runtimeDownloadOnly.extendsFrom runtimeDownloadApi
2022-04-22 19:56:11 +02:00
configureEach {
2022-04-22 19:56:11 +02:00
resolutionStrategy.failOnDynamicVersions()
}
2021-07-29 03:14:29 +02:00
}
generateRuntimeDownloadResourceForRuntimeDownloadOnly {
file = 'dependencies/runtimeDownload-' + project.name + '.txt'
2021-07-29 03:14:29 +02:00
}
repositories {
// Snapshot repositories
//maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
//mavenLocal()
2021-07-29 03:14:29 +02:00
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
maven {
url 'https://nexus.scarsz.me/content/groups/public/'
content {
includeGroup 'github.scarsz'
includeGroup 'me.scarsz'
includeGroup 'me.minecraftauth'
}
}
2022-03-20 12:46:06 +01:00
maven {
url 'https://libraries.minecraft.net'
content {
includeGroup 'com.mojang'
}
}
2021-07-29 03:14:29 +02:00
// Get dependencies from central last, everything else should be filtered
2021-07-29 03:14:29 +02:00
mavenCentral()
}
var generatedSources = sourceSets.main.output.generatedSourcesDirs
idea {
module {
generatedSources.forEach {
generatedSourceDirs.plus(it)
}
}
}
2021-07-29 03:14:29 +02:00
dependencies {
// Test dependencies
2022-04-22 19:56:11 +02:00
testImplementation(libs.jupiter.api)
testRuntimeOnly(libs.jupiter.engine)
// DynamicProxy
annotationProcessor(libs.dynamicproxy)
2021-07-29 03:14:29 +02:00
}
test {
useJUnitPlatform()
}
tasks.register('deleteJarsDir', Delete) {
2021-07-29 03:14:29 +02:00
delete rootProject.file('jars')
}
clean.dependsOn deleteJarsDir
defaultTasks 'build'
2021-07-29 03:14:29 +02:00
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
2022-03-27 18:48:09 +02:00
2022-03-27 18:52:24 +02:00
manifest.attributes(
2022-04-22 19:56:11 +02:00
'Specification-Title': 'DiscordSRV',
'Specification-Vendor': 'DiscordSRV',
'Specification-Version': project.version
2022-03-27 18:52:24 +02:00
)
if (project.name != "api") {
manifest.attributes(
2022-04-22 19:56:11 +02:00
'Implementation-Title': 'DiscordSRV',
'Implementation-Vendor': 'DiscordSRV',
'Implementation-Version': project.version
2022-03-27 18:52:24 +02:00
)
}
manifest.attributes(
'Build-Time': new Date().toString()
)
2022-03-27 18:48:09 +02:00
if (indraGit.isPresent()) {
indraGit.applyVcsInformationToManifest(manifest)
}
2021-07-29 03:14:29 +02:00
}
shadowJar {
2021-10-19 22:17:30 +02:00
// Merge META-INF/services files where needed
mergeServiceFiles()
2021-07-29 03:14:29 +02:00
// 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
2021-10-19 22:17:30 +02:00
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
2021-07-29 03:14:29 +02:00
}
}
processResources {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
license {
header = rootProject.file('buildscript/license/LICENSE_HEADER')
properties {
var inception = '2016'
2022-01-13 18:05:36 +01:00
var currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR))
2021-07-29 03:14:29 +02:00
year = inception == currentYear ? currentYear : inception + '-' + currentYear
}
include '**/*.java' // only java files
}
}