Overhaul build system for subproject dependency wiring (#3953)

* Register tasks lazily

* Inline version tasks, use non-deprecated directory API

* Inline more stuff, get rid of most plugin configurations in root project

* Update & fix checkstyle

* Move some test utilities to testFixtures

* Fix Awaitility imports

* Move more test utilities over

* Fix LangCodeTest failing in test environment

* Initial pass at overhauling build system

* Don't ignore test failures anymore

* Update PAPI repo URL

* Fix Fabric build

* Disable flaky SQL date parsing test

* Fix LangCode tests once again

* Fix invalid import in Junit extension

* Cleanup & fixes

- Swagger is back
- Added JVM forking to compile and tests to possibly improve build performance
- Removed duplicate caffeine version field
- Addressed some exclusions and relocations

* Cleanup extra diff

* Remove extra diff

* Move plugin file resource processing to submodules

This way Bukkit plugin.yml won't end up in Fabric JAR, etc.

* Use onlyIf for detecting Jitpack in tasks

* Bundle Swagger JSON directly to common module output

* swagger.json is definitely available during tests ;)

* Remove mavenLocal() & await for PAL version bump

* Cleanup diff

* Bump PAL to 5.3.0

* Wire shadowJar to assemble task so `gradle build` builds whole project by convention

* Move versioning back to allProjects and associated tasks to root scope

* Include adventure extension also on fabric

* Add TODO on flaky SQL date parsing test

* Exclude jspecify from dagger

* Add clarifying comments in tasks

* Remove unneeded relocations

Probably missed these during cleanup
This commit is contained in:
Antti Koponen 2025-02-11 21:43:58 +02:00 committed by GitHub
parent 0e2f5d442f
commit db6e101fa9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
44 changed files with 457 additions and 486 deletions

View File

@ -57,7 +57,7 @@ jobs:
- name: 🛠 Build jars
run: |
cd Plan
./gradlew shadowJar
./gradlew build -x test
- name: ⚙ Get versions
run: |
cd Plan

View File

@ -1,14 +1,17 @@
dependencies {
compileOnly "org.apache.commons:commons-text:$commonsTextVersion"
testImplementation "org.apache.commons:commons-text:$commonsTextVersion"
compileOnly "com.google.code.gson:gson:$gsonVersion"
testImplementation "org.apache.commons:commons-text:$commonsTextVersion"
testImplementation "org.junit.jupiter:junit-jupiter:$junitVersion"
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
}
compileJava {
options.release = 8
}
ext.apiVersion = '5.6-R0.1'
def apiVersion = "5.6-R0.1"
publishing {
repositories {
@ -22,11 +25,10 @@ publishing {
}
}
publications {
apiArtifact(MavenPublication) {
from components.java
groupId 'com.djrapitops'
artifactId 'plan-api'
version "$apiVersion"
create("apiArtifact", MavenPublication) {
from(this.components.java)
artifactId = "plan-api"
version = apiVersion
}
}
}
}

View File

@ -1,62 +1,49 @@
import java.nio.file.Files
// Aggregate Javadocs
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.netflix.nebula:gradle-aggregate-javadocs-plugin:3.0.+'
classpath "com.netflix.nebula:gradle-aggregate-javadocs-plugin:3.0.+"
}
}
plugins {
id 'java-library'
id "jacoco"
id "checkstyle"
id("base")
id "org.sonarqube" version "6.0.1.5171"
id "com.gradleup.shadow" version "8.3.5" apply false
id 'fabric-loom' version '1.9-SNAPSHOT' apply false
id "com.gradleup.shadow" version "9.0.0-beta6" apply false
id "fabric-loom" version "1.9-SNAPSHOT" apply false
}
apply plugin: 'nebula-aggregate-javadocs'
apply plugin: "nebula-aggregate-javadocs"
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
clean {
delete "builds/"
}
def buildVersion = determineBuildVersion()
allprojects {
group = "com.djrapitops"
version = "5.6-SNAPSHOT"
group "com.djrapitops"
version "5.6-SNAPSHOT"
ext {
majorVersion = "5"
minorVersion = "6"
buildVersion = providers.provider {
def command = "git rev-list --count HEAD"
def buildInfo = command.execute().text.trim()
// Magic number: git rev-list --count cdb13e3b663b18e3938ad5efc60d165fa9301f6e
return Integer.parseInt(buildInfo.toString().replaceAll("[^0-9]", "")) - 3529
}.get()
ext.majorVersion = '5'
ext.minorVersion = '6'
ext.buildVersion = buildVersion
ext.fullVersion = project.ext.majorVersion + '.' + project.ext.minorVersion + ' build ' + project.ext.buildVersion
ext.fullVersionFilename = project.ext.majorVersion + '.' + project.ext.minorVersion + '-build-' + project.ext.buildVersion
ext.fullVersionSemantic = project.ext.majorVersion + '.' + project.ext.minorVersion + '+build.' + project.ext.buildVersion
// Fix for UTF-8 files showing with wrong encoding when compiled on Windows machines.
compileJava { options.encoding = "UTF-8" }
tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' }
javadoc { options.encoding = 'UTF-8' }
fullVersion = majorVersion + "." + minorVersion + " build " + buildVersion
fullVersionFilename = majorVersion + "." + minorVersion + "-build-" + buildVersion
fullVersionSemantic = majorVersion + "." + minorVersion + "+build." + buildVersion
}
}
logger.lifecycle("Building artifact for version $fullVersion / $fullVersionFilename / $fullVersionSemantic")
subprojects {
// Build plugins
apply plugin: "java-library"
apply plugin: "maven-publish"
apply plugin: "com.gradleup.shadow"
// Report plugins
apply plugin: "checkstyle"
@ -69,7 +56,7 @@ subprojects {
ext {
daggerVersion = "2.55"
palVersion = "5.2.0"
palVersion = "5.3.0"
bukkitVersion = "1.13.2-R0.1-SNAPSHOT"
spigotVersion = "1.13.2-R0.1-SNAPSHOT"
@ -85,8 +72,8 @@ subprojects {
commonsCompressVersion = "1.27.1"
commonsCodecVersion = "1.17.2"
caffeineVersion = "3.1.8"
jetbrainsAnnotationsVersion = "24.0.0"
jettyVersion = "11.0.24"
caffeineVersion = "2.9.2"
mysqlVersion = "9.1.0"
mariadbVersion = "3.5.1"
sqliteVersion = "3.42.0.1"
@ -107,7 +94,9 @@ subprojects {
mockitoVersion = "5.15.2"
seleniumVersion = "4.27.0"
testContainersVersion = "1.20.4"
awaitilityVersion = "4.2.2"
swaggerVersion = "2.2.28"
guavaVersion = "33.4.0-jre"
}
repositories {
@ -124,52 +113,25 @@ subprojects {
dependencies {
// Dependency Injection used across the project
shadow "com.google.dagger:dagger:$daggerVersion"
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
testImplementation "com.google.dagger:dagger:$daggerVersion"
testAnnotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
compileOnly "io.swagger.core.v3:swagger-core-jakarta:$swaggerVersion"
// Test Tooling Dependencies
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
testImplementation "com.jayway.awaitility:awaitility:1.7.0"
// Awaitility (Concurrent wait conditions)
// Testing dependencies required by Plan
testImplementation "org.xerial:sqlite-jdbc:$sqliteVersion" // SQLite
testImplementation "com.mysql:mysql-connector-j:$mysqlVersion" // MySQL
testImplementation "org.mariadb.jdbc:mariadb-java-client:$mariadbVersion" // MariaDB
}
configurations {
// 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
}
// Test classes available to other modules
tasks.register('testJar', Jar) {
archiveClassifier.set("test")
from sourceSets.test.output
}
artifacts {
testArtifacts testJar
implementation("com.google.dagger:dagger:$daggerVersion") {
exclude group: "org.jspecify", module: "jspecify"
}
annotationProcessor("com.google.dagger:dagger-compiler:$daggerVersion") {
exclude group: "org.jspecify", module: "jspecify"
}
}
test {
useJUnitPlatform()
testLogging {
events "passed", "failed", "skipped"
exceptionFormat "full"
exceptionFormat = "full"
}
finalizedBy jacocoTestReport
}
checkstyle {
toolVersion "8.44"
toolVersion = "10.21.1"
getConfigDirectory().set file("$rootProject.projectDir/config/checkstyle")
}
@ -180,8 +142,14 @@ subprojects {
}
}
plugins.withType(JacocoPlugin).configureEach {
tasks.named("test").get().finalizedBy 'jacocoTestReport'
// Fix for UTF-8 files showing with wrong encoding when compiled on Windows machines.
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.fork = true
}
tasks.withType(Javadoc).configureEach {
options.encoding = "UTF-8"
}
}
@ -193,43 +161,32 @@ sonarqube {
}
}
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"
tasks.register("snapshotVersion") {
def textFile = layout.buildDirectory.file("versions/snapshot.txt")
doLast {
textFile.get().asFile.with {
parentFile.mkdirs()
write(version as String)
}
}
}
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"
tasks.register("jarNameVersion") {
def textFile = layout.buildDirectory.file("versions/jar.txt")
doLast {
textFile.get().asFile.with {
parentFile.mkdirs()
write("$majorVersion.$minorVersion-build-$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"
tasks.register("humanReadableVersion") {
def textFile = layout.buildDirectory.file("versions/human.txt")
doLast {
textFile.get().asFile.with {
parentFile.mkdirs()
write(fullVersion)
}
}
}
// Create a task using the task type
tasks.register('snapshotVersion', PrintSnapshotVersionTask)
tasks.register('jarNameVersion', PrintJarNameVersionTask)
tasks.register('humanReadableVersion', PrintHumanReadableVersionTask)

View File

@ -1,26 +1,29 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
repositories {
maven { // Placeholder API repository
url = "https://repo.extendedclip.com/content/repositories/placeholderapi/"
url = "https://repo.extendedclip.com/releases/"
}
}
dependencies {
implementation project(":api")
implementation project(":common")
shadow "net.playeranalytics:platform-abstraction-layer-api:$palVersion"
shadow "net.playeranalytics:platform-abstraction-layer-bukkit:$palVersion"
shadow "org.bstats:bstats-bukkit:$bstatsVersion"
compileOnly "me.clip:placeholderapi:$placeholderapiVersion"
implementation "net.playeranalytics:platform-abstraction-layer-bukkit:$palVersion"
implementation "org.bstats:bstats-bukkit:$bstatsVersion"
compileOnly "com.destroystokyo.paper:paper-api:$paperVersion"
compileOnly "me.clip:placeholderapi:$placeholderapiVersion"
testImplementation(testFixtures(project(":common")))
testImplementation(project(":extensions:adventure"))
testImplementation "com.destroystokyo.paper:paper-api:$paperVersion"
testImplementation project(path: ":common", configuration: 'testArtifacts')
}
shadowJar {
configurations = [project.configurations.shadow]
processResources {
inputs.property("version", fullVersion)
relocate 'org.bstats', 'net.playeranalytics.bstats.utilities.metrics'
}
filesMatching("plugin.yml") {
expand("version": fullVersion)
}
}

View File

@ -1,7 +1,7 @@
name: Plan
author: AuroraLS3
main: com.djrapitops.plan.Plan
version: @version@
version: ${version}
api-version: 1.13
folia-supported: true
softdepend:

View File

@ -1,20 +1,22 @@
dependencies {
implementation project(":api")
implementation project(":common")
shadow "net.playeranalytics:platform-abstraction-layer-api:$palVersion"
shadow "net.playeranalytics:platform-abstraction-layer-bungeecord:$palVersion"
shadow "org.bstats:bstats-bungeecord:$bstatsVersion"
implementation "net.playeranalytics:platform-abstraction-layer-bungeecord:$palVersion"
implementation "org.bstats:bstats-bungeecord:$bstatsVersion"
compileOnly "net.md-5:bungeecord-api:$bungeeVersion"
compileOnly "com.imaginarycode.minecraft:RedisBungee:$redisBungeeVersion"
testImplementation "net.md-5:bungeecord-api:$bungeeVersion"
testImplementation "com.imaginarycode.minecraft:RedisBungee:$redisBungeeVersion"
testImplementation project(path: ":common", configuration: 'testArtifacts')
testImplementation(testFixtures(project(":common")))
testImplementation(project(":extensions:adventure"))
}
shadowJar {
configurations = [project.configurations.shadow]
relocate 'org.bstats', 'net.playeranalytics.bstats.utilities.metrics'
}
processResources {
inputs.property("version", fullVersion)
filesMatching("bungee.yml") {
expand("version": fullVersion)
}
}

View File

@ -1,7 +1,7 @@
name: Plan
author: AuroraLS3
main: com.djrapitops.plan.PlanBungee
version: @version@
version: ${version}
softDepends:
- AdvancedBan
- LiteBans

View File

@ -1,7 +1,7 @@
import dev.vankka.dependencydownload.task.GenerateDependencyDownloadResourceTask
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id("java-test-fixtures")
id "dev.vankka.dependencydownload.plugin" version "$dependencyDownloadVersion"
id "com.github.node-gradle.node" version "7.1.0"
id "io.swagger.core.v3.swagger-gradle-plugin" version "2.2.28"
@ -19,7 +19,7 @@ configurations {
swaggerJson // swagger.json configuration
}
task generateResourceForMySQLDriver(type: GenerateDependencyDownloadResourceTask) {
tasks.register("generateResourceForMySQLDriver", GenerateDependencyDownloadResourceTask) {
var conf = configurations.mysqlDriver
configuration = conf
file = "assets/plan/dependencies/" + conf.name + ".txt"
@ -27,7 +27,7 @@ task generateResourceForMySQLDriver(type: GenerateDependencyDownloadResourceTask
includeShadowJarRelocations = false
}
task generateResourceForMariaDBDriver(type: GenerateDependencyDownloadResourceTask) {
tasks.register("generateResourceForMariaDBDriver", GenerateDependencyDownloadResourceTask) {
var conf = configurations.mariadbDriver
configuration = conf
file = "assets/plan/dependencies/" + conf.name + ".txt"
@ -35,7 +35,7 @@ task generateResourceForMariaDBDriver(type: GenerateDependencyDownloadResourceTa
includeShadowJarRelocations = false
}
task generateResourceForSQLiteDriver(type: GenerateDependencyDownloadResourceTask) {
tasks.register("generateResourceForSQLiteDriver", GenerateDependencyDownloadResourceTask) {
var conf = configurations.sqliteDriver
configuration = conf
file = "assets/plan/dependencies/" + conf.name + ".txt"
@ -43,7 +43,7 @@ task generateResourceForSQLiteDriver(type: GenerateDependencyDownloadResourceTas
includeShadowJarRelocations = false
}
task generateResourceForIpAddressMatcher(type: GenerateDependencyDownloadResourceTask) {
tasks.register("generateResourceForIpAddressMatcher", GenerateDependencyDownloadResourceTask) {
var conf = configurations.ipAddressMatcher
configuration = conf
file = "assets/plan/dependencies/" + conf.name + ".txt"
@ -52,12 +52,12 @@ task generateResourceForIpAddressMatcher(type: GenerateDependencyDownloadResourc
}
dependencies {
implementation project(":api")
shadow project(":extensions")
api project(":api")
api project(":extensions")
implementation "net.playeranalytics:platform-abstraction-layer-api:$palVersion"
shadow "net.playeranalytics:platform-abstraction-layer-api:$palVersion"
compileOnly "net.kyori:adventure-api:$adventureVersion"
shadow("dev.vankka:dependencydownload-runtime:$dependencyDownloadVersion") {
implementation("dev.vankka:dependencydownload-runtime:$dependencyDownloadVersion") {
// Effectively disables relocating
exclude module: "jar-relocator"
}
@ -67,38 +67,53 @@ dependencies {
sqliteDriver "org.slf4j:slf4j-nop:1.7.36"
ipAddressMatcher "com.github.seancfoley:ipaddress:$ipAddressMatcherVersion"
shadow "org.apache.commons:commons-text:$commonsTextVersion"
shadow "org.apache.commons:commons-compress:$commonsCompressVersion"
shadow "commons-codec:commons-codec:$commonsCodecVersion"
shadow "com.github.ben-manes.caffeine:caffeine:$caffeineVersion"
shadow "com.zaxxer:HikariCP:$hikariVersion"
shadow "org.slf4j:slf4j-nop:$slf4jVersion"
shadow "org.slf4j:slf4j-api:$slf4jVersion"
shadow "com.maxmind.geoip2:geoip2:$geoIpVersion"
shadow "com.google.code.gson:gson:$gsonVersion"
shadow "org.eclipse.jetty:jetty-server:$jettyVersion"
shadow "org.eclipse.jetty:jetty-alpn-java-server:$jettyVersion"
shadow "org.eclipse.jetty.http2:http2-server:$jettyVersion"
shadow("com.googlecode.json-simple:json-simple:1.1.1") { // json simple used by UUIDFetcher
// json-simple has junit (a test dependency) compile scoped
exclude group: "junit", module: "junit"
}
compileOnlyApi "org.jetbrains:annotations:$jetbrainsAnnotationsVersion"
api "org.apache.commons:commons-text:$commonsTextVersion"
api "org.apache.commons:commons-compress:$commonsCompressVersion"
api "commons-codec:commons-codec:$commonsCodecVersion"
api "com.github.ben-manes.caffeine:caffeine:$caffeineVersion"
implementation "com.zaxxer:HikariCP:$hikariVersion"
implementation "org.slf4j:slf4j-nop:$slf4jVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"
implementation "com.maxmind.geoip2:geoip2:$geoIpVersion"
api "com.google.code.gson:gson:$gsonVersion"
api "org.eclipse.jetty:jetty-server:$jettyVersion"
implementation "org.eclipse.jetty:jetty-alpn-java-server:$jettyVersion"
implementation "org.eclipse.jetty.http2:http2-server:$jettyVersion"
implementation "org.jasypt:jasypt:$jasyptVersion:lite"
// Swagger annotations
implementation "jakarta.ws.rs:jakarta.ws.rs-api:4.0.0"
api "io.swagger.core.v3:swagger-annotations:$swaggerVersion"
implementation "io.swagger.core.v3:swagger-core-jakarta:$swaggerVersion"
implementation "io.swagger.core.v3:swagger-jaxrs2-jakarta:$swaggerVersion"
// Test Tooling Dependencies
testFixturesApi "org.junit.jupiter:junit-jupiter:$junitVersion" // JUnit 5
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
testFixturesApi "org.mockito:mockito-core:$mockitoVersion" // Mockito Core
testFixturesApi "org.mockito:mockito-junit-jupiter:$mockitoVersion" // Mockito JUnit 5 Extension
testFixturesImplementation "net.playeranalytics:platform-abstraction-layer-api:$palVersion"
// Testing dependencies required by Plan
testImplementation project(":api")
testArtifacts project(":extensions:adventure")
testImplementation project(":extensions:adventure")
testImplementation "com.google.code.gson:gson:$gsonVersion"
testImplementation "org.seleniumhq.selenium:selenium-java:$seleniumVersion"
testImplementation "org.testcontainers:testcontainers:$testContainersVersion"
testImplementation "org.testcontainers:junit-jupiter:$testContainersVersion"
testImplementation "org.testcontainers:nginx:$testContainersVersion"
testImplementation "org.awaitility:awaitility:$awaitilityVersion"
testFixturesApi "com.google.guava:guava:$guavaVersion"
testFixturesApi "org.xerial:sqlite-jdbc:$sqliteVersion" // SQLite
testFixturesApi "com.mysql:mysql-connector-j:$mysqlVersion" // MySQL
testFixturesApi "org.mariadb.jdbc:mariadb-java-client:$mariadbVersion" // MariaDB
testImplementation "com.google.dagger:dagger:$daggerVersion"
testAnnotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
}
test {
@ -110,48 +125,40 @@ test {
environment "PLAN_TEST_NODE_STRINGLIST", "- Test\n- Another"
}
task updateVersion(type: Copy) {
from('src/main/resources') {
include 'plugin.yml'
include 'bungee.yml'
include 'nukkit.yml'
include 'fabric.mod.json'
}
into 'build/sources/resources/'
filter(ReplaceTokens, tokens: [version: '' + project.ext.fullVersion])
}
node {
download = true
version = "20.9.0"
nodeProjectDir = file("$rootDir/react/dashboard")
}
task yarnBundle(type: YarnTask) {
tasks.register("bundle", YarnTask) {
dependsOn yarn
inputs.files(fileTree("$rootDir/react/dashboard/src"))
inputs.file("$rootDir/react/dashboard/package.json")
inputs.file("$rootDir/react/dashboard/vite.config.js")
outputs.dir("$rootDir/react/dashboard/build")
dependsOn yarn_install
args = ['run', 'build']
args = ["run", "build"]
}
task yarnStart(type: YarnTask) {
tasks.register("yarnStart", YarnTask) {
logging.captureStandardOutput LogLevel.INFO
inputs.file("$rootDir/react/dashboard/package.json")
dependsOn yarn_install
args = ['run', 'start']
dependsOn yarn
args = ["run", "start"]
}
task copyYarnBuildResults {
tasks.register("copyYarnBuildResults") {
// Skip Yarn build on Jitpack since Jitpack doesn't offer gclib version compatible with Node 20
// Jitpack build is used mainly for java dependencies.
onlyIf("not running in Jitpack") { !project.hasProperty("isJitpack") }
inputs.files(fileTree("$rootDir/react/dashboard/build"))
outputs.dir("$rootDir/common/build/resources/main/assets/plan/web")
outputs.dir("$rootDir/common/build/resources/test/assets/plan/web")
dependsOn yarnBundle
dependsOn bundle
doLast {
mkdir "$rootDir/common/build/resources/main/assets/plan/web"
copy {
@ -165,22 +172,35 @@ task copyYarnBuildResults {
}
}
task determineAssetModifications {
dependsOn yarnBundle
tasks.withType(Test.class).configureEach {
forkEvery = 100
}
tasks.named("checkstyleTest").configure {
// FAILURE: Task ':common:checkstyleTest' uses this output of task ':common:copyYarnBuildResults'
// without declaring an explicit or implicit dependency.
it.dependsOn(copyYarnBuildResults)
}
tasks.register("determineAssetModifications") {
// Skip Yarn build on Jitpack since Jitpack doesn't offer gclib version compatible with Node 20
// Jitpack build is used mainly for java dependencies.
onlyIf("not running in Jitpack") { !project.hasProperty("isJitpack") }
dependsOn bundle
inputs.files(fileTree("$rootDir/react/dashboard/build"))
inputs.files(fileTree(dir: 'src/main/resources/assets/plan/web'))
inputs.files(fileTree(dir: 'src/main/resources/assets/plan/locale'))
inputs.files(fileTree(dir: "src/main/resources/assets/plan/web"))
inputs.files(fileTree(dir: "src/main/resources/assets/plan/locale"))
outputs.file("build/resources/main/assets/plan/AssetVersion.yml")
doLast {
mkdir "build/resources/main/assets/plan"
def versionFile = file("build/resources/main/assets/plan/AssetVersion.yml")
versionFile.text = "" // Clear previous build
ConfigurableFileTree tree = fileTree(dir: 'src/main/resources/assets/plan/web')
ConfigurableFileTree tree = fileTree(dir: "src/main/resources/assets/plan/web")
tree.forEach { File f ->
def gitModified = new ByteArrayOutputStream()
exec {
commandLine 'git', 'log', '-1', '--pretty=%ct', f.toString()
commandLine "git", "log", "-1", "--pretty=%ct", f.toString()
standardOutput = gitModified
}
def gitModifiedAsString = gitModified.toString().strip()
@ -188,14 +208,15 @@ task determineAssetModifications {
def modified = gitModifiedAsString.isEmpty() ? System.currentTimeMillis() : Long.parseLong(gitModifiedAsString) * 1000
def relativePath = tree.getDir().toPath().relativize(f.toPath()) // File path relative to the tree
versionFile.text += String.format(
"%s: %s\n", relativePath.toString().replace('.', ',').replace('\\', '/'), modified
"%s: %s\n", relativePath.toString().replace(".", ",").replace("\\", "/"), modified
)
}
tree = fileTree(dir: 'src/main/resources/assets/plan/locale')
tree = fileTree(dir: "src/main/resources/assets/plan/locale")
tree.forEach { File f ->
def gitModified = new ByteArrayOutputStream()
exec {
commandLine 'git', 'log', '-1', '--pretty=%ct', f.toString()
commandLine "git", "log", "-1", "--pretty=%ct", f.toString()
standardOutput = gitModified
}
def gitModifiedAsString = gitModified.toString().strip()
@ -203,7 +224,7 @@ task determineAssetModifications {
def modified = gitModifiedAsString.isEmpty() ? System.currentTimeMillis() : Long.parseLong(gitModifiedAsString) * 1000
def relativePath = tree.getDir().toPath().relativize(f.toPath()) // File path relative to the tree
versionFile.text += String.format(
"%s: %s\n", relativePath.toString().replace('.', ',').replace('\\', '/'), modified
"%s: %s\n", relativePath.toString().replace(".", ",").replace("\\", "/"), modified
)
}
@ -213,49 +234,37 @@ task determineAssetModifications {
def modified = System.currentTimeMillis()
def relativePath = tree.getDir().toPath().relativize(f.toPath()) // File path relative to the tree
versionFile.text += String.format(
"%s: %s\n", relativePath.toString().replace('.', ',').replace('\\', '/'), modified
"%s: %s\n", relativePath.toString().replace(".", ",").replace("\\", "/"), modified
)
}
}
}
resolve { // Swagger json generation task
outputFileName = 'swagger'
outputFormat = 'JSON'
prettyPrint = 'TRUE'
outputFileName = "swagger"
outputFormat = "JSON"
prettyPrint = "TRUE"
classpath = sourceSets.main.runtimeClasspath
buildClasspath = classpath
resourcePackages = [
'com.djrapitops.plan.delivery.webserver',
'com.djrapitops.plan.delivery.webserver.resolver.auth',
'com.djrapitops.plan.delivery.webserver.resolver.json',
"com.djrapitops.plan.delivery.webserver",
"com.djrapitops.plan.delivery.webserver.resolver.auth",
"com.djrapitops.plan.delivery.webserver.resolver.json",
]
outputDir = file('build/generated-resources/swagger/assets/plan/web/')
outputDir = "build/generated-resources/swagger/assets/plan/web"
}
task swaggerJsonJar(type: Jar) {
jar {
dependsOn resolve
archiveClassifier.set("resolve")
from 'build/generated-resources/swagger'
}
artifacts {
swaggerJson swaggerJsonJar
from "build/generated-resources/swagger"
}
processResources {
// Skips Yarn build on Jitpack since Jitpack doesn't offer gclib version compatible with Node 20
// Jitpack build is used mainly for java dependencies.
if (!project.hasProperty("isJitpack")) {
dependsOn copyYarnBuildResults
dependsOn determineAssetModifications
}
dependsOn copyYarnBuildResults
dependsOn determineAssetModifications
dependsOn generateResourceForMySQLDriver
dependsOn generateResourceForSQLiteDriver
dependsOn generateResourceForIpAddressMatcher
dependsOn updateVersion
duplicatesStrategy = DuplicatesStrategy.INCLUDE
from 'build/sources/resources'
}
shadowJar {
configurations = [project.configurations.shadow]
from "build/sources/resources"
}

View File

@ -35,8 +35,7 @@ public class SecurityTableIdPatch extends Patch {
@Override
public boolean hasBeenApplied() {
return (hasColumn(TABLE_NAME, SecurityTable.ID))
&& !hasTable(TEMP_TABLE_NAME);
return hasColumn(TABLE_NAME, SecurityTable.ID) && !hasTable(TEMP_TABLE_NAME);
}
@Override

View File

@ -34,7 +34,7 @@ import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.logging.LogEntry;
import org.openqa.selenium.logging.LogType;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testcontainers.shaded.org.awaitility.Awaitility;
import org.awaitility.Awaitility;
import utilities.RandomData;
import utilities.TestConstants;

View File

@ -153,7 +153,7 @@ class AccessControlTest {
Arguments.of("/v1/locale", WebPermission.ACCESS, 200, 200),
Arguments.of("/v1/locale/EN", WebPermission.ACCESS, 200, 200),
Arguments.of("/v1/locale/NonexistingLanguage", WebPermission.ACCESS, 404, 404),
Arguments.of("/docs/swagger.json", WebPermission.ACCESS_DOCS, 500, 403), // swagger.json not available during tests
Arguments.of("/docs/swagger.json", WebPermission.ACCESS_DOCS, 200, 403),
Arguments.of("/docs", WebPermission.ACCESS_DOCS, 200, 403),
Arguments.of("/pageExtensionApi.js", WebPermission.ACCESS, 200, 200),
Arguments.of("/manage", WebPermission.MANAGE_GROUPS, 200, 403),

View File

@ -49,7 +49,7 @@ import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.logging.LogEntry;
import org.openqa.selenium.logging.LogType;
import org.testcontainers.shaded.org.awaitility.Awaitility;
import org.awaitility.Awaitility;
import utilities.RandomData;
import utilities.TestConstants;
import utilities.TestResources;

View File

@ -33,8 +33,8 @@ import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testcontainers.shaded.org.awaitility.Awaitility;
import org.testcontainers.shaded.org.awaitility.core.ConditionTimeoutException;
import org.awaitility.Awaitility;
import org.awaitility.core.ConditionTimeoutException;
import utilities.RandomData;
import utilities.TestResources;
import utilities.mocks.PluginMockComponent;
@ -170,4 +170,4 @@ class OpenRedirectFuzzTest implements HttpsServerTest {
public int testPortNumber() {
return TEST_PORT_NUMBER;
}
}
}

View File

@ -43,7 +43,7 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.testcontainers.shaded.org.awaitility.Awaitility;
import org.awaitility.Awaitility;
import utilities.TestConstants;
import utilities.dagger.PlanPluginComponent;
import utilities.mocks.objects.TestPlayerData;
@ -310,4 +310,4 @@ class PlayerJoinEventConsumerTest {
assertTrue(playerExportDir.isDirectory());
}
}
}

View File

@ -47,7 +47,7 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.testcontainers.shaded.org.awaitility.Awaitility;
import org.awaitility.Awaitility;
import utilities.TestConstants;
import utilities.dagger.PlanPluginComponent;
import utilities.mocks.objects.TestPlayerData;
@ -265,4 +265,4 @@ class PlayerLeaveEventConsumerTest {
List<String> result = database.query(JoinAddressQueries.allJoinAddresses());
assertEquals(expected, result);
}
}
}

View File

@ -24,7 +24,7 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import org.testcontainers.shaded.org.awaitility.Awaitility;
import org.awaitility.Awaitility;
import utilities.TestConstants;
import utilities.mocks.PluginMockComponent;
@ -101,4 +101,4 @@ class ServerFileLoaderTest {
}
assertEquals(0, fails.get());
}
}
}

View File

@ -19,10 +19,15 @@ package com.djrapitops.plan.settings.locale;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@ -40,16 +45,18 @@ class LangCodeTest {
);
}
private void assertFileExists(LangCode langCode) throws URISyntaxException {
private void assertFileExists(LangCode langCode) throws IOException {
URL resource = getClass().getClassLoader().getResource("assets/plan/locale/" + langCode.getFileName());
assertNotNull(resource, () -> "Resource assets/plan/locale/" + langCode.getFileName() + " does not exist, but it is needed for LangCode." + langCode.name());
File file = new File(resource.toURI());
assertTrue(file.exists(), () -> "File: " + file.getAbsolutePath() + " does not exist, but it is needed for LangCode." + langCode.name());
try (var res = getClass().getClassLoader().getResourceAsStream("assets/plan/locale/" + langCode.getFileName())) {
assertNotNull(res, () -> "Resource stream assets/plan/locale/" + langCode.getFileName() + " does not exist, but it is needed for LangCode." + langCode.name());
}
}
@Test
@DisplayName("All locale files have matching LangCode")
void allFilesHaveLangCode() throws URISyntaxException {
void allFilesHaveLangCode() throws URISyntaxException, IOException {
Set<String> fileNames = Arrays.stream(LangCode.values())
.filter(Predicate.not(LangCode.CUSTOM::equals))
.map(LangCode::getFileName)
@ -57,15 +64,21 @@ class LangCodeTest {
URL resource = getClass().getClassLoader().getResource("assets/plan/locale");
assertNotNull(resource, "assets/plan/locale folder has gone missing for some reason - It's needed to access locales");
File localeFolder = new File(resource.toURI());
File[] localeFiles = localeFolder.listFiles();
assertNotNull(localeFiles);
assertAll(Arrays.stream(localeFiles)
.map(File::getName)
.map(fileName -> () ->
assertTrue(fileNames.contains(fileName), () -> "'" + fileName + "' was not found from assets/plan/locale/")
));
try (var fileSystem = FileSystems.newFileSystem(resource.toURI(), Map.of())) {
Path path = fileSystem.getPath("assets/plan/locale");
try (var paths = Files.walk(path)) {
List<String> localeFiles = paths
.filter(Files::isRegularFile)
.map(p -> p.getFileName().toString())
.toList();
assertAll(localeFiles.stream()
.map(fileName -> () ->
assertTrue(fileNames.contains(fileName), () -> "'" + fileName + "' was not found from assets/plan/locale/")
));
}
}
}
}
}

View File

@ -16,7 +16,7 @@
*/
package com.djrapitops.plan.settings.upkeep;
import com.jayway.awaitility.Awaitility;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
@ -74,4 +74,4 @@ class FileWatcherTest {
Files.write(modified.toPath(), Collections.singletonList("DataToWrite"), StandardCharsets.UTF_8);
Files.write(modified.toPath(), Collections.singletonList("OverWrite"), StandardCharsets.UTF_8);
}
}
}

View File

@ -51,6 +51,7 @@ import com.djrapitops.plan.storage.database.transactions.init.CreateIndexTransac
import com.djrapitops.plan.storage.database.transactions.patches.BadFabricJoinAddressValuePatch;
import com.djrapitops.plan.storage.database.transactions.patches.RegisterDateMinimizationPatch;
import com.djrapitops.plan.storage.upkeep.DBCleanTask;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import utilities.FieldFetcher;
@ -244,6 +245,7 @@ public interface DatabaseTest extends DatabaseTestPreparer {
}
@Test
@Disabled("flaky") // TODO fix sql date parsing sanity check test
default void sqlDateParsingSanityCheck() {
Database db = db();

View File

@ -23,6 +23,7 @@ import com.djrapitops.plan.delivery.export.Exporter;
import com.djrapitops.plan.delivery.formatting.Formatters;
import com.djrapitops.plan.delivery.rendering.json.graphs.Graphs;
import com.djrapitops.plan.delivery.webserver.Addresses;
import com.djrapitops.plan.delivery.webserver.http.WebServer;
import com.djrapitops.plan.identification.ServerUUID;
import com.djrapitops.plan.settings.ConfigSystem;
import com.djrapitops.plan.settings.config.PlanConfig;
@ -32,7 +33,6 @@ import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.file.PlanFiles;
import com.djrapitops.plan.storage.file.PublicHtmlFiles;
import com.djrapitops.plan.utilities.java.Maps;
import javassist.tools.web.Webserver;
import org.junit.jupiter.api.extension.*;
import utilities.RandomData;
import utilities.dagger.PlanPluginComponent;
@ -88,7 +88,7 @@ public class FullSystemExtension implements ParameterResolver, BeforeAllCallback
.put(LocaleSystem.class, () -> planSystem.getLocaleSystem())
.put(Addresses.class, () -> planSystem.getDeliveryUtilities().getAddresses())
.put(PublicHtmlFiles.class, () -> planSystem.getDeliveryUtilities().getPublicHtmlFiles())
.put(Webserver.class, () -> planSystem.getWebServerSystem().getWebServer())
.put(WebServer.class, () -> planSystem.getWebServerSystem().getWebServer())
.put(Exporter.class, () -> planSystem.getExportSystem().getExporter())
.put(Graphs.class, () -> planSystem.getDeliveryUtilities().getGraphs())
.build();

View File

@ -26,7 +26,7 @@ import org.openqa.selenium.devtools.DevTools;
import org.openqa.selenium.devtools.v130.emulation.Emulation;
import org.openqa.selenium.logging.LogType;
import org.openqa.selenium.logging.LoggingPreferences;
import org.testcontainers.shaded.org.awaitility.Awaitility;
import org.awaitility.Awaitility;
import utilities.CIProperties;
import java.io.File;

View File

@ -28,8 +28,6 @@ import java.util.function.Supplier;
*/
public class TestConstants {
private TestConstants() {
/* Static variable class */
}

View File

@ -1,18 +1,17 @@
// :extensions:adventure is used to avoid relocating 'net.kyori.adventure.*'
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
apply plugin: "com.gradleup.shadow"
// :extensions:adventure is used to avoid relocating "net.kyori.adventure.*"
// as it is used & provided natively on some platforms
dependencies {
compileOnly project(':api')
compileOnly project(':common')
shadow "net.kyori:adventure-text-serializer-gson:$adventureVersion"
shadow "net.kyori:adventure-text-serializer-legacy:$adventureVersion"
shadow "net.kyori:adventure-text-minimessage:$adventureVersion"
compileOnly project(":common")
api "net.kyori:adventure-text-serializer-gson:$adventureVersion"
api "net.kyori:adventure-text-serializer-legacy:$adventureVersion"
api "net.kyori:adventure-text-minimessage:$adventureVersion"
}
shadowJar {
relocate 'net.kyori', 'plan.net.kyori'
// Exclude some stuff included from the root build.gradle
exclude 'dagger/**'
exclude 'javax/inject/**'
tasks.named("shadowJar", ShadowJar) {
relocate "net.kyori", "plan.net.kyori"
}

View File

@ -1,57 +1,49 @@
dependencies {
implementation project(path: ":api")
shadow 'net.playeranalytics:Extension-AAC:4.4.2-R1.1'
shadow 'net.playeranalytics:Extension-AdvancedAchievements:6.4.0-R1.1'
shadow 'net.playeranalytics:Extension-AdvancedBan:2.1.5-R2.0'
shadow 'net.playeranalytics:Extension-ASkyBlock:3.0.9.4-R1.5'
shadow 'net.playeranalytics:Extension-AuthMe:5.6.0-R1.2'
shadow 'net.playeranalytics:Extension-BanManager:7.3.1-R1.2'
shadow 'net.playeranalytics:Extension-BentoBox:1.15.5-R2.0'
shadow 'net.playeranalytics:Extension-DiscordSRV:1.27.0-R1.4'
shadow 'net.playeranalytics:Extension-DKBans:2.1.2-R1.3'
shadow 'net.playeranalytics:Extension-DKCoins:3.0.5-R1.1'
shadow 'net.playeranalytics:Extension-EssentialsX:2.15.0-R2.0'
shadow 'net.playeranalytics:Extension-CMI:9.7.4.1-R0.1'
shadow 'net.playeranalytics:Extension-Factions:2.14.0-R1.1'
shadow 'net.playeranalytics:Extension-FactionsUUID:1.6.9.5-U0.5.25-R1.1'
shadow 'net.playeranalytics:Extension-FastLogin:R1.3'
shadow 'net.playeranalytics:Extension-Floodgate:2.2.0-R1.4'
shadow 'net.playeranalytics:Extension-GriefDefender:2.1.0-R1.1'
shadow 'net.playeranalytics:Extension-GriefPrevention:16.11.6-R1.2'
shadow 'net.playeranalytics:Extension-GriefPrevention-Sponge:4.0.1-R1.2'
shadow 'net.playeranalytics:Extension-Heroes:R1.2'
shadow 'net.playeranalytics:Extension-Jobs:4.16.3-R1.1'
shadow 'net.playeranalytics:Extension-KingdomsX:1.12.6.3.1-R1.4'
shadow 'net.playeranalytics:Extension-Lands:6.35.0-R1.2'
shadow 'net.playeranalytics:Extension-LibertyBans:1.1.0-R1.5'
shadow 'net.playeranalytics:Extension-Litebans:0.4.1-R1.5'
shadow 'net.playeranalytics:Extension-LogBlock:1.16.1.2-R1.9'
shadow 'net.playeranalytics:Extension-LuckPerms:5.0-R1.6'
shadow 'net.playeranalytics:Extension-MarriageMaster:2.3-R1.3'
shadow 'net.playeranalytics:Extension-McMMO:2.1.149-R2.5'
shadow 'net.playeranalytics:Extension-MinigamesLib:1.14.17-R1.2'
shadow 'net.playeranalytics:Extension-MyPet:3.10-R1.2'
shadow 'net.playeranalytics:Extension-Nucleus:3.0.0-R1.0'
shadow 'net.playeranalytics:Extension-nuVotifier:2.3.4-R1.3'
shadow 'net.playeranalytics:Extension-PlaceholderAPI:2.10.9-R1.6'
shadow 'net.playeranalytics:Extension-PlotSquared:6.9.4-R1.3'
shadow 'net.playeranalytics:Extension-ProtectionStones:2.8.2-R1.2'
shadow 'net.playeranalytics:Extension-ProtocolSupport:1.16.4-R1.3'
shadow 'net.playeranalytics:Extension-Quests:5.0.1-R1.0'
shadow 'net.playeranalytics:Extension-React:6.651-R1.1'
shadow 'net.playeranalytics:Extension-RedProtect:7.7.3-R1.1'
shadow 'net.playeranalytics:Extension-Sponge-Economy:8.0.0-R1.3'
shadow 'net.playeranalytics:Extension-SuperbVote:0.5.4-R1.1'
shadow 'net.playeranalytics:Extension-Tebex:R2.4'
shadow 'net.playeranalytics:Extension-Towny:0.99-R1.3'
shadow 'net.playeranalytics:Extension-Vault:1.7-R1.3'
shadow 'net.playeranalytics:Extension-ViaVersion:4.0.1-R1.5'
}
shadowJar {
configurations = [project.configurations.shadow]
// TODO Missing test scope in every Extension pom.xml causes junit to be shadowed.
exclude 'org/junit/**/*'
exclude 'org/opentest4j/**/*'
implementation "net.playeranalytics:Extension-AAC:4.4.2-R1.1"
implementation "net.playeranalytics:Extension-AdvancedAchievements:6.4.0-R1.1"
implementation "net.playeranalytics:Extension-AdvancedBan:2.1.5-R2.0"
implementation "net.playeranalytics:Extension-ASkyBlock:3.0.9.4-R1.5"
implementation "net.playeranalytics:Extension-AuthMe:5.6.0-R1.2"
implementation "net.playeranalytics:Extension-BanManager:7.3.1-R1.2"
implementation "net.playeranalytics:Extension-BentoBox:1.15.5-R2.0"
implementation "net.playeranalytics:Extension-DiscordSRV:1.27.0-R1.4"
implementation "net.playeranalytics:Extension-DKBans:2.1.2-R1.3"
implementation "net.playeranalytics:Extension-DKCoins:3.0.5-R1.1"
implementation "net.playeranalytics:Extension-EssentialsX:2.15.0-R2.0"
implementation "net.playeranalytics:Extension-CMI:9.7.4.1-R0.1"
implementation "net.playeranalytics:Extension-Factions:2.14.0-R1.1"
implementation "net.playeranalytics:Extension-FactionsUUID:1.6.9.5-U0.5.25-R1.1"
implementation "net.playeranalytics:Extension-FastLogin:R1.3"
implementation "net.playeranalytics:Extension-Floodgate:2.2.0-R1.4"
implementation "net.playeranalytics:Extension-GriefDefender:2.1.0-R1.1"
implementation "net.playeranalytics:Extension-GriefPrevention:16.11.6-R1.2"
implementation "net.playeranalytics:Extension-GriefPrevention-Sponge:4.0.1-R1.2"
implementation "net.playeranalytics:Extension-Heroes:R1.2"
implementation "net.playeranalytics:Extension-Jobs:4.16.3-R1.1"
implementation "net.playeranalytics:Extension-KingdomsX:1.12.6.3.1-R1.4"
implementation "net.playeranalytics:Extension-Lands:6.35.0-R1.2"
implementation "net.playeranalytics:Extension-LibertyBans:1.1.0-R1.5"
implementation "net.playeranalytics:Extension-Litebans:0.4.1-R1.5"
implementation "net.playeranalytics:Extension-LogBlock:1.16.1.2-R1.9"
implementation "net.playeranalytics:Extension-LuckPerms:5.0-R1.6"
implementation "net.playeranalytics:Extension-MarriageMaster:2.3-R1.3"
implementation "net.playeranalytics:Extension-McMMO:2.1.149-R2.5"
implementation "net.playeranalytics:Extension-MinigamesLib:1.14.17-R1.2"
implementation "net.playeranalytics:Extension-MyPet:3.10-R1.2"
implementation "net.playeranalytics:Extension-Nucleus:3.0.0-R1.0"
implementation "net.playeranalytics:Extension-nuVotifier:2.3.4-R1.3"
implementation "net.playeranalytics:Extension-PlaceholderAPI:2.10.9-R1.6"
implementation "net.playeranalytics:Extension-PlotSquared:6.9.4-R1.3"
implementation "net.playeranalytics:Extension-ProtectionStones:2.8.2-R1.2"
implementation "net.playeranalytics:Extension-ProtocolSupport:1.16.4-R1.3"
implementation "net.playeranalytics:Extension-Quests:5.0.1-R1.0"
implementation "net.playeranalytics:Extension-React:6.651-R1.1"
implementation "net.playeranalytics:Extension-RedProtect:7.7.3-R1.1"
implementation "net.playeranalytics:Extension-Sponge-Economy:8.0.0-R1.3"
implementation "net.playeranalytics:Extension-SuperbVote:0.5.4-R1.1"
implementation "net.playeranalytics:Extension-Tebex:R2.4"
implementation "net.playeranalytics:Extension-Towny:0.99-R1.3"
implementation "net.playeranalytics:Extension-Vault:1.7-R1.3"
implementation "net.playeranalytics:Extension-ViaVersion:4.0.1-R1.5"
}

View File

@ -1,34 +1,44 @@
apply plugin: 'fabric-loom'
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.fabricmc.loom.task.RemapJarTask
apply plugin: "fabric-loom"
apply plugin: "com.gradleup.shadow"
configurations {
shade
implementation.extendsFrom shade
}
dependencies {
shadow project(path: ":api")
shadow project(path: ":extensions")
shadow project(path: ":common")
shadow project(path: ":common", configuration: "swaggerJson")
shade project(":common")
shadow "net.playeranalytics:platform-abstraction-layer-api:$palVersion"
// Shadow configuration required to only relocate adventure calls in ComponentConverter, not whole plugin
shade project(path: ":extensions:adventure", configuration: "shadow")
implementation "net.playeranalytics:platform-abstraction-layer-api:$palVersion"
// https://wiki.fabricmc.net/tutorial:migratemappings
minecraft "com.mojang:minecraft:1.21.3"
mappings "net.fabricmc:yarn:1.21.3+build.2:v2"
modImplementation "net.fabricmc:fabric-loader:0.16.9"
modImplementation('me.lucko:fabric-permissions-api:0.3.3')
modImplementation("me.lucko:fabric-permissions-api:0.3.3")
// Fabric API
Set<String> apiModules = [
'fabric-api-base',
'fabric-command-api-v2',
'fabric-entity-events-v1',
'fabric-lifecycle-events-v1',
'fabric-networking-api-v1',
'fabric-message-api-v1'
"fabric-api-base",
"fabric-command-api-v2",
"fabric-entity-events-v1",
"fabric-lifecycle-events-v1",
"fabric-networking-api-v1",
"fabric-message-api-v1"
]
apiModules.forEach {
modImplementation(fabricApi.module(it, "0.114.0+1.21.3"))
}
testImplementation project(path: ":common", configuration: 'testArtifacts')
testImplementation(testFixtures(project(":common")))
testImplementation(project(":extensions:adventure"))
}
loom {
@ -41,20 +51,15 @@ tasks.withType(JavaCompile).configureEach {
}
processResources {
inputs.property "version", project.ext.fullVersion
inputs.property "version", fullVersion
filesMatching("fabric.mod.json") {
expand "version": project.ext.fullVersionSemantic
expand "version": fullVersionSemantic
}
}
shadowJar {
configurations = [project.configurations.shadow]
from findProject(':extensions:adventure').tasks.shadowJar.archiveFile
exclude('net.fabricmc:*')
exclude('/mappings/')
tasks.named("shadowJar", ShadowJar) {
configurations = [project.configurations.shade]
// Exclude these files
exclude "**/*.svg"
@ -65,16 +70,16 @@ shadowJar {
exclude "**/module-info.class"
exclude "module-info.class"
exclude 'META-INF/versions/' // Causes Sponge to crash
exclude 'mozilla/**/*'
exclude "META-INF/versions/" // Causes Sponge to crash
exclude "mozilla/**/*"
// Exclude extra dependencies
exclude 'org/apache/http/**/*' // Unnecessary http client depended on by geolite2 implementation
exclude "org/junit/**/*" // see extensions/build.gradle
exclude "org/opentest4j/**/*" // see extensions/build.gradle
exclude "org/checkerframework/**/*" // Dagger compiler
exclude "com/google/common/**/*"
exclude "com/google/thirdparty/**/*"
exclude "com/google/auto/**/*"
exclude "org.javassist:.*"
// Exclude swagger
exclude "org/yaml/**/*"
exclude "nonapi/**/*"
@ -87,45 +92,45 @@ shadowJar {
exclude "jakarta/xml/**/*"
exclude "javassist/**/*"
relocate('org.apache', 'plan.org.apache') {
exclude 'org/apache/logging/**'
relocate("org.apache", "plan.org.apache") {
exclude "org/apache/logging/**"
exclude "org/apache/maven/**" // This needs to be unrelocated for Sponge
}
relocate 'dagger', 'plan.dagger'
// Don't relocate MySQL or SQLite since they are loaded with a isolated class loader
// relocate 'org.sqlite', 'plan.org.sqlite'
// relocate 'com.mysql', 'plan.com.mysql'
// relocate 'com.google.protobuf', 'plan.com.mysql.cj.x.google.protobuf'
relocate 'javax.inject', 'plan.javax.inject'
relocate 'com.github.benmanes', 'plan.com.github.benmanes'
relocate 'dev.vankka.dependencydownload', 'plan.dev.vankka.dependencydownload'
// relocate "org.sqlite", "plan.org.sqlite"
// relocate "com.mysql", "plan.com.mysql"
// relocate "com.google.protobuf", "plan.com.mysql.cj.x.google.protobuf"
relocate 'com.maxmind', 'plan.com.maxmind'
relocate 'com.fasterxml', 'plan.com.fasterxml'
relocate 'com.zaxxer', 'plan.com.zaxxer'
relocate 'com.google.gson', 'plan.com.google.gson'
relocate 'com.google.errorprone', 'plan.com.google.errorprone'
relocate 'org.bstats', 'plan.org.bstats'
relocate "dagger", "plan.dagger"
relocate "javax.inject", "plan.javax.inject"
relocate "jakarta.inject", "plan.jakarta.inject"
relocate 'org.eclipse.jetty', 'plan.org.eclipse.jetty'
relocate 'jakarta.servlet', 'plan.jakarta.servlet'
relocate 'javax.servlet', 'plan.javax.servlet'
relocate "dev.vankka.dependencydownload", "plan.dev.vankka.dependencydownload"
relocate "com.github.benmanes", "plan.com.github.benmanes"
relocate "com.maxmind", "plan.com.maxmind"
relocate "com.fasterxml", "plan.com.fasterxml"
relocate "com.zaxxer", "plan.com.zaxxer"
relocate "com.google.gson", "plan.com.google.gson"
relocate "com.google.errorprone", "plan.com.google.errorprone"
relocate "org.bstats", "plan.org.bstats"
relocate "org.jasypt", "plan.org.jasypt"
relocate "org.json.simple", "plan.org.json.simple"
relocate "org.slf4j", "plan.org.slf4j"
relocate 'org.slf4j', 'plan.org.slf4j'
relocate 'org.json.simple', 'plan.org.json.simple'
relocate "org.eclipse.jetty", "plan.org.eclipse.jetty"
relocate "jakarta.servlet", "plan.jakarta.servlet"
relocate "javax.servlet", "plan.javax.servlet"
mergeServiceFiles()
}
remapJar {
tasks.register("remapShadowJar", RemapJarTask) {
dependsOn tasks.shadowJar
mustRunAfter tasks.shadowJar
inputFile = shadowJar.archiveFile.get()
input = tasks.shadowJar.archiveFile
addNestedDependencies = true
destinationDirectory.set(file("$rootDir/builds/"))
archiveBaseName.set('PlanFabric')
archiveClassifier.set('')
archiveBaseName.set("PlanFabric")
}
shadowJar.finalizedBy(remapJar)
tasks.assemble.dependsOn tasks.remapShadowJar

View File

@ -1,3 +1,5 @@
apply plugin: "com.gradleup.shadow"
tasks.withType(JavaCompile).configureEach {
options.release.set(17)
}
@ -5,7 +7,3 @@ tasks.withType(JavaCompile).configureEach {
dependencies {
runtimeOnly "net.playeranalytics:platform-abstraction-layer-folia:$palVersion"
}
shadowJar {
configurations = [project.configurations.shadow]
}

View File

@ -4,19 +4,22 @@ repositories {
}
dependencies {
implementation project(":api")
implementation project(":common")
shadow "net.playeranalytics:platform-abstraction-layer-api:$palVersion"
shadow "net.playeranalytics:platform-abstraction-layer-nukkit:$palVersion"
implementation "net.playeranalytics:platform-abstraction-layer-nukkit:$palVersion"
compileOnly "cn.nukkit:nukkit:$nukkitVersion"
compileOnly "com.creeperface.nukkit.placeholderapi:PlaceholderAPI:$nkPlaceholderapiVersion"
testImplementation "cn.nukkit:nukkit:$nukkitVersion"
testImplementation project(path: ":common", configuration: 'testArtifacts')
testImplementation(testFixtures(project(":common")))
testImplementation(project(":extensions:adventure"))
}
shadowJar {
configurations = [project.configurations.shadow]
}
processResources {
inputs.property("version", fullVersion)
filesMatching("nukkit.yml") {
expand("version": fullVersion)
}
}

View File

@ -1,7 +1,7 @@
name: Plan
author: AuroraLS3
main: com.djrapitops.plan.PlanNukkit
version: "@version@"
version: "${version}"
api: ["1.0.5"]
softdepend: ["PlaceholderAPI"]
@ -70,4 +70,4 @@ permissions:
plan.ignore.commanduse:
default: false
plan.ignore.afk:
default: false
default: false

View File

@ -1,35 +1,34 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
apply plugin: "com.gradleup.shadow"
logger.lifecycle("Building artifact for version $fullVersion / $fullVersionFilename / $fullVersionSemantic")
dependencies {
shadow project(path: ":api")
shadow project(path: ":extensions")
shadow project(path: ":common")
shadow project(path: ":common", configuration: "swaggerJson")
shadow project(path: ":bukkit")
shadow project(path: ":nukkit")
shadow project(path: ":sponge")
shadow project(path: ":bungeecord")
shadow project(path: ":velocity")
shadow project(path: ":folia")
testImplementation project(path: ":common", configuration: 'testArtifacts')
testImplementation project(path: ":bukkit", configuration: 'testArtifacts')
testImplementation project(path: ":nukkit", configuration: 'testArtifacts')
testImplementation project(path: ":sponge", configuration: 'testArtifacts')
testImplementation project(path: ":bungeecord", configuration: 'testArtifacts')
testImplementation project(path: ":velocity", configuration: 'testArtifacts')
implementation project(":api")
implementation project(":extensions")
implementation project(":common")
implementation project(":bukkit")
implementation project(":nukkit")
implementation project(":sponge")
implementation project(":bungeecord")
implementation project(":velocity")
// Shadow configuration required to depend on Folia due to newer Java version
implementation project(path: ":folia", configuration: "shadow")
// Shadow configuration required to only relocate adventure calls in ComponentConverter, not whole plugin
implementation project(path: ":extensions:adventure", configuration: "shadow")
}
jar {
// Add the sponge mixin into the manifest
manifest.attributes([
'MixinConfigs': 'plan-sponge.mixins.json'
"MixinConfigs": "plan-sponge.mixins.json"
])
}
shadowJar {
dependsOn processResources
configurations = [project.configurations.shadow]
from findProject(':extensions:adventure').tasks.shadowJar.archiveFile
tasks.named("shadowJar", ShadowJar) {
// Exclude these files
exclude "**/*.svg"
exclude "**/*.psd"
@ -39,16 +38,16 @@ shadowJar {
exclude "**/module-info.class"
exclude "module-info.class"
exclude 'META-INF/versions/' // Causes Sponge to crash
exclude 'mozilla/**/*'
exclude "META-INF/versions/" // Causes Sponge to crash
exclude "mozilla/**/*"
// Exclude extra dependencies
exclude 'org/apache/http/**/*' // Unnecessary http client depended on by geolite2 implementation
exclude "org/junit/**/*" // see extensions/build.gradle
exclude "org/opentest4j/**/*" // see extensions/build.gradle
exclude "org/checkerframework/**/*" // Dagger compiler
exclude "com/google/common/**/*"
exclude "com/google/thirdparty/**/*"
exclude "com/google/auto/**/*"
exclude "org.javassist:.*"
// Exclude swagger
exclude "org/yaml/**/*"
exclude "nonapi/**/*"
@ -61,54 +60,56 @@ shadowJar {
exclude "jakarta/xml/**/*"
exclude "javassist/**/*"
relocate('org.slf4j', 'plan.org.slf4j')
relocate("org.slf4j", "plan.org.slf4j")
// Unrelocate a package to use platform version of some libraries that were relocated in Plan
exclude "com/djrapitops/plan/unrelocate/**/*"
relocate('com.djrapitops.plan.unrelocate.', '')
relocate("com.djrapitops.plan.unrelocate.", "")
relocate('org.apache', 'plan.org.apache') {
exclude 'org/apache/logging/**'
exclude 'org/apache/maven/**' // This needs to be unrelocated for Sponge
relocate("org.apache", "plan.org.apache") {
exclude "org/apache/logging/**"
exclude "org/apache/maven/**" // This needs to be unrelocated for Sponge
}
relocate 'dagger', 'plan.dagger'
// Don't relocate MySQL or SQLite since they are loaded with a isolated class loader
// relocate 'org.sqlite', 'plan.org.sqlite'
// relocate 'com.mysql', 'plan.com.mysql'
// relocate 'com.google.protobuf', 'plan.com.mysql.cj.x.google.protobuf'
relocate 'javax.inject', 'plan.javax.inject'
relocate 'com.github.benmanes', 'plan.com.github.benmanes'
relocate 'dev.vankka.dependencydownload', 'plan.dev.vankka.dependencydownload'
// relocate "org.sqlite", "plan.org.sqlite"
// relocate "com.mysql", "plan.com.mysql"
// relocate "com.google.protobuf", "plan.com.mysql.cj.x.google.protobuf"
relocate 'com.maxmind', 'plan.com.maxmind'
relocate 'com.fasterxml', 'plan.com.fasterxml'
relocate 'com.zaxxer', 'plan.com.zaxxer'
relocate 'com.google.gson', 'plan.com.google.gson'
relocate 'com.google.errorprone', 'plan.com.google.errorprone'
relocate 'org.bstats', 'plan.org.bstats'
relocate "dagger", "plan.dagger"
relocate "javax.inject", "plan.javax.inject"
relocate "jakarta.inject", "plan.jakarta.inject"
relocate 'org.eclipse.jetty', 'plan.org.eclipse.jetty'
relocate 'jakarta.servlet', 'plan.jakarta.servlet'
relocate 'javax.servlet', 'plan.javax.servlet'
relocate "dev.vankka.dependencydownload", "plan.dev.vankka.dependencydownload"
relocate "com.github.benmanes", "plan.com.github.benmanes"
relocate "com.maxmind", "plan.com.maxmind"
relocate "com.fasterxml", "plan.com.fasterxml"
relocate "com.zaxxer", "plan.com.zaxxer"
relocate "com.google.gson", "plan.com.google.gson"
relocate "com.google.errorprone", "plan.com.google.errorprone"
relocate "org.bstats", "plan.org.bstats"
relocate "org.jasypt", "plan.org.jasypt"
relocate 'org.json.simple', 'plan.org.json.simple'
relocate "org.eclipse.jetty", "plan.org.eclipse.jetty"
relocate "jakarta.servlet", "plan.jakarta.servlet"
relocate "javax.servlet", "plan.javax.servlet"
relocate "org.json.simple", "plan.org.json.simple"
destinationDirectory.set(file("$rootDir/builds/"))
archiveBaseName.set('Plan')
archiveClassifier.set('')
archiveBaseName.set("Plan")
archiveClassifier.set("")
mergeServiceFiles()
build {
dependsOn tasks.named("shadowJar")
}
}
tasks.assemble.dependsOn tasks.shadowJar
publishing {
publications {
mavenJava(MavenPublication) {
groupId = 'com.djrapitops'
artifactId = 'Plan-plugin'
groupId = "com.djrapitops"
artifactId = "Plan-plugin"
version = "$fullVersion"
artifact shadowJar

View File

@ -1,11 +1,11 @@
pluginManagement {
repositories {
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
name = "Fabric"
url = "https://maven.fabricmc.net/"
}
maven {
name = 'Sponge'
name = "Sponge"
url = "https://repo.spongepowered.org/repository/maven-public/"
}
mavenCentral()
@ -13,17 +13,17 @@ pluginManagement {
}
}
rootProject.name = 'Plan'
rootProject.name = "Plan"
include 'api'
include 'common'
include 'bukkit'
include 'sponge'
include 'nukkit'
include 'bungeecord'
include 'velocity'
include 'plugin'
include 'extensions'
include 'extensions:adventure'
include 'fabric'
include 'folia'
include "api"
include "common"
include "bukkit"
include "sponge"
include "nukkit"
include "bungeecord"
include "velocity"
include "plugin"
include "extensions"
include "extensions:adventure"
include "fabric"
include "folia"

View File

@ -7,18 +7,18 @@ plugins {
}
dependencies {
implementation project(":api")
implementation project(":common")
shadow "net.playeranalytics:platform-abstraction-layer-api:$palVersion"
shadow "net.playeranalytics:platform-abstraction-layer-sponge:$palVersion"
shadow "org.bstats:bstats-sponge:$bstatsVersion"
implementation "net.playeranalytics:platform-abstraction-layer-sponge:$palVersion"
implementation "org.bstats:bstats-sponge:$bstatsVersion"
implementation "com.google.code.gson:gson:$gsonVersion"
annotationProcessor "org.spongepowered:spongeapi:$spongeVersion"
compileOnly "org.spongepowered:mixin:0.8.7"
testImplementation "org.spongepowered:spongeapi:$spongeVersion"
testImplementation project(path: ":common", configuration: 'testArtifacts')
testImplementation(testFixtures(project(":common")))
testImplementation(project(":extensions:adventure"))
}
sponge {
@ -75,9 +75,3 @@ minecraft {
compileJava {
options.release = 11
}
shadowJar {
configurations = [project.configurations.shadow]
relocate "org.bstats", "net.playeranalytics.bstats.utilities.metrics"
}

View File

@ -3,16 +3,14 @@ plugins {
}
blossom {
replaceTokenIn('src/main/java/com/djrapitops/plan/PlanVelocity.java')
replaceToken('@version@', "$fullVersion")
replaceTokenIn("src/main/java/com/djrapitops/plan/PlanVelocity.java")
replaceToken("@version@", "$fullVersion")
}
dependencies {
implementation project(":api")
implementation project(":common")
shadow "net.playeranalytics:platform-abstraction-layer-api:$palVersion"
shadow "net.playeranalytics:platform-abstraction-layer-velocity:$palVersion"
implementation "net.playeranalytics:platform-abstraction-layer-velocity:$palVersion"
compileOnly "com.velocitypowered:velocity-api:$velocityVersion"
annotationProcessor "com.velocitypowered:velocity-api:$velocityVersion"
@ -20,10 +18,6 @@ dependencies {
testImplementation "com.velocitypowered:velocity-api:$velocityVersion"
testImplementation "com.github.ProxioDev.ValioBungee:RedisBungee-API:$redisBungeeProxioDevVersion"
testImplementation project(path: ":common", configuration: 'testArtifacts')
}
shadowJar {
configurations = [project.configurations.shadow]
relocate 'org.bstats', 'net.playeranalytics.bstats.utilities.metrics'
testImplementation(testFixtures(project(":common")))
testImplementation(project(":extensions:adventure"))
}