build.gradle 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. apply plugin: 'application'
  2. java.sourceCompatibility = 21
  3. java.targetCompatibility = 21
  4. if (JavaVersion.current().isJava9Compatible()) {
  5. compileJava.options.release.set(21)
  6. }
  7. application.mainClass = 'me.lethunderhawk.server.ServerLauncher'
  8. application.applicationName = appName
  9. eclipse.project.name = appName + '-server'
  10. dependencies {
  11. implementation project(':shared')
  12. implementation project(":core")
  13. implementation "com.esotericsoftware:kryonet:2.22.0-RC1"
  14. }
  15. jar {
  16. archiveBaseName.set(appName)
  17. // the duplicatesStrategy matters starting in Gradle 7.0; this setting works.
  18. duplicatesStrategy = DuplicatesStrategy.EXCLUDE
  19. dependsOn configurations.runtimeClasspath
  20. from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
  21. // these "exclude" lines remove some unnecessary duplicate files in the output JAR.
  22. exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA')
  23. dependencies {
  24. exclude('META-INF/INDEX.LIST', 'META-INF/maven/**')
  25. }
  26. // setting the manifest makes the JAR runnable.
  27. // enabling native access helps avoid a warning when Java 24 or later runs the JAR.
  28. manifest {
  29. attributes 'Main-Class': application.mainClass, 'Enable-Native-Access': 'ALL-UNNAMED', 'Multi-Release': 'true'
  30. }
  31. // this last step may help on some OSes that need extra instruction to make runnable JARs.
  32. doLast {
  33. file(archiveFile).setExecutable(true, false)
  34. }
  35. }
  36. // Equivalent to the jar task; here for compatibility with gdx-setup.
  37. task dist(dependsOn: [jar]) {
  38. }