72 lines
2.1 KiB
Groovy
72 lines
2.1 KiB
Groovy
|
|
plugins {
|
|
id 'java'
|
|
id 'eclipse'
|
|
id "org.jetbrains.gradle.plugin.idea-ext" version "1.0.1"
|
|
}
|
|
|
|
group = 'com.alttd'
|
|
version = '1.1-SNAPSHOT'
|
|
|
|
repositories {
|
|
maven {
|
|
name = 'papermc'
|
|
url = 'https://repo.papermc.io/repository/maven-public/'
|
|
}
|
|
mavenCentral() // Add this to ensure access to JUnit libraries
|
|
}
|
|
|
|
dependencies {
|
|
compileOnly 'com.velocitypowered:velocity-api:3.4.0-SNAPSHOT'
|
|
annotationProcessor 'com.velocitypowered:velocity-api:3.4.0-SNAPSHOT'
|
|
implementation 'org.spongepowered:configurate-yaml:4.1.2'
|
|
implementation 'org.spongepowered:configurate-core:4.1.2'
|
|
|
|
// JUnit Jupiter dependencies
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0'
|
|
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.0'
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.0'
|
|
|
|
// Enable JUnit tests
|
|
testImplementation 'org.junit.platform:junit-platform-launcher'
|
|
}
|
|
|
|
def targetJavaVersion = 21
|
|
java {
|
|
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
|
|
sourceCompatibility = javaVersion
|
|
targetCompatibility = javaVersion
|
|
if (JavaVersion.current() < javaVersion) {
|
|
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
|
|
}
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
|
|
options.release = targetJavaVersion
|
|
}
|
|
}
|
|
|
|
// Add this to run tests with JUnit Jupiter
|
|
test {
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
def templateSource = file('src/main/templates')
|
|
def templateDest = layout.buildDirectory.dir('generated/sources/templates')
|
|
def generateTemplates = tasks.register('generateTemplates', Copy) { task ->
|
|
def props = [
|
|
'version': project.version
|
|
]
|
|
task.inputs.properties props
|
|
|
|
task.from templateSource
|
|
task.into templateDest
|
|
task.expand props
|
|
}
|
|
|
|
sourceSets.main.java.srcDir(generateTemplates.map { it.outputs })
|
|
|
|
rootProject.idea.project.settings.taskTriggers.afterSync generateTemplates
|
|
project.eclipse.synchronizationTasks(generateTemplates)
|