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.blossom) apply false
|
|
|
|
alias(libs.plugins.indra.git) apply false
|
2024-06-23 15:58:27 +02:00
|
|
|
alias(libs.plugins.indra.licenser) apply false
|
2022-04-22 19:56:11 +02:00
|
|
|
alias(libs.plugins.dependencydownload.plugin) apply false
|
2024-06-23 15:26:15 +02:00
|
|
|
alias(libs.plugins.idea.ext) apply false
|
2024-10-20 21:59:19 +02:00
|
|
|
alias(libs.plugins.run.paper) apply false
|
|
|
|
alias(libs.plugins.run.waterfall) apply false
|
|
|
|
alias(libs.plugins.run.velocity) 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
|
|
|
|
2022-06-25 21:33:55 +02:00
|
|
|
subprojects {
|
2021-07-29 03:14:29 +02:00
|
|
|
apply plugin: 'java'
|
|
|
|
apply plugin: 'java-library'
|
2023-02-20 20:55:45 +01:00
|
|
|
apply plugin: 'idea'
|
2024-06-23 15:26:15 +02:00
|
|
|
apply plugin: 'io.github.goooler.shadow'
|
2022-03-27 18:48:09 +02:00
|
|
|
apply plugin: 'net.kyori.indra.git'
|
2024-06-23 15:58:27 +02:00
|
|
|
apply plugin: 'net.kyori.indra.licenser.spotless'
|
2021-07-29 03:14:29 +02:00
|
|
|
apply plugin: 'dev.vankka.dependencydownload.plugin'
|
|
|
|
|
|
|
|
group 'com.discordsrv'
|
2023-12-23 00:04:39 +01:00
|
|
|
version = rootProject.version
|
2021-07-29 03:14:29 +02:00
|
|
|
|
|
|
|
java {
|
|
|
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
|
|
targetCompatibility = JavaVersion.VERSION_1_8
|
|
|
|
}
|
|
|
|
|
|
|
|
configurations {
|
2023-07-11 18:50:19 +02:00
|
|
|
// Exclude dependencies from being included in jars
|
|
|
|
runtimeExclude {
|
|
|
|
// Annotations are suppose to be compile time only
|
|
|
|
exclude group: 'org.jetbrains', module: 'annotations'
|
|
|
|
exclude group: 'com.google.code.findbugs', module: 'jsr305'
|
|
|
|
exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
|
|
|
|
}
|
|
|
|
runtimeClasspath.extendsFrom runtimeExclude
|
|
|
|
runtimeDownloadOnly.extendsFrom runtimeExclude
|
|
|
|
|
2024-07-07 12:29:01 +02:00
|
|
|
// Exclude dependencies at compile time
|
|
|
|
compileExclude {
|
|
|
|
// Stuff we aren't using but is included with dependencies
|
|
|
|
exclude group: 'org.checkerframework', module: 'checker-qual'
|
|
|
|
exclude group: 'com.google.code.findbugs', module: 'jsr305'
|
|
|
|
exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
|
|
|
|
}
|
|
|
|
compileClasspath.extendsFrom compileExclude
|
|
|
|
|
2023-07-11 18:50:19 +02:00
|
|
|
// Create runtimeDownloadApi configuration (compileOnlyApi + runtimeDownloadOnly)
|
2021-07-29 03:14:29 +02:00
|
|
|
runtimeDownloadApi
|
|
|
|
compileOnlyApi.extendsFrom runtimeDownloadApi
|
2021-10-19 22:17:30 +02:00
|
|
|
runtimeDownloadOnly.extendsFrom runtimeDownloadApi
|
2022-04-22 19:56:11 +02:00
|
|
|
|
2023-02-20 20:55:45 +01:00
|
|
|
configureEach {
|
2022-04-22 19:56:11 +02:00
|
|
|
resolutionStrategy.failOnDynamicVersions()
|
|
|
|
}
|
2021-07-29 03:14:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
generateRuntimeDownloadResourceForRuntimeDownloadOnly {
|
2021-10-23 01:20:15 +02:00
|
|
|
file = 'dependencies/runtimeDownload-' + project.name + '.txt'
|
2023-04-30 18:28:11 +02:00
|
|
|
includeShadowJarRelocations = false
|
2021-07-29 03:14:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
// Snapshot repositories
|
2022-02-03 20:43:03 +01:00
|
|
|
//maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
|
2022-08-22 17:46:12 +02:00
|
|
|
//mavenLocal()
|
2021-07-29 03:14:29 +02:00
|
|
|
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
|
|
|
|
|
2022-02-03 20:43:03 +01:00
|
|
|
maven {
|
|
|
|
url 'https://nexus.scarsz.me/content/groups/public/'
|
|
|
|
content {
|
|
|
|
includeGroup 'github.scarsz'
|
|
|
|
includeGroup 'me.scarsz'
|
2022-05-11 18:09:41 +02:00
|
|
|
includeGroup 'me.minecraftauth'
|
2023-05-20 20:05:10 +02:00
|
|
|
|
2023-06-18 13:00:02 +02:00
|
|
|
includeGroup 'org.spongepowered' // SpongePowered/Configurate feature/yaml-improvements branch
|
|
|
|
includeGroup 'net.dv8tion' // DiscordSRV/JDA v5-webhooks branch
|
2022-02-03 20:43:03 +01:00
|
|
|
}
|
|
|
|
}
|
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
|
|
|
|
2022-02-03 20:43:03 +01:00
|
|
|
// Get dependencies from central last, everything else should be filtered
|
2021-07-29 03:14:29 +02:00
|
|
|
mavenCentral()
|
|
|
|
}
|
|
|
|
|
2023-02-20 20:55:45 +01:00
|
|
|
var generatedSources = sourceSets.main.output.generatedSourcesDirs
|
|
|
|
idea {
|
|
|
|
module {
|
|
|
|
generatedSources.forEach {
|
|
|
|
generatedSourceDirs.plus(it)
|
2022-06-25 21:33:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-29 03:14:29 +02:00
|
|
|
dependencies {
|
|
|
|
// Test dependencies
|
2024-06-23 15:58:27 +02:00
|
|
|
testImplementation(libs.junit.jupiter)
|
|
|
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
2022-06-25 21:33:55 +02:00
|
|
|
|
|
|
|
// DynamicProxy
|
2023-10-15 22:23:32 +02:00
|
|
|
annotationProcessor(libs.dynamicproxy.api)
|
2021-07-29 03:14:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
test {
|
2024-06-23 15:58:27 +02:00
|
|
|
useJUnitPlatform()
|
|
|
|
|
2024-06-20 22:57:14 +02:00
|
|
|
testLogging {
|
|
|
|
exceptionFormat = 'full'
|
|
|
|
}
|
2021-07-29 03:14:29 +02:00
|
|
|
}
|
|
|
|
|
2023-02-20 20:55:45 +01:00
|
|
|
tasks.register('deleteJarsDir', Delete) {
|
2021-07-29 03:14:29 +02:00
|
|
|
delete rootProject.file('jars')
|
|
|
|
}
|
|
|
|
clean.dependsOn deleteJarsDir
|
|
|
|
|
2022-01-13 17:57:26 +01:00
|
|
|
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
|
2024-06-23 15:58:27 +02:00
|
|
|
dependsOn (System.getenv('CI') === 'true' ? spotlessCheck : spotlessApply)
|
2021-07-29 03:14:29 +02:00
|
|
|
// 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
|
|
|
)
|
|
|
|
}
|
2022-12-27 22:56:21 +01:00
|
|
|
|
|
|
|
manifest.attributes(
|
|
|
|
'Build-Time': new Date().toString()
|
|
|
|
)
|
2022-03-27 18:48:09 +02:00
|
|
|
if (indraGit.isPresent()) {
|
|
|
|
indraGit.applyVcsInformationToManifest(manifest)
|
2023-12-23 00:04:39 +01:00
|
|
|
if (rootProject.version.endsWith("-SNAPSHOT")) {
|
|
|
|
var gitHash = indraGit.commit().getName()
|
|
|
|
if (gitHash.length() > 7) {
|
2024-07-07 12:29:01 +02:00
|
|
|
gitHash = gitHash.substring(0, 7)
|
2023-12-23 00:04:39 +01:00
|
|
|
}
|
|
|
|
archiveClassifier = gitHash
|
|
|
|
}
|
2022-03-27 18:48:09 +02:00
|
|
|
}
|
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
|
2024-06-23 15:29:04 +02:00
|
|
|
// Disable compiler warning for source/target 8
|
|
|
|
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation' << '-Xlint:-options'
|
2021-07-29 03:14:29 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
processResources {
|
|
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
|
|
}
|
|
|
|
|
2024-06-23 15:58:27 +02:00
|
|
|
indraSpotlessLicenser {
|
|
|
|
licenseHeaderFile(rootProject.file('buildscript/license/LICENSE_HEADER'))
|
|
|
|
newLine(true)
|
|
|
|
property('inception', '2016')
|
|
|
|
property('year_now', String.valueOf(Calendar.getInstance().get(Calendar.YEAR)))
|
2024-06-23 15:26:15 +02:00
|
|
|
}
|
2021-07-29 03:14:29 +02:00
|
|
|
}
|