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' id "com.modrinth.minotaur" version "2.+" } version = System.getenv('GITHUB_VERSION') ?: 'local' group = 'com.onarandombox.multiversecore' description = 'Multiverse-Core' java.sourceCompatibility = JavaVersion.VERSION_11 repositories { mavenLocal() mavenCentral() 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 { compileOnly 'org.bukkit:bukkit:1.13.2-R0.1-SNAPSHOT' implementation('com.github.MilkBowl:VaultAPI:1.7') { exclude group: 'org.bukkit', module: 'bukkit' } api('me.main__.util:SerializationConfig:1.7') { exclude group: 'org.bukkit', module: 'bukkit' } api('com.pneumaticraft.commandhandler:CommandHandler:11') { exclude group: 'org.bukkit', module: 'bukkit' exclude group: 'junit', module: 'junit' } api 'com.dumptruckman.minecraft:buscript:2.0-SNAPSHOT' api 'org.bstats:bstats-bukkit:2.2.1' api('com.dumptruckman.minecraft:Logging:1.1.1') { exclude group: 'junit', module: 'junit' } api 'de.themoep.idconverter:mappings:1.2-SNAPSHOT' api 'org.jetbrains:annotations:16.0.2' 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' } 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' } configurations { [apiElements, runtimeElements].each { it.outgoing.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(jar) } it.outgoing.artifact(shadowJar) } } publishing { publications { maven(MavenPublication) { from components.java } } repositories { maven { name = "GitHubPackages" url = "https://maven.pkg.github.com/Multiverse/Multiverse-Core" credentials { username = System.getenv("GITHUB_ACTOR") password = System.getenv("GITHUB_TOKEN") } } } } 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 { def props = [version: "${project.version}"] 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 } } 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' configurations = [project.configurations.api] archiveFileName = "$baseName-$version.$extension" classifier = '' } build.dependsOn shadowJar jar.enabled = false modrinth { token = System.getenv("MODRINTH_TOKEN") projectId = "multiverse-core" versionNumber = version if(System.getenv("PRERELEASE")) { versionType = "beta" } else { versionType = "release" } uploadFile = jar gameVersions = ["1.20.1", "1.20", "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"] loaders = ["bukkit", "spigot", "paper"] changelog = System.getenv("CHANGELOG") }