build.gradle 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. buildscript {
  2. repositories {
  3. mavenCentral()
  4. gradlePluginPortal()
  5. }
  6. dependencies {
  7. classpath 'org.jreleaser:jreleaser-gradle-plugin:1.18.0'
  8. }
  9. }
  10. ext {
  11. libgdxVersion = { ->
  12. def propsFile = new File(project.projectDir, 'gradle.properties')
  13. if (!propsFile.exists()) {
  14. throw new GradleException("gradle.properties file not found at ${propsFile.absolutePath}")
  15. }
  16. def lines = propsFile.readLines()
  17. for (line in lines) {
  18. if (line.startsWith('libgdx_version=')) {
  19. return line.split('=')[1].trim()
  20. }
  21. }
  22. throw new GradleException("libgdx_version property not found in gradle.properties")
  23. }()
  24. isReleaseBuild = {
  25. return project.hasProperty("RELEASE")
  26. }
  27. getSnapshotRepositoryUrl = {
  28. return project.hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
  29. : "https://central.sonatype.com/repository/maven-snapshots/"
  30. }
  31. getRepositoryUsername = {
  32. return project.hasProperty('MAVEN_USERNAME') ? MAVEN_USERNAME : ""
  33. }
  34. getRepositoryPassword = {
  35. return project.hasProperty('MAVEN_PASSWORD') ? MAVEN_PASSWORD : ""
  36. }
  37. }
  38. allprojects {
  39. apply plugin: "java"
  40. group = 'com.esotericsoftware.spine'
  41. version = project.getProperty('version')
  42. sourceSets.main.java.srcDirs = ["src"]
  43. repositories {
  44. mavenLocal()
  45. maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
  46. maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
  47. mavenCentral()
  48. }
  49. tasks.withType(JavaCompile).configureEach {
  50. sourceCompatibility = '1.8'
  51. targetCompatibility = '1.8'
  52. options.release.set(8)
  53. }
  54. }
  55. project("spine-libgdx") {
  56. apply plugin: "java-library"
  57. apply plugin: "maven-publish"
  58. apply plugin: "signing"
  59. sourceSets {
  60. main {
  61. resources {
  62. srcDirs = ["src"] // Add this line to include non-Java files from src directory
  63. include "**/*.gwt.xml" // Add this to specifically include GWT module files
  64. }
  65. }
  66. }
  67. dependencies {
  68. implementation "com.badlogicgames.gdx:gdx:$libgdxVersion"
  69. }
  70. }
  71. apply from: 'publishing.gradle'
  72. project("spine-skeletonviewer") {
  73. jar {
  74. duplicatesStrategy = DuplicatesStrategy.INCLUDE
  75. manifest {
  76. attributes "Main-Class": "com.esotericsoftware.spine.SkeletonViewer"
  77. }
  78. from {
  79. configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
  80. }
  81. dependsOn(project(":spine-libgdx").tasks.named('jar'))
  82. }
  83. tasks.named('build').configure {
  84. dependsOn(tasks.named('jar'))
  85. }
  86. tasks.withType(JavaCompile).configureEach {
  87. sourceCompatibility = '1.8'
  88. targetCompatibility = '1.8'
  89. options.release.set(8) // Ensures Java 8 bytecode is produced
  90. }
  91. }
  92. configure(subprojects - project("spine-libgdx")) {
  93. sourceSets.main.resources.srcDirs = ["assets"]
  94. dependencies {
  95. implementation project(":spine-libgdx")
  96. implementation "com.badlogicgames.gdx:gdx:$libgdxVersion"
  97. implementation "com.badlogicgames.gdx:gdx-platform:$libgdxVersion:natives-desktop"
  98. implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$libgdxVersion"
  99. implementation "com.badlogicgames.gdx:gdx-box2d:$libgdxVersion"
  100. implementation "com.badlogicgames.gdx:gdx-box2d-platform:$libgdxVersion:natives-desktop"
  101. }
  102. }
  103. tasks.withType(JavaCompile).configureEach {
  104. println "Building with sourceCompatibility = ${sourceCompatibility}, targetCompatibility = ${targetCompatibility}"
  105. }