build.gradle.kts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. buildscript {
  2. repositories {
  3. mavenCentral()
  4. gradlePluginPortal()
  5. }
  6. dependencies {
  7. classpath("org.jreleaser:jreleaser-gradle-plugin:1.18.0")
  8. }
  9. }
  10. // Top-level build file where you can add configuration options common to all sub-projects/modules.
  11. plugins {
  12. alias(libs.plugins.androidApplication) apply false
  13. alias(libs.plugins.jetbrainsKotlinAndroid) apply false
  14. alias(libs.plugins.androidLibrary) apply false
  15. id("org.jreleaser") version "1.17.0" apply false
  16. }
  17. // Read version from spine-libgdx gradle.properties to ensure consistency
  18. fun getSpineVersion(): String {
  19. val spineLibgdxPropsFile = File(project.projectDir, "../spine-libgdx/gradle.properties")
  20. if (!spineLibgdxPropsFile.exists()) {
  21. throw GradleException("spine-libgdx gradle.properties file not found at ${spineLibgdxPropsFile.absolutePath}")
  22. }
  23. val lines = spineLibgdxPropsFile.readLines()
  24. for (line in lines) {
  25. if (line.startsWith("version=")) {
  26. return line.split("=")[1].trim()
  27. }
  28. }
  29. throw GradleException("version property not found in spine-libgdx gradle.properties")
  30. }
  31. // Placeholder functions - you need to implement these correctly!
  32. fun getRepositoryUsername(): String {
  33. // Example: return project.findProperty("mavenCentralUsername") as? String ?: System.getenv("MAVEN_CENTRAL_USERNAME") ?: ""
  34. return project.findProperty("sonatypeUsername") as? String ?: System.getenv("SONATYPE_USERNAME") ?: throw GradleException("Sonatype username not set")
  35. }
  36. fun getRepositoryPassword(): String {
  37. // Example: return project.findProperty("mavenCentralPassword") as? String ?: System.getenv("MAVEN_CENTRAL_PASSWORD") ?: ""
  38. return project.findProperty("sonatypePassword") as? String ?: System.getenv("SONATYPE_PASSWORD") ?: throw GradleException("Sonatype password not set")
  39. }
  40. allprojects {
  41. group = "com.esotericsoftware.spine"
  42. version = getSpineVersion()
  43. }
  44. // Add a clean task for JReleaser
  45. tasks.register("clean") {
  46. description = "Clean root project"
  47. }