mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2024-11-29 13:05:44 +01:00
194 lines
6.3 KiB
Groovy
194 lines
6.3 KiB
Groovy
plugins {
|
|
alias(libs.plugins.shadow) apply false
|
|
alias(libs.plugins.blossom) apply false
|
|
alias(libs.plugins.indra.git) apply false
|
|
alias(libs.plugins.indra.licenser) apply false
|
|
alias(libs.plugins.dependencydownload.plugin) apply false
|
|
alias(libs.plugins.idea.ext) apply false
|
|
alias(libs.plugins.run.paper) apply false
|
|
alias(libs.plugins.run.waterfall) apply false
|
|
alias(libs.plugins.run.velocity) apply false
|
|
}
|
|
|
|
version '3.0.0-SNAPSHOT'
|
|
|
|
subprojects {
|
|
apply plugin: 'java'
|
|
apply plugin: 'java-library'
|
|
apply plugin: 'idea'
|
|
apply plugin: 'io.github.goooler.shadow'
|
|
apply plugin: 'net.kyori.indra.git'
|
|
apply plugin: 'net.kyori.indra.licenser.spotless'
|
|
apply plugin: 'dev.vankka.dependencydownload.plugin'
|
|
|
|
group 'com.discordsrv'
|
|
version = rootProject.version
|
|
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
targetCompatibility = JavaVersion.VERSION_1_8
|
|
}
|
|
|
|
configurations {
|
|
// 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
|
|
|
|
// 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
|
|
|
|
// Create runtimeDownloadApi configuration (compileOnlyApi + runtimeDownloadOnly)
|
|
runtimeDownloadApi
|
|
compileOnlyApi.extendsFrom runtimeDownloadApi
|
|
runtimeDownloadOnly.extendsFrom runtimeDownloadApi
|
|
|
|
configureEach {
|
|
resolutionStrategy.failOnDynamicVersions()
|
|
}
|
|
}
|
|
|
|
generateRuntimeDownloadResourceForRuntimeDownloadOnly {
|
|
file = 'dependencies/runtimeDownload-' + project.name + '.txt'
|
|
includeShadowJarRelocations = false
|
|
}
|
|
|
|
repositories {
|
|
// Snapshot repositories
|
|
//maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
|
|
//mavenLocal()
|
|
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'
|
|
|
|
includeGroup 'org.spongepowered' // SpongePowered/Configurate feature/yaml-improvements branch
|
|
includeGroup 'net.dv8tion' // DiscordSRV/JDA v5-webhooks branch
|
|
}
|
|
}
|
|
maven {
|
|
url 'https://libraries.minecraft.net'
|
|
content {
|
|
includeGroup 'com.mojang'
|
|
}
|
|
}
|
|
|
|
// Get dependencies from central last, everything else should be filtered
|
|
mavenCentral()
|
|
}
|
|
|
|
var generatedSources = sourceSets.main.output.generatedSourcesDirs
|
|
idea {
|
|
module {
|
|
generatedSources.forEach {
|
|
generatedSourceDirs.plus(it)
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
// Test dependencies
|
|
testImplementation(libs.junit.jupiter)
|
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
|
|
|
// DynamicProxy
|
|
annotationProcessor(libs.dynamicproxy.api)
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
|
|
testLogging {
|
|
exceptionFormat = 'full'
|
|
}
|
|
}
|
|
|
|
tasks.register('deleteJarsDir', 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' ? spotlessCheck : spotlessApply)
|
|
// 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
|
|
)
|
|
}
|
|
|
|
manifest.attributes(
|
|
'Build-Time': new Date().toString()
|
|
)
|
|
if (indraGit.isPresent()) {
|
|
indraGit.applyVcsInformationToManifest(manifest)
|
|
if (rootProject.version.endsWith("-SNAPSHOT")) {
|
|
var gitHash = indraGit.commit().getName()
|
|
if (gitHash.length() > 7) {
|
|
gitHash = gitHash.substring(0, 7)
|
|
}
|
|
archiveClassifier = gitHash
|
|
}
|
|
}
|
|
}
|
|
|
|
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
|
|
// Disable compiler warning for source/target 8
|
|
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation' << '-Xlint:-options'
|
|
}
|
|
}
|
|
|
|
processResources {
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
}
|
|
|
|
indraSpotlessLicenser {
|
|
licenseHeaderFile(rootProject.file('buildscript/license/LICENSE_HEADER'))
|
|
newLine(true)
|
|
property('inception', '2016')
|
|
property('year_now', String.valueOf(Calendar.getInstance().get(Calendar.YEAR)))
|
|
}
|
|
}
|