Multiverse-Core/build.gradle

304 lines
8.5 KiB
Groovy
Raw Normal View History

2023-02-02 23:07:51 +01:00
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'java-library'
id 'maven-publish'
id 'checkstyle'
id 'com.github.johnrengelman.shadow' version '7.1.2'
2023-03-02 08:07:38 +01:00
id "org.jetbrains.kotlin.jvm" version "1.8.10"
2023-02-02 23:07:51 +01:00
}
2023-02-20 06:04:43 +01:00
version = System.getenv('GITHUB_VERSION') ?: 'local'
2023-02-02 23:07:51 +01:00
group = 'com.onarandombox.multiversecore'
description = 'Multiverse-Core'
2023-03-02 08:07:38 +01:00
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
2023-03-02 08:07:38 +01:00
}
}
2023-02-02 23:07:51 +01:00
repositories {
mavenLocal()
mavenCentral()
2023-02-02 23:07:51 +01:00
maven {
url = uri('https://hub.spigotmc.org/nexus/content/repositories/snapshots/')
}
maven {
url = uri('https://repo.onarandombox.com/content/groups/public')
}
maven {
url = uri('https://hub.spigotmc.org/nexus/content/groups/public/')
}
maven {
url = uri('https://jitpack.io')
}
maven {
url = uri('https://repo.minebench.de/')
}
maven {
url = uri('https://repo.maven.apache.org/maven2/')
}
2023-02-20 13:29:08 +01:00
maven {
name = 'aikar repo'
url = uri('https://repo.aikar.co/content/groups/aikar/')
}
maven {
name = 'glaremasters repo'
url = 'https://repo.glaremasters.me/repository/towny/'
}
maven {
name = 'PlaceholderAPI'
url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
}
2023-02-02 23:07:51 +01:00
}
2023-03-02 07:20:38 +01:00
configurations {
oldTestImplementation.extendsFrom implementation
oldTestRuntime.extendsFrom runtime
relocatedApi
compileClasspath.extendsFrom relocatedApi
runtimeClasspath.extendsFrom relocatedApi
testCompileClasspath.extendsFrom relocatedApi
testRuntimeClasspath.extendsFrom relocatedApi
oldTestCompileClasspath.extendsFrom relocatedApi
oldTestRuntimeClasspath.extendsFrom relocatedApi
2023-02-02 23:07:51 +01:00
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
2023-02-02 23:07:51 +01:00
2023-02-20 13:29:08 +01:00
// Economy
implementation('com.github.MilkBowl:VaultAPI:1.7.1') {
2023-02-02 23:07:51 +01:00
exclude group: 'org.bukkit', module: 'bukkit'
}
// PlaceholderAPI
2023-06-28 13:37:36 +02:00
implementation 'me.clip:placeholderapi:2.11.3'
2023-02-20 13:29:08 +01:00
// Command Framework
relocatedApi 'co.aikar:acf-paper:0.5.1-SNAPSHOT'
2023-02-20 13:29:08 +01:00
// Config
relocatedApi('me.main__.util:SerializationConfig:1.7') {
2023-02-02 23:07:51 +01:00
exclude group: 'org.bukkit', module: 'bukkit'
}
relocatedApi('io.github.townyadvanced.commentedconfiguration:CommentedConfiguration:1.0.1') {
2023-02-20 13:29:08 +01:00
exclude group: 'org.spigotmc', module: 'spigot-api'
2023-02-02 23:07:51 +01:00
}
2023-02-20 13:29:08 +01:00
// Utils
relocatedApi 'io.vavr:vavr:0.10.4'
relocatedApi 'org.glassfish.hk2:hk2-locator:3.0.3'
relocatedApi('com.dumptruckman.minecraft:Logging:1.1.1') {
2023-02-02 23:07:51 +01:00
exclude group: 'junit', module: 'junit'
}
relocatedApi 'de.themoep.idconverter:mappings:1.2-SNAPSHOT'
relocatedApi 'org.bstats:bstats-bukkit:2.2.1'
relocatedApi 'net.minidev:json-smart:2.4.8'
relocatedApi 'org.jetbrains:annotations:22.0.0'
2023-03-28 06:20:30 +02:00
relocatedApi 'io.papermc:paperlib:1.0.8'
2023-02-02 23:07:51 +01:00
2023-02-20 13:29:08 +01:00
// Tests
2023-03-02 08:07:38 +01:00
testImplementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.10'
2023-03-03 14:27:12 +01:00
testImplementation 'com.github.seeseemelk:MockBukkit-v1.19:2.141.0'
2023-03-02 06:44:32 +01:00
testImplementation('com.googlecode.json-simple:json-simple:1.1.1') {
exclude group: 'junit', module: 'junit'
}
2023-03-02 08:10:36 +01:00
testImplementation 'org.jetbrains.kotlin:kotlin-test'
2023-03-12 22:04:38 +01:00
testImplementation 'com.natpryce:hamkrest:1.8.0.1'
testImplementation 'org.mockito.kotlin:mockito-kotlin:4.1.0'
2023-03-02 07:20:38 +01:00
// Old Tests
oldTestImplementation 'org.spigotmc:spigot-api:1.19.3-R0.1-SNAPSHOT'
oldTestImplementation('com.googlecode.json-simple:json-simple:1.1.1') {
exclude group: 'junit', module: 'junit'
}
oldTestImplementation 'junit:junit:4.13.1'
oldTestImplementation 'org.mockito:mockito-core:3.11.2'
oldTestImplementation 'commons-io:commons-io:2.7'
2023-03-06 05:00:28 +01:00
// Annotation Processors
annotationProcessor 'org.glassfish.hk2:hk2-metadata-generator:3.0.3'
2023-03-12 22:30:46 +01:00
testAnnotationProcessor 'org.glassfish.hk2:hk2-metadata-generator:3.0.3'
2023-02-02 23:07:51 +01:00
}
java {
withSourcesJar()
withJavadocJar()
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
tasks.withType(Javadoc) {
options.encoding = 'UTF-8'
}
2023-02-20 00:58:13 +01:00
configurations {
[apiElements, runtimeElements].each {
it.outgoing.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(jar) }
it.outgoing.artifact(shadowJar)
}
2023-08-24 19:28:02 +02:00
testCompileOnly.extendsFrom compileOnly
testRuntimeOnly.extendsFrom testCompileOnly
2023-08-24 19:28:02 +02:00
shadowed.extendsFrom compileOnly {
canBeResolved = true
}
2023-02-20 00:58:13 +01:00
}
2023-03-02 07:20:38 +01:00
sourceSets {
oldTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/old-test/java')
}
resources.srcDir file('src/old-test/resources')
}
}
2023-02-02 23:07:51 +01:00
publishing {
publications {
maven(MavenPublication) {
2023-02-20 00:58:13 +01:00
from components.java
pom.withXml {
asNode().dependencies.'*'.findAll() {
it.scope.text() == 'runtime' && project.configurations.implementation.allDependencies.find { dep ->
dep.name == it.artifactId.text()
}
}.each() {
it.scope*.value = 'provided'
}
}
2023-02-20 00:58:13 +01:00
}
}
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/Multiverse/Multiverse-Core"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
2023-02-02 23:07:51 +01:00
}
}
}
}
ext.bitlyAccessToken = System.getenv('BITLY_ACCESS_TOKEN') ?: 'bitly-access-token'
task prepareSource(type: Sync) {
inputs.property 'bitlyAccessToken', bitlyAccessToken
from sourceSets.main.java
into "$buildDir/src"
filter(ReplaceTokens, tokens: [
'bitly-access-token': bitlyAccessToken,
])
}
compileJava {
source = prepareSource.outputs
}
2023-03-12 22:30:46 +01:00
tasks.withType(JavaCompile) {
configure(options) {
options.compilerArgs << '-Aorg.glassfish.hk2.metadata.location=META-INF/hk2-locator/Multiverse-Core'
}
2023-02-02 23:07:51 +01:00
}
2023-03-02 08:07:38 +01:00
compileKotlin {
// We're not using Kotlin in the plugin itself, just tests!
enabled = false
}
configurations.findAll { !it.name.startsWith('test') }.each {
it.exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
2023-03-02 08:07:38 +01:00
}
2023-02-02 23:07:51 +01:00
processResources {
2023-02-20 00:58:13 +01:00
def props = [version: "${project.version}"]
2023-02-02 23:07:51 +01:00
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
// This task should never be skipped. The tests depend on this having been run but we want the new version number
// that is created after tests are run and before we run again to publish.
outputs.upToDateWhen { false }
2023-02-02 23:07:51 +01:00
}
checkstyle {
toolVersion = '6.1.1'
configFile file('config/mv_checks.xml')
ignoreFailures = true
}
javadoc {
source = sourceSets.main.allJava
classpath = configurations.compileClasspath
}
project.configurations.api.canBeResolved = true
shadowJar {
2023-03-27 12:30:38 +02:00
relocate 'co.aikar.commands', 'com.onarandombox.acf'
2023-02-02 23:07:51 +01:00
relocate 'com.dumptruckman.minecraft.util.Logging', 'com.onarandombox.MultiverseCore.utils.CoreLogging'
relocate 'com.dumptruckman.minecraft.util.DebugLog', 'com.onarandombox.MultiverseCore.utils.DebugFileLogger'
relocate 'de.themoep.idconverter', 'com.onarandombox.idconverter'
2023-02-20 13:29:08 +01:00
relocate 'io.github.townyadvanced.commentedconfiguration', 'com.onarandombox.commentedconfiguration'
relocate 'me.main__.util', 'com.onarandombox.serializationconfig'
relocate 'org.bstats', 'com.onarandombox.bstats'
relocate 'com.sun', 'com.onarandombox.sun'
relocate 'net.minidev', 'com.onarandombox.minidev'
relocate 'org.objectweb', 'com.onarandombox.objectweb'
relocate 'io.vavr', 'com.onarandombox.vavr'
relocate 'jakarta', 'com.onarandombox.jakarta'
relocate 'javassist', 'com.onarandombox.javassist'
relocate 'org.aopalliance', 'com.onarandombox.aopalliance'
relocate 'org.glassfish', 'com.onarandombox.glassfish'
relocate 'org.jvnet', 'com.onarandombox.jvnet'
relocate 'org.intellij', 'com.onarandombox.intellij'
relocate 'org.jetbrains', 'com.onarandombox.jetbrains'
2023-03-28 06:20:30 +02:00
relocate 'io.papermc.lib', 'com.onarandombox.paperlib'
2023-08-24 19:28:02 +02:00
configurations = [project.configurations.shadowed]
2023-02-02 23:07:51 +01:00
archiveFileName = "$baseName-$version.$extension"
2023-03-02 08:07:38 +01:00
dependencies {
exclude(dependency {
it.moduleGroup == 'org.jetbrains.kotlin'
})
}
2023-02-02 23:07:51 +01:00
}
build.dependsOn shadowJar
jar.enabled = false
2023-02-20 13:29:08 +01:00
test {
2023-03-02 08:10:36 +01:00
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
2023-02-20 13:29:08 +01:00
}