2025-07-11 14:16:24 +02:00

161 lines
4.4 KiB
Groovy

buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath 'org.jreleaser:jreleaser-gradle-plugin:1.18.0'
}
}
ext {
libgdxVersion = { ->
def propsFile = new File(project.projectDir, 'gradle.properties')
if (!propsFile.exists()) {
throw new GradleException("gradle.properties file not found at ${propsFile.absolutePath}")
}
def lines = propsFile.readLines()
for (line in lines) {
if (line.startsWith('libgdx_version=')) {
return line.split('=')[1].trim()
}
}
throw new GradleException("libgdx_version property not found in gradle.properties")
}()
isReleaseBuild = {
return project.hasProperty("RELEASE")
}
getSnapshotRepositoryUrl = {
return project.hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://central.sonatype.com/repository/maven-snapshots/"
}
getRepositoryUsername = {
return project.hasProperty('MAVEN_USERNAME') ? MAVEN_USERNAME : ""
}
getRepositoryPassword = {
return project.hasProperty('MAVEN_PASSWORD') ? MAVEN_PASSWORD : ""
}
}
allprojects {
apply plugin: "java"
apply plugin: "eclipse"
group = 'com.esotericsoftware.spine'
version = project.getProperty('version')
sourceSets.main.java.srcDirs = ["src"]
repositories {
mavenLocal()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
mavenCentral()
}
// Configure Eclipse plugin to ignore build directories
eclipse {
classpath {
downloadSources = false
downloadJavadoc = false
}
}
// Clean Eclipse files before compiling
tasks.compileJava.dependsOn cleanEclipse
tasks.processResources.dependsOn cleanEclipse
dependencies {
annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:0.4.2'
compileOnly 'com.github.bsideup.jabel:jabel-javac-plugin:0.4.2'
}
tasks.withType(JavaCompile).configureEach {
sourceCompatibility = 17 // for the IDE support
options.release = 8
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(17)
}
}
}
project("spine-libgdx") {
apply plugin: "java-library"
apply plugin: "maven-publish"
apply plugin: "signing"
sourceSets {
main {
resources {
srcDirs = ["src"] // Add this line to include non-Java files from src directory
include "**/*.gwt.xml" // Add this to specifically include GWT module files
}
}
}
dependencies {
implementation "com.badlogicgames.gdx:gdx:$libgdxVersion"
}
}
apply from: 'publishing.gradle'
project("spine-skeletonviewer") {
jar {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
manifest {
attributes "Main-Class": "com.esotericsoftware.spine.SkeletonViewer"
}
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
dependsOn(project(":spine-libgdx").tasks.named('jar'))
}
tasks.named('build').configure {
dependsOn(tasks.named('jar'))
}
tasks.withType(JavaCompile).configureEach {
sourceCompatibility = '17'
targetCompatibility = '17'
options.release.set(17)
}
}
configure(subprojects - project("spine-libgdx")) {
sourceSets.main.resources.srcDirs = ["assets"]
dependencies {
implementation project(":spine-libgdx")
implementation "com.badlogicgames.gdx:gdx:$libgdxVersion"
implementation "com.badlogicgames.gdx:gdx-platform:$libgdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$libgdxVersion"
implementation "com.badlogicgames.gdx:gdx-backend-headless:$libgdxVersion"
implementation "com.badlogicgames.gdx:gdx-box2d:$libgdxVersion"
implementation "com.badlogicgames.gdx:gdx-box2d-platform:$libgdxVersion:natives-desktop"
}
}
project("spine-libgdx-tests") {
task runHeadlessTest(type: JavaExec) {
main = 'com.esotericsoftware.spine.HeadlessTest'
classpath = sourceSets.main.runtimeClasspath
workingDir = rootProject.projectDir
if (project.hasProperty('args')) {
args project.getProperty('args').split(' ')
}
}
}
tasks.withType(JavaCompile).configureEach {
println "Building with sourceCompatibility = ${sourceCompatibility}, targetCompatibility = ${targetCompatibility}"
}