mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2024-12-25 17:08:27 +01:00
Buildscript improvements
This commit is contained in:
parent
a00b6b9b60
commit
86da2f7a16
@ -2,14 +2,13 @@ apply from: rootProject.file('buildscript/relocations.gradle')
|
||||
|
||||
dependencies {
|
||||
// Annotations
|
||||
compileOnlyApi 'org.jetbrains:annotations:21.0.1'
|
||||
compileOnlyApi 'com.google.code.findbugs:jsr305:3.0.2'
|
||||
compileOnlyApi 'org.jetbrains:annotations:22.0.0'
|
||||
api 'com.google.code.findbugs:jsr305:3.0.2'
|
||||
|
||||
// JDA
|
||||
api('net.dv8tion:JDA:' + rootProject.jdaVersion) {
|
||||
// Annotations are suppose to be compile time only
|
||||
exclude group: 'org.jetbrains', module: 'annotations'
|
||||
exclude group: 'com.google.code.findbugs', module: 'jsr305'
|
||||
|
||||
// We don't use audio
|
||||
exclude module: 'opus-java'
|
||||
|
21
build.gradle
21
build.gradle
@ -1,5 +1,3 @@
|
||||
import dev.vankka.dependencydownload.task.GenerateDependencyDownloadResourceTask
|
||||
|
||||
plugins {
|
||||
id 'com.github.johnrengelman.shadow' version '7.0.0' apply false
|
||||
id 'org.cadixdev.licenser' version '0.6.0' apply false
|
||||
@ -45,21 +43,15 @@ allprojects {
|
||||
configurations {
|
||||
runtimeDownloadApi
|
||||
compileOnlyApi.extendsFrom runtimeDownloadApi
|
||||
runtimeDownloadOnly.extendsFrom runtimeDownloadApi
|
||||
}
|
||||
|
||||
ext {
|
||||
dependenciesDirectory = new File(sourceSets.main.output.resourcesDir, 'dependencies')
|
||||
}
|
||||
|
||||
task generateResourceForRuntimeDownloadApi(type: GenerateDependencyDownloadResourceTask) {
|
||||
configuration = configurations.runtimeDownloadApi
|
||||
fileLocation = new File(dependenciesDirectory, 'runtimeDownloadApi-' + project.name + '.txt')
|
||||
}
|
||||
generateRuntimeDownloadResourceForRuntimeDownload {
|
||||
fileLocation = new File(dependenciesDirectory, 'runtimeDownload-' + project.name + '.txt')
|
||||
}
|
||||
generateRuntimeDownloadResourceForRuntimeDownloadOnly {
|
||||
fileLocation = new File(dependenciesDirectory, 'runtimeDownloadOnly-' + project.name + '.txt')
|
||||
fileLocation = new File(dependenciesDirectory, 'runtimeDownload-' + project.name + '.txt')
|
||||
}
|
||||
|
||||
repositories {
|
||||
@ -76,8 +68,8 @@ allprojects {
|
||||
|
||||
dependencies {
|
||||
// Test dependencies
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
|
||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
|
||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
|
||||
}
|
||||
|
||||
test {
|
||||
@ -99,6 +91,9 @@ allprojects {
|
||||
}
|
||||
|
||||
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'
|
||||
@ -110,7 +105,7 @@ allprojects {
|
||||
gradle.projectsEvaluated {
|
||||
tasks.withType(JavaCompile) {
|
||||
// Enable compiler warnings for unchecked & deprecation
|
||||
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
|
||||
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,24 +2,47 @@
|
||||
|
||||
shadowJar {
|
||||
[
|
||||
// JDA
|
||||
// JDA, Trove, WS, okhttp
|
||||
'net.dv8tion.jda',
|
||||
'com.iwebpp',
|
||||
'gnu.trove',
|
||||
'com.neovisionaries.ws',
|
||||
'com.iwebpp',
|
||||
'okhttp3',
|
||||
'okio',
|
||||
|
||||
// DependencyDownload
|
||||
'dev.vankka.dependencydownload',
|
||||
'dev.vankka.mcdependencydownload',
|
||||
'me.lucko.jarrelocator',
|
||||
'org.objectweb.asm',
|
||||
// Other
|
||||
'org.apache.commons',
|
||||
|
||||
// Configurate, geantyref, yaml
|
||||
'org.spongepowered.configurate',
|
||||
'io.leangen.geantyref',
|
||||
'org.yaml.snakeyaml',
|
||||
|
||||
// Adventure, EnhancedLegacyText, MCDiscordReserializer
|
||||
'net.kyori',
|
||||
'dev.vankka.enhancedlegacytext',
|
||||
'dev.vankka.mcdiscordreserializer',
|
||||
'dev.vankka.simpleast',
|
||||
|
||||
// Caffeine
|
||||
'com.github.benmanes.caffeine',
|
||||
|
||||
// Commons
|
||||
'org.apache.commons',
|
||||
|
||||
// Checker Framework
|
||||
'org.checkerframework',
|
||||
|
||||
// Gson, Google error prone annotations
|
||||
'com.google.gson',
|
||||
'com.google.errorprone.annotations',
|
||||
|
||||
// Webhooks
|
||||
'club.minnced',
|
||||
'org.json',
|
||||
].each {
|
||||
relocate it, 'com.discordsrv.dependencies.' + it
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
apply from: rootProject.file('buildscript/relocations.gradle')
|
||||
|
||||
jar {
|
||||
dependsOn generateResourceForRuntimeDownloadApi
|
||||
dependsOn generateRuntimeDownloadResourceForRuntimeDownloadOnly
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
|
@ -40,7 +40,7 @@ public class DiscordSRVBukkitBootstrap extends BukkitBootstrap {
|
||||
this.dependencies = new InitialDependencyLoader(
|
||||
logger,
|
||||
plugin.getDataFolder().toPath(),
|
||||
new String[] {"dependencies/runtimeDownloadApi-bukkit.txt"},
|
||||
new String[] {"dependencies/runtimeDownload-bukkit.txt"},
|
||||
getClasspathAppender()
|
||||
);
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class DiscordSRVBungeeBootstrap extends BungeeBootstrap {
|
||||
this.dependencies = new InitialDependencyLoader(
|
||||
logger,
|
||||
plugin.getDataFolder().toPath(),
|
||||
new String[] {"dependencies/runtimeDownloadApi-bungee.txt"},
|
||||
new String[] {"dependencies/runtimeDownload-bungee.txt"},
|
||||
getClasspathAppender()
|
||||
);
|
||||
}
|
||||
|
@ -58,7 +58,6 @@ dependencies {
|
||||
jar {
|
||||
dependsOn(
|
||||
generateRuntimeDownloadResourceForRuntimeDownloadOnly,
|
||||
generateResourceForRuntimeDownloadApi,
|
||||
generateResourceForH2Driver,
|
||||
generateResourceForMySQLDriver
|
||||
)
|
||||
|
@ -26,6 +26,7 @@ import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
@ -50,9 +51,8 @@ public class InitialDependencyLoader {
|
||||
false
|
||||
);
|
||||
|
||||
List<String> resourcePaths = new ArrayList<>(Arrays.asList(
|
||||
"dependencies/runtimeDownloadOnly-common.txt",
|
||||
"dependencies/runtimeDownloadApi-common.txt"
|
||||
List<String> resourcePaths = new ArrayList<>(Collections.singletonList(
|
||||
"dependencies/runtimeDownload-common.txt"
|
||||
));
|
||||
resourcePaths.addAll(Arrays.asList(dependencyResources));
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class DiscordSRVSpongeBootstrap extends AbstractBootstrap implements ISpo
|
||||
this.dependencies = new InitialDependencyLoader(
|
||||
logger,
|
||||
dataDirectory,
|
||||
new String[] {"dependencies/runtimeDownloadApi-sponge.txt"},
|
||||
new String[] {"dependencies/runtimeDownload-sponge.txt"},
|
||||
new JarInJarClasspathAppender(classLoader)
|
||||
);
|
||||
this.pluginContainer = pluginContainer;
|
||||
|
@ -58,7 +58,7 @@ public class DiscordSRVVelocityBootstrap {
|
||||
this.dependencies = new InitialDependencyLoader(
|
||||
this.logger,
|
||||
dataDirectory,
|
||||
new String[] {"dependencies/runtimeDownloadApi-velocity.txt"},
|
||||
new String[] {"dependencies/runtimeDownload-velocity.txt"},
|
||||
new VelocityClasspathAppender(this, proxyServer)
|
||||
);
|
||||
this.proxyServer = proxyServer;
|
||||
|
Loading…
Reference in New Issue
Block a user