2020-11-25 21:24:24 +01:00
|
|
|
buildscript {
|
|
|
|
ext {
|
|
|
|
indraVersion = '1.2.1'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
id 'org.ajoberstar.grgit' version '4.1.0'
|
|
|
|
id 'net.kyori.indra' version "$indraVersion" apply false
|
|
|
|
id 'net.kyori.indra.checkstyle' version "$indraVersion" apply false
|
|
|
|
id 'net.kyori.indra.publishing' version "$indraVersion" apply false
|
|
|
|
id 'com.github.johnrengelman.shadow' version '6.1.0' apply false
|
|
|
|
}
|
|
|
|
|
|
|
|
import org.apache.tools.ant.filters.ReplaceTokens
|
|
|
|
|
|
|
|
allprojects {
|
|
|
|
group = 'net.essentialsx'
|
|
|
|
version = '2.19.0-SNAPSHOT'
|
|
|
|
}
|
|
|
|
|
|
|
|
def commitsSinceLastTag() {
|
2020-12-14 05:54:54 +01:00
|
|
|
if (grgit == null) {
|
|
|
|
return 0
|
|
|
|
}
|
2020-11-25 21:24:24 +01:00
|
|
|
def tags = grgit.tag.list().stream().map({it.commit}).toList()
|
|
|
|
def commit = grgit.head()
|
|
|
|
def depth = 0
|
|
|
|
while (true) {
|
|
|
|
if (tags.contains(commit))
|
|
|
|
return depth
|
|
|
|
depth++
|
|
|
|
commit = grgit.resolve.toCommit(commit.parentIds.get(0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ext {
|
2020-12-14 05:54:54 +01:00
|
|
|
GIT_COMMIT = grgit == null ? "unknown" : grgit.head().abbreviatedId
|
2021-03-06 17:29:42 +01:00
|
|
|
GIT_BRANCH = grgit == null ? "detached-head" : grgit.branch.current().name
|
2020-11-25 21:24:24 +01:00
|
|
|
GIT_DEPTH = commitsSinceLastTag()
|
|
|
|
|
2021-03-06 17:29:42 +01:00
|
|
|
fullVersion = "${version}".replace("-SNAPSHOT", "-dev+${GIT_DEPTH}-${GIT_COMMIT}")
|
2020-11-25 21:24:24 +01:00
|
|
|
|
|
|
|
checkstyleVersion = '8.36.2'
|
2021-01-16 07:56:56 +01:00
|
|
|
spigotVersion = '1.16.5-R0.1-SNAPSHOT'
|
2020-11-25 21:24:24 +01:00
|
|
|
junit5Version = '5.7.0'
|
|
|
|
mockitoVersion = '3.2.0'
|
|
|
|
}
|
|
|
|
|
|
|
|
subprojects {
|
|
|
|
apply plugin: 'java'
|
|
|
|
apply plugin: 'net.kyori.indra'
|
|
|
|
apply plugin: 'net.kyori.indra.checkstyle'
|
|
|
|
apply plugin: 'net.kyori.indra.publishing'
|
|
|
|
apply plugin: 'com.github.johnrengelman.shadow'
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
maven { url = 'https://hub.spigotmc.org/nexus/content/groups/public/' }
|
|
|
|
maven { url = 'https://papermc.io/repo/repository/maven-public/' }
|
|
|
|
maven {
|
|
|
|
url = 'https://jitpack.io'
|
|
|
|
content {
|
|
|
|
includeGroup "com.github.milkbowl"
|
|
|
|
}
|
|
|
|
}
|
2020-12-19 17:27:07 +01:00
|
|
|
maven {
|
|
|
|
url = 'https://repo.codemc.org/repository/maven-public'
|
|
|
|
content {
|
|
|
|
includeGroup "org.bstats"
|
|
|
|
}
|
|
|
|
}
|
2021-03-02 05:52:05 +01:00
|
|
|
mavenCentral() {
|
|
|
|
content {
|
|
|
|
includeGroup "net.kyori"
|
|
|
|
}
|
|
|
|
}
|
2020-11-25 21:24:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
testImplementation "org.junit.jupiter:junit-jupiter:${junit5Version}"
|
|
|
|
testImplementation "org.junit.vintage:junit-vintage-engine:${junit5Version}"
|
|
|
|
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
|
|
|
|
|
|
|
|
if (project.name != "1_8Provider" && project.name != "PaperProvider" && project.name != "NMSReflectionProvider") { // These providers use their own bukkit versions
|
|
|
|
api "org.spigotmc:spigot-api:${spigotVersion}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-26 02:04:11 +01:00
|
|
|
// Dependency caching
|
|
|
|
configurations.all {
|
|
|
|
resolutionStrategy.cacheChangingModulesFor 5, 'minutes'
|
|
|
|
}
|
|
|
|
|
2020-11-25 21:24:24 +01:00
|
|
|
// Version Injection
|
|
|
|
processResources {
|
2021-03-06 17:29:42 +01:00
|
|
|
// Always process resources if version string or git branch changes
|
2020-11-26 01:38:27 +01:00
|
|
|
inputs.property('fullVersion', fullVersion)
|
2021-03-06 17:29:42 +01:00
|
|
|
inputs.property('gitBranch', GIT_BRANCH)
|
2020-11-25 21:24:24 +01:00
|
|
|
filter(ReplaceTokens, beginToken: '${',
|
2021-03-06 17:29:42 +01:00
|
|
|
endToken: '}', tokens: ["full.version": fullVersion, "git.branch": GIT_BRANCH])
|
|
|
|
|
2020-11-25 21:24:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
indra {
|
|
|
|
checkstyle = "$checkstyleVersion"
|
|
|
|
|
|
|
|
github('EssentialsX', 'Essentials')
|
|
|
|
gpl3OnlyLicense()
|
|
|
|
|
|
|
|
publishReleasesTo('essx', 'https://repo.essentialsx.net/releases/')
|
|
|
|
publishSnapshotsTo('essx', 'https://repo.essentialsx.net/snapshots/')
|
|
|
|
|
|
|
|
configurePublications {
|
|
|
|
pom {
|
|
|
|
description = 'The essential plugin suite for Minecraft servers.'
|
|
|
|
url = 'https://essentialsx.net'
|
|
|
|
developers {
|
|
|
|
developer {
|
|
|
|
id = 'mdcfe'
|
|
|
|
name = 'MD'
|
|
|
|
email = 'md@n3fs.co.uk'
|
|
|
|
}
|
|
|
|
developer {
|
|
|
|
id = 'pop4959'
|
|
|
|
}
|
|
|
|
developer {
|
|
|
|
id = 'JRoy'
|
|
|
|
name = 'Josh Roy'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ciManagement {
|
|
|
|
system = 'Jenkins'
|
|
|
|
url = 'https://ci.ender.zone/job/EssentialsX'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-26 02:12:58 +01:00
|
|
|
compileJava {
|
|
|
|
options.compilerArgs.add('-Xlint:-deprecation')
|
|
|
|
}
|
|
|
|
|
2020-11-25 21:24:24 +01:00
|
|
|
javadoc {
|
|
|
|
title = "${project.name} API (v${rootProject.ext.fullVersion})"
|
|
|
|
options.links(
|
|
|
|
'https://hub.spigotmc.org/javadocs/spigot/'
|
|
|
|
)
|
2020-11-26 02:19:16 +01:00
|
|
|
options.addBooleanOption('Xdoclint:none', true)
|
2020-11-25 21:24:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// undo https://github.com/KyoriPowered/indra/blob/master/indra-common/src/main/kotlin/net/kyori/indra/IndraPlugin.kt#L57
|
|
|
|
archivesBaseName = project.name
|
|
|
|
|
|
|
|
tasks.withType(Jar) {
|
|
|
|
archiveVersion.set(fullVersion)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def outputTasks() {
|
|
|
|
[":EssentialsX:shadowJar", ":EssentialsXAntiBuild:jar", ":EssentialsXChat:jar",
|
|
|
|
":EssentialsXGeoIP:shadowJar", ":EssentialsXProtect:jar", ":EssentialsXSpawn:jar",
|
|
|
|
":EssentialsXXMPP:shadowJar"].stream().map({ tasks.findByPath(it) })
|
|
|
|
}
|
|
|
|
|
|
|
|
task copyToJars(type: Copy) {
|
2020-11-26 01:38:27 +01:00
|
|
|
dependsOn tasks.findByPath(":EssentialsX:processResources")
|
|
|
|
|
2020-11-25 21:24:24 +01:00
|
|
|
outputTasks().forEach {
|
|
|
|
from(it)
|
|
|
|
}
|
|
|
|
|
|
|
|
rename '(.*)-all.jar', '$1.jar'
|
|
|
|
|
|
|
|
into file('jars')
|
|
|
|
}
|
|
|
|
|
|
|
|
task cleanJars() {
|
|
|
|
delete file('jars')
|
|
|
|
}
|
|
|
|
|
|
|
|
task clean() {
|
|
|
|
dependsOn cleanJars
|
|
|
|
}
|
|
|
|
|
|
|
|
task build() {
|
|
|
|
dependsOn copyToJars
|
|
|
|
}
|