Multiverse-Core/build.gradle

208 lines
5.9 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 13:37:07 +01:00
id "com.modrinth.minotaur" version "2.+"
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'
java.sourceCompatibility = JavaVersion.VERSION_11
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/')
}
}
dependencies {
2023-08-24 19:28:02 +02:00
implementation 'org.bukkit:bukkit:1.13.2-R0.1-SNAPSHOT'
2023-02-02 23:07:51 +01:00
implementation('com.github.MilkBowl:VaultAPI:1.7') {
exclude group: 'org.bukkit', module: 'bukkit'
}
2023-08-24 19:28:02 +02:00
compileOnly('me.main__.util:SerializationConfig:1.7') {
2023-02-02 23:07:51 +01:00
exclude group: 'org.bukkit', module: 'bukkit'
}
2023-08-24 19:28:02 +02:00
compileOnly('com.pneumaticraft.commandhandler:CommandHandler:11') {
2023-02-02 23:07:51 +01:00
exclude group: 'org.bukkit', module: 'bukkit'
exclude group: 'junit', module: 'junit'
}
2023-08-24 19:28:02 +02:00
compileOnly 'com.dumptruckman.minecraft:buscript:2.0-SNAPSHOT'
compileOnly 'org.bstats:bstats-bukkit:2.2.1'
compileOnly('com.dumptruckman.minecraft:Logging:1.1.1') {
2023-02-02 23:07:51 +01:00
exclude group: 'junit', module: 'junit'
}
2023-08-24 19:28:02 +02:00
compileOnly 'de.themoep.idconverter:mappings:1.2-SNAPSHOT'
compileOnly 'org.jetbrains:annotations:16.0.2'
2023-02-02 23:07:51 +01:00
2023-03-02 06:44:32 +01:00
testImplementation 'org.spigotmc:spigot-api:1.19.3-R0.1-SNAPSHOT'
testImplementation('com.googlecode.json-simple:json-simple:1.1.1') {
exclude group: 'junit', module: 'junit'
}
2023-02-02 23:07:51 +01:00
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:3.11.2'
testImplementation 'commons-io:commons-io:2.4'
}
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-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
}
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 {
relocate 'me.main__.util', 'com.onarandombox.serializationconfig'
relocate 'com.pneumaticraft.commandhandler', 'com.onarandombox.commandhandler'
relocate 'buscript', 'com.onarandombox.buscript'
relocate 'org.bstats', 'com.onarandombox.bstats'
relocate 'com.dumptruckman.minecraft.util.Logging', 'com.onarandombox.MultiverseCore.utils.CoreLogging'
relocate 'com.dumptruckman.minecraft.util.DebugLog', 'com.onarandombox.MultiverseCore.utils.DebugFileLogger'
relocate 'org.codehaus.jettison', 'com.onarandombox.jettison'
relocate 'de.themoep.idconverter', 'com.onarandombox.idconverter'
2023-08-24 19:28:02 +02:00
configurations = [project.configurations.shadowed]
2023-02-02 23:07:51 +01:00
archiveFileName = "$baseName-$version.$extension"
classifier = ''
2023-02-02 23:07:51 +01:00
}
build.dependsOn shadowJar
jar.enabled = false
2023-03-02 13:37:07 +01:00
modrinth {
token = System.getenv("MODRINTH_TOKEN")
projectId = "multiverse-core"
versionNumber = System.getenv("VERSION_NUMBER")
versionType = System.getenv("VERSION_TYPE")
2023-03-02 13:37:07 +01:00
uploadFile = jar
gameVersions = ["1.20.1", "1.20", "1.19.4", "1.19.3", "1.19.2", "1.19.1", "1.19", "1.18.2", "1.18.1", "1.18", "1.17.1", "1.17", "1.16.5", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16", "1.15.2", "1.15.1", "1.15", "1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.14", "1.13.2", "1.13.1", "1.13"]
2023-08-03 12:11:29 +02:00
loaders = ["bukkit", "spigot", "paper"]
2023-03-02 13:37:07 +01:00
changelog = System.getenv("CHANGELOG")
}