Files

92 lines
2.8 KiB
Groovy

plugins {
id 'java'
id 'jacoco'
id 'com.gradleup.shadow' version '8.3.6'
}
group = 'top.itxiaohui.serveradvancements'
version = '1.2.0'
repositories {
mavenCentral()
maven { url = 'https://repo.papermc.io/repository/maven-public/' }
}
dependencies {
compileOnly 'io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT'
implementation 'org.xerial:sqlite-jdbc:3.50.3.0'
testImplementation platform('org.junit:junit-bom:5.13.4')
testImplementation 'org.junit.jupiter:junit-jupiter'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testImplementation 'io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT'
testImplementation 'org.mockito:mockito-core:5.18.0'
}
sourceSets {
audit {
java.srcDir 'src/audit/java'
compileClasspath += sourceSets.main.output + configurations.testCompileClasspath + configurations.testRuntimeClasspath
runtimeClasspath += output + compileClasspath
}
probe {
java.srcDir 'src/probe/java'
resources.setSrcDirs(['src/probe/resources'])
compileClasspath += sourceSets.main.output + configurations.compileClasspath
}
}
tasks.register('securityAudit', Test) {
description = 'Security, robustness, persistence and abuse audit; failures identify unmet invariants.'
testClassesDirs = sourceSets.audit.output.classesDirs
classpath = sourceSets.audit.runtimeClasspath
useJUnitPlatform()
maxHeapSize = '1g'
testLogging { events 'passed', 'failed', 'skipped'; exceptionFormat 'short'; showStandardStreams = true }
finalizedBy 'auditCoverage'
}
jacoco { toolVersion = '0.8.13' }
tasks.register('auditCoverage', JacocoReport) {
executionData layout.buildDirectory.file('jacoco/securityAudit.exec')
sourceSets sourceSets.main
reports { xml.required = true; html.required = true }
}
tasks.register('probeJar', Jar) {
description = 'Isolated-server test probe only; never install on production.'
archiveFileName = 'ISA-AuditProbe.jar'
destinationDirectory = layout.buildDirectory.dir('audit-tools')
from sourceSets.probe.output
}
java {
toolchain.languageVersion = JavaLanguageVersion.of(21)
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.release = 21
}
tasks.processResources {
inputs.property('pluginVersion', project.version)
filteringCharset = 'UTF-8'
filesMatching('plugin.yml') {
expand(version: project.version)
}
}
tasks.test {
useJUnitPlatform()
}
tasks.shadowJar {
archiveFileName = 'ItxiaohuiServerAdvancements.jar'
// JNI exports reference org.sqlite classes by their original names.
// The runtime loads this bundled driver in a dedicated child-first classloader.
}
tasks.jar { enabled = false }
tasks.build { dependsOn tasks.shadowJar }