2022-07-03 08:14:44 +02:00
|
|
|
import java.nio.file.Files
|
|
|
|
|
2019-08-05 09:24:50 +02:00
|
|
|
// Aggregate Javadocs
|
|
|
|
buildscript {
|
2022-06-15 12:30:35 +02:00
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
}
|
2019-08-05 09:24:50 +02:00
|
|
|
dependencies {
|
2021-04-22 07:23:48 +02:00
|
|
|
classpath 'com.netflix.nebula:gradle-aggregate-javadocs-plugin:3.0.+'
|
2019-08-05 09:24:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-18 20:13:05 +01:00
|
|
|
plugins {
|
2023-09-22 15:37:31 +02:00
|
|
|
id "com.github.johnrengelman.shadow" version "8.1.1" apply false
|
2018-12-18 20:13:05 +01:00
|
|
|
id "java"
|
2022-07-13 20:21:20 +02:00
|
|
|
id 'java-library'
|
2018-12-19 18:24:33 +01:00
|
|
|
id "jacoco"
|
2019-01-03 11:52:01 +01:00
|
|
|
id "checkstyle"
|
2024-04-07 13:40:15 +02:00
|
|
|
id "org.sonarqube" version "5.0.0.4638"
|
2024-04-20 08:48:33 +02:00
|
|
|
id 'fabric-loom' version '1.6-SNAPSHOT' apply false
|
2018-12-18 20:13:05 +01:00
|
|
|
}
|
|
|
|
|
2019-08-05 09:24:50 +02:00
|
|
|
apply plugin: 'nebula-aggregate-javadocs'
|
|
|
|
|
2019-12-08 10:30:53 +01:00
|
|
|
def determineBuildVersion = {
|
|
|
|
def buildInfo = new ByteArrayOutputStream()
|
|
|
|
exec {
|
|
|
|
commandLine 'git', 'rev-list', '--count', 'HEAD'
|
|
|
|
standardOutput = buildInfo
|
|
|
|
}
|
|
|
|
// Magic number: git rev-list --count cdb13e3b663b18e3938ad5efc60d165fa9301f6e
|
|
|
|
return Integer.parseInt(buildInfo.toString().replaceAll("[^0-9]", "")) - 3529
|
|
|
|
}
|
|
|
|
def buildVersion = determineBuildVersion()
|
|
|
|
|
2018-12-18 20:13:05 +01:00
|
|
|
allprojects {
|
|
|
|
|
|
|
|
group "com.djrapitops"
|
2023-08-20 10:56:13 +02:00
|
|
|
version "5.6-SNAPSHOT"
|
2019-12-07 19:12:45 +01:00
|
|
|
|
|
|
|
ext.majorVersion = '5'
|
2023-08-20 10:56:13 +02:00
|
|
|
ext.minorVersion = '6'
|
2019-12-08 10:30:53 +01:00
|
|
|
ext.buildVersion = buildVersion
|
|
|
|
ext.fullVersion = project.ext.majorVersion + '.' + project.ext.minorVersion + ' build ' + project.ext.buildVersion
|
2023-10-15 16:31:39 +02:00
|
|
|
ext.fullVersionFilename = project.ext.majorVersion + '.' + project.ext.minorVersion + '-build-' + project.ext.buildVersion
|
2023-10-15 16:19:06 +02:00
|
|
|
ext.fullVersionSemantic = project.ext.majorVersion + '.' + project.ext.minorVersion + '+build.' + project.ext.buildVersion
|
2018-12-26 20:44:59 +01:00
|
|
|
|
2019-01-12 12:00:30 +01:00
|
|
|
// Fix for UTF-8 files showing with wrong encoding when compiled on Windows machines.
|
2020-01-24 11:22:41 +01:00
|
|
|
compileJava { options.encoding = "UTF-8" }
|
2023-09-22 15:37:31 +02:00
|
|
|
tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' }
|
2020-01-24 11:22:41 +01:00
|
|
|
javadoc { options.encoding = 'UTF-8' }
|
2018-12-18 20:13:05 +01:00
|
|
|
}
|
|
|
|
|
2023-10-15 16:31:39 +02:00
|
|
|
logger.lifecycle("Building artifact for version $fullVersion / $fullVersionFilename / $fullVersionSemantic")
|
2020-01-13 21:40:04 +01:00
|
|
|
|
2018-12-18 20:13:05 +01:00
|
|
|
subprojects {
|
2019-01-08 12:25:23 +01:00
|
|
|
// Build plugins
|
2021-06-12 07:24:24 +02:00
|
|
|
apply plugin: "com.github.johnrengelman.shadow"
|
2018-12-18 20:13:05 +01:00
|
|
|
apply plugin: "java"
|
2022-07-13 20:21:20 +02:00
|
|
|
apply plugin: "java-library"
|
2019-02-02 09:42:29 +01:00
|
|
|
apply plugin: "maven-publish"
|
2019-01-08 12:25:23 +01:00
|
|
|
|
|
|
|
// Report plugins
|
2019-01-03 11:52:01 +01:00
|
|
|
apply plugin: "checkstyle"
|
2018-12-19 18:24:33 +01:00
|
|
|
apply plugin: "jacoco"
|
2018-12-18 20:13:05 +01:00
|
|
|
|
2021-07-23 15:49:34 +02:00
|
|
|
compileJava {
|
2022-05-30 17:40:46 +02:00
|
|
|
options.release = 11
|
2021-07-23 15:49:34 +02:00
|
|
|
}
|
2018-12-18 20:13:05 +01:00
|
|
|
|
2021-06-12 07:24:24 +02:00
|
|
|
ext {
|
2024-04-07 12:41:33 +02:00
|
|
|
daggerVersion = "2.51.1"
|
2021-06-12 07:24:24 +02:00
|
|
|
|
2024-05-18 17:52:39 +02:00
|
|
|
palVersion = "5.2.0"
|
2021-06-12 07:24:24 +02:00
|
|
|
|
|
|
|
bukkitVersion = "1.13.2-R0.1-SNAPSHOT"
|
|
|
|
spigotVersion = "1.13.2-R0.1-SNAPSHOT"
|
2021-06-12 09:21:38 +02:00
|
|
|
paperVersion = "1.13.2-R0.1-SNAPSHOT"
|
2022-05-29 16:08:50 +02:00
|
|
|
spongeVersion = "8.1.0"
|
2021-06-12 07:24:24 +02:00
|
|
|
nukkitVersion = "1.0-SNAPSHOT"
|
|
|
|
bungeeVersion = "1.16-R0.4"
|
2021-06-29 22:29:59 +02:00
|
|
|
velocityVersion = "3.0.0-SNAPSHOT"
|
2021-07-18 09:43:38 +02:00
|
|
|
redisBungeeVersion = "0.3.8-SNAPSHOT"
|
2022-09-25 09:47:22 +02:00
|
|
|
redisBungeeProxioDevVersion = "0.7.3"
|
2021-06-12 07:24:24 +02:00
|
|
|
|
2024-04-20 09:02:35 +02:00
|
|
|
commonsTextVersion = "1.12.0"
|
2024-03-23 12:06:46 +01:00
|
|
|
commonsCompressVersion = "1.26.1"
|
2024-05-17 19:52:33 +02:00
|
|
|
commonsCodecVersion = "1.17.0"
|
2023-08-11 08:17:43 +02:00
|
|
|
caffeineVersion = "3.1.8"
|
2024-05-17 19:52:33 +02:00
|
|
|
jettyVersion = "11.0.21"
|
2022-06-19 17:38:40 +02:00
|
|
|
caffeineVersion = "2.9.2"
|
2024-05-17 19:52:33 +02:00
|
|
|
mysqlVersion = "8.4.0"
|
2024-02-28 19:21:44 +01:00
|
|
|
mariadbVersion = "3.3.3"
|
2024-03-09 09:10:01 +01:00
|
|
|
sqliteVersion = "3.42.0.1"
|
2024-05-17 19:52:33 +02:00
|
|
|
adventureVersion = "4.17.0"
|
2023-11-15 15:26:14 +01:00
|
|
|
hikariVersion = "5.1.0"
|
2024-04-20 09:02:35 +02:00
|
|
|
slf4jVersion = "2.0.13"
|
2023-12-09 08:09:06 +01:00
|
|
|
geoIpVersion = "4.2.0"
|
2023-01-20 17:43:26 +01:00
|
|
|
gsonVersion = "2.10.1"
|
2023-07-08 08:05:05 +02:00
|
|
|
dependencyDownloadVersion = "1.3.1"
|
2024-03-09 09:11:16 +01:00
|
|
|
ipAddressMatcherVersion = "5.5.0"
|
2023-10-15 11:52:28 +02:00
|
|
|
jasyptVersion = "1.9.3"
|
2022-02-28 17:50:21 +01:00
|
|
|
|
2023-04-01 07:47:48 +02:00
|
|
|
bstatsVersion = "3.0.2"
|
2023-11-07 14:24:27 +01:00
|
|
|
placeholderapiVersion = "2.11.5"
|
2021-06-12 07:24:24 +02:00
|
|
|
nkPlaceholderapiVersion = "1.4-SNAPSHOT"
|
2022-02-27 14:40:35 +01:00
|
|
|
|
2024-02-17 08:25:38 +01:00
|
|
|
junitVersion = "5.10.2"
|
2024-05-17 19:52:33 +02:00
|
|
|
mockitoVersion = "5.12.0"
|
|
|
|
seleniumVersion = "4.21.0"
|
|
|
|
testContainersVersion = "1.19.8"
|
|
|
|
swaggerVersion = "2.2.22"
|
2021-06-12 07:24:24 +02:00
|
|
|
}
|
2018-12-18 20:13:05 +01:00
|
|
|
|
|
|
|
repositories {
|
2021-03-05 13:27:30 +01:00
|
|
|
mavenCentral()
|
2021-07-23 15:49:34 +02:00
|
|
|
google()
|
2021-06-12 07:24:24 +02:00
|
|
|
maven { url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" } // Spigot
|
|
|
|
maven { url = "https://papermc.io/repo/repository/maven-public/" } // Paper
|
|
|
|
maven { url = "https://repo.spongepowered.org/repository/maven-public/" } // Sponge
|
|
|
|
maven { url = "https://oss.sonatype.org/content/repositories/snapshots" } // BungeeCord
|
|
|
|
maven { url = "https://repo.playeranalytics.net/releases" } // Plan
|
2022-09-25 09:47:22 +02:00
|
|
|
maven { url = "https://repo.md-5.net/content/repositories/snapshots/" } // RedisBungee
|
|
|
|
maven { url = "https://jitpack.io" } // RedisBungee fork
|
2018-12-18 20:13:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2019-01-08 12:25:23 +01:00
|
|
|
// Dependency Injection used across the project
|
2022-07-13 20:21:20 +02:00
|
|
|
shadow "com.google.dagger:dagger:$daggerVersion"
|
2022-02-28 17:50:21 +01:00
|
|
|
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
|
2022-07-13 20:21:20 +02:00
|
|
|
testImplementation "com.google.dagger:dagger:$daggerVersion"
|
2022-02-28 17:50:21 +01:00
|
|
|
testAnnotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
|
2018-12-18 20:13:05 +01:00
|
|
|
|
2023-10-01 06:28:49 +02:00
|
|
|
compileOnly "io.swagger.core.v3:swagger-core-jakarta:$swaggerVersion"
|
|
|
|
|
2018-12-18 22:06:47 +01:00
|
|
|
// Test Tooling Dependencies
|
2022-02-28 17:50:21 +01:00
|
|
|
testImplementation "org.junit.jupiter:junit-jupiter:$junitVersion" // JUnit 5
|
|
|
|
testImplementation "org.mockito:mockito-core:$mockitoVersion" // Mockito Core
|
|
|
|
testImplementation "org.mockito:mockito-junit-jupiter:$mockitoVersion" // Mockito JUnit 5 Extension
|
2022-07-03 08:14:44 +02:00
|
|
|
testImplementation "com.jayway.awaitility:awaitility:1.7.0"
|
|
|
|
// Awaitility (Concurrent wait conditions)
|
2019-01-08 12:25:23 +01:00
|
|
|
|
|
|
|
// Testing dependencies required by Plan
|
2023-07-20 08:01:26 +02:00
|
|
|
testImplementation "org.xerial:sqlite-jdbc:$sqliteVersion" // SQLite
|
|
|
|
testImplementation "com.mysql:mysql-connector-j:$mysqlVersion" // MySQL
|
|
|
|
testImplementation "org.mariadb.jdbc:mariadb-java-client:$mariadbVersion" // MariaDB
|
2018-12-18 22:06:47 +01:00
|
|
|
}
|
2019-08-08 20:01:48 +02:00
|
|
|
|
2018-12-18 22:06:47 +01:00
|
|
|
configurations {
|
2022-07-13 20:21:20 +02:00
|
|
|
// Include shadowed dependencies in compile classpath of dependent modules
|
|
|
|
api.extendsFrom shadow
|
|
|
|
|
|
|
|
testArtifacts.extendsFrom testRuntimeOnly // Test classes available to other modules
|
|
|
|
testImplementation.extendsFrom shadow // Include shadowed dependencies in test classpath
|
2018-12-18 22:06:47 +01:00
|
|
|
}
|
2018-12-19 18:08:07 +01:00
|
|
|
// Test classes available to other modules
|
2023-09-22 15:37:31 +02:00
|
|
|
tasks.register('testJar', Jar) {
|
2021-06-12 07:24:24 +02:00
|
|
|
archiveClassifier.set("test")
|
2018-12-18 22:06:47 +01:00
|
|
|
from sourceSets.test.output
|
|
|
|
}
|
|
|
|
artifacts {
|
|
|
|
testArtifacts testJar
|
2018-12-18 20:13:05 +01:00
|
|
|
}
|
2019-01-04 16:44:59 +01:00
|
|
|
|
2020-03-10 21:56:44 +01:00
|
|
|
test {
|
|
|
|
useJUnitPlatform()
|
|
|
|
testLogging {
|
|
|
|
events "passed", "failed", "skipped"
|
|
|
|
exceptionFormat "full"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-04 16:44:59 +01:00
|
|
|
checkstyle {
|
2021-07-24 13:10:48 +02:00
|
|
|
toolVersion "8.44"
|
2020-03-10 21:56:44 +01:00
|
|
|
getConfigDirectory().set file("$rootProject.projectDir/config/checkstyle")
|
2019-01-04 16:44:59 +01:00
|
|
|
}
|
2019-08-08 20:01:48 +02:00
|
|
|
|
|
|
|
jacocoTestReport {
|
|
|
|
reports {
|
2021-07-23 15:49:34 +02:00
|
|
|
xml.required = true
|
2019-12-17 09:00:38 +01:00
|
|
|
// xml.destination file("${buildDir}/jacoco/report.xml")
|
2019-08-08 20:01:48 +02:00
|
|
|
}
|
|
|
|
}
|
2020-05-30 09:27:56 +02:00
|
|
|
|
2023-09-22 15:37:31 +02:00
|
|
|
plugins.withType(JacocoPlugin).configureEach {
|
|
|
|
tasks.named("test").get().finalizedBy 'jacocoTestReport'
|
2020-05-30 09:27:56 +02:00
|
|
|
}
|
2018-12-19 18:24:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sonarqube {
|
|
|
|
properties {
|
2018-12-19 18:29:43 +01:00
|
|
|
property "sonar.projectName", "Player Analytics"
|
|
|
|
property "sonar.projectKey", "com.djrapitops:Plan"
|
2022-05-30 17:52:03 +02:00
|
|
|
property "sonar.coverage.jacoco.xmlReportPaths", "build/reports/jacoco/test/jacocoTestReport.xml"
|
2018-12-19 18:24:33 +01:00
|
|
|
}
|
2020-01-10 11:29:55 +01:00
|
|
|
}
|
2022-07-03 08:14:44 +02:00
|
|
|
|
|
|
|
abstract class PrintSnapshotVersionTask extends DefaultTask {
|
|
|
|
@TaskAction
|
|
|
|
def print() {
|
|
|
|
def versionsDir = project.file("$project.buildDir/versions")
|
|
|
|
def textFile = project.file("$project.buildDir/versions/snapshot.txt")
|
|
|
|
versionsDir.mkdirs()
|
|
|
|
Files.deleteIfExists(textFile.toPath())
|
|
|
|
textFile.createNewFile()
|
|
|
|
textFile << "$project.version"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract class PrintJarNameVersionTask extends DefaultTask {
|
|
|
|
@TaskAction
|
|
|
|
def print() {
|
|
|
|
def versionsDir = project.file("$project.buildDir/versions")
|
|
|
|
def textFile = project.file("$project.buildDir/versions/jar.txt")
|
|
|
|
versionsDir.mkdirs()
|
|
|
|
Files.deleteIfExists(textFile.toPath())
|
|
|
|
textFile.createNewFile()
|
|
|
|
textFile << "$project.majorVersion.$project.minorVersion-build-$project.buildVersion"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract class PrintHumanReadableVersionTask extends DefaultTask {
|
|
|
|
@TaskAction
|
|
|
|
def print() {
|
|
|
|
def versionsDir = project.file("$project.buildDir/versions")
|
|
|
|
def textFile = project.file("$project.buildDir/versions/human.txt")
|
|
|
|
versionsDir.mkdirs()
|
|
|
|
Files.deleteIfExists(textFile.toPath())
|
|
|
|
textFile.createNewFile()
|
|
|
|
textFile << "$project.fullVersion"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create a task using the task type
|
|
|
|
tasks.register('snapshotVersion', PrintSnapshotVersionTask)
|
|
|
|
tasks.register('jarNameVersion', PrintJarNameVersionTask)
|
|
|
|
tasks.register('humanReadableVersion', PrintHumanReadableVersionTask)
|