apply plugin: 'application'


java.sourceCompatibility = 21
java.targetCompatibility = 21
if (JavaVersion.current().isJava9Compatible()) {
        compileJava.options.release.set(21)
}

mainClassName = 'com.ghost.technic.server.ServerLauncher'
application.setMainClass(mainClassName)
eclipse.project.name = appName + '-server'

dependencies {
  implementation 'org.projectlombok:lombok:1.18.38'
  annotationProcessor 'org.projectlombok:lombok:1.18.38'

  testImplementation 'org.projectlombok:lombok:1.18.38'
  testAnnotationProcessor 'org.projectlombok:lombok:1.18.38'

  implementation 'ch.qos.logback:logback-classic:1.5.18'
  annotationProcessor 'ch.qos.logback:logback-classic:1.5.18'

  testImplementation 'ch.qos.logback:logback-classic:1.5.18'
  testAnnotationProcessor 'ch.qos.logback:logback-classic:1.5.18'

  testImplementation 'org.slf4j:slf4j-api:2.0.17'
//  testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.13.1'
//  testImplementation 'org.junit.jupiter:junit-jupiter-api:5.13.1'
  testImplementation 'org.junit.jupiter:junit-jupiter-api:5.13.1'
  testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.13.1'
  testImplementation 'org.junit.platform:junit-platform-launcher:1.13.1'
  testImplementation 'org.junit.platform:junit-platform-engine:1.13.1'
}

jar {
  archiveBaseName.set(appName)
// the duplicatesStrategy matters starting in Gradle 7.0; this setting works.
  duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
  dependsOn configurations.runtimeClasspath
  from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
// these "exclude" lines remove some unnecessary duplicate files in the output JAR.
  exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA')
  dependencies {
    exclude('META-INF/INDEX.LIST', 'META-INF/maven/**')
  }
// setting the manifest makes the JAR runnable.
  manifest {
    attributes 'Main-Class': project.mainClassName
  }
// this last step may help on some OSes that need extra instruction to make runnable JARs.
  doLast {
    file(archiveFile).setExecutable(true, false)
  }
}

// Equivalent to the jar task; here for compatibility with gdx-setup.
task dist(dependsOn: [jar]) {
}

test {
  useJUnitPlatform()
}
