[libgdx] Gradle and Maven updated to Java 16.

This commit is contained in:
Nathan Sweet 2025-03-29 18:12:27 -04:00
parent 79c832793d
commit d474e0d66a
3 changed files with 131 additions and 131 deletions

View File

@ -1,84 +1,84 @@
ext { ext {
libgdxVersion = "1.12.2-SNAPSHOT" libgdxVersion = "1.12.2-SNAPSHOT"
} }
allprojects { allprojects {
apply plugin: "java" apply plugin: "java"
sourceSets.main.java.srcDirs = ["src"] sourceSets.main.java.srcDirs = ["src"]
repositories { repositories {
mavenLocal() mavenLocal()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" } maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
mavenCentral() mavenCentral()
} }
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
sourceCompatibility = '1.7' sourceCompatibility = '16'
targetCompatibility = '1.7' targetCompatibility = '16'
options.release.set(7) // Ensures Java 8 bytecode is produced options.release.set(16)
} }
} }
project("spine-libgdx") { project("spine-libgdx") {
apply plugin: "java-library" apply plugin: "java-library"
apply plugin: "maven-publish" apply plugin: "maven-publish"
apply plugin: "signing" apply plugin: "signing"
sourceSets { sourceSets {
main { main {
resources { resources {
srcDirs = ["src"] // Add this line to include non-Java files from src directory srcDirs = ["src"] // Add this line to include non-Java files from src directory
include "**/*.gwt.xml" // Add this to specifically include GWT module files include "**/*.gwt.xml" // Add this to specifically include GWT module files
} }
} }
} }
dependencies { dependencies {
implementation "com.badlogicgames.gdx:gdx:$libgdxVersion" implementation "com.badlogicgames.gdx:gdx:$libgdxVersion"
} }
} }
apply from: 'publishing.gradle' apply from: 'publishing.gradle'
project("spine-skeletonviewer") { project("spine-skeletonviewer") {
jar { jar {
duplicatesStrategy = DuplicatesStrategy.INCLUDE duplicatesStrategy = DuplicatesStrategy.INCLUDE
manifest { manifest {
attributes "Main-Class": "com.esotericsoftware.spine.SkeletonViewer" attributes "Main-Class": "com.esotericsoftware.spine.SkeletonViewer"
} }
from { from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
} }
dependsOn(project(":spine-libgdx").tasks.named('jar')) dependsOn(project(":spine-libgdx").tasks.named('jar'))
} }
tasks.named('build').configure { tasks.named('build').configure {
dependsOn(tasks.named('jar')) dependsOn(tasks.named('jar'))
} }
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
sourceCompatibility = '1.8' sourceCompatibility = '16'
targetCompatibility = '1.8' targetCompatibility = '16'
options.release.set(8) // Ensures Java 8 bytecode is produced options.release.set(16)
} }
} }
configure(subprojects - project("spine-libgdx")) { configure(subprojects - project("spine-libgdx")) {
sourceSets.main.resources.srcDirs = ["assets"] sourceSets.main.resources.srcDirs = ["assets"]
dependencies { dependencies {
implementation project(":spine-libgdx") implementation project(":spine-libgdx")
implementation "com.badlogicgames.gdx:gdx:$libgdxVersion" implementation "com.badlogicgames.gdx:gdx:$libgdxVersion"
implementation "com.badlogicgames.gdx:gdx-platform:$libgdxVersion:natives-desktop" implementation "com.badlogicgames.gdx:gdx-platform:$libgdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$libgdxVersion" implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$libgdxVersion"
implementation "com.badlogicgames.gdx:gdx-box2d:$libgdxVersion" implementation "com.badlogicgames.gdx:gdx-box2d:$libgdxVersion"
implementation "com.badlogicgames.gdx:gdx-box2d-platform:$libgdxVersion:natives-desktop" implementation "com.badlogicgames.gdx:gdx-box2d-platform:$libgdxVersion:natives-desktop"
} }
} }
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
println "Building with sourceCompatibility = ${sourceCompatibility}, targetCompatibility = ${targetCompatibility}" println "Building with sourceCompatibility = ${sourceCompatibility}, targetCompatibility = ${targetCompatibility}"
} }

View File

@ -1,89 +1,89 @@
ext { ext {
libraryVersion = "4.2.9-SNAPSHOT" libraryVersion = "4.2.9-SNAPSHOT"
} }
project("spine-libgdx") { project("spine-libgdx") {
apply plugin: "java-library" apply plugin: "java-library"
apply plugin: "maven-publish" apply plugin: "maven-publish"
apply plugin: "signing" apply plugin: "signing"
dependencies { dependencies {
implementation "com.badlogicgames.gdx:gdx:$libgdxVersion" implementation "com.badlogicgames.gdx:gdx:$libgdxVersion"
} }
tasks.register("sourceJar", Jar) { tasks.register("sourceJar", Jar) {
archiveClassifier.set("sources") archiveClassifier.set("sources")
from(sourceSets.main.allJava) from(sourceSets.main.allJava)
} }
tasks.javadoc { tasks.javadoc {
failOnError = false failOnError = false
} }
tasks.register("javadocJar", Jar) { tasks.register("javadocJar", Jar) {
dependsOn javadoc dependsOn javadoc
archiveClassifier.set("javadoc") archiveClassifier.set("javadoc")
from(javadoc.destinationDir) from(javadoc.destinationDir)
} }
afterEvaluate { afterEvaluate {
publishing { publishing {
publications { publications {
create("release", MavenPublication) { create("release", MavenPublication) {
from(components.java) from(components.java)
artifact(tasks.getByName("sourceJar")) artifact(tasks.getByName("sourceJar"))
artifact(tasks.getByName("javadocJar")) artifact(tasks.getByName("javadocJar"))
groupId = "com.esotericsoftware.spine" groupId = "com.esotericsoftware.spine"
artifactId = "spine-libgdx" artifactId = "spine-libgdx"
version = libraryVersion version = libraryVersion
pom { pom {
packaging = "jar" packaging = "jar"
name.set("spine-libgdx") name.set("spine-libgdx")
description.set("Spine Runtime for libGDX") description.set("Spine Runtime for libGDX")
url.set("https://github.com/esotericsoftware/spine-runtimes") url.set("https://github.com/esotericsoftware/spine-runtimes")
licenses { licenses {
license { license {
name.set("Spine Runtimes License") name.set("Spine Runtimes License")
url.set("https://esotericsoftware.com/spine-runtimes-license") url.set("https://esotericsoftware.com/spine-runtimes-license")
} }
} }
developers { developers {
developer { developer {
name.set("Esoteric Software") name.set("Esoteric Software")
email.set("contact@esotericsoftware.com") email.set("contact@esotericsoftware.com")
} }
} }
scm { scm {
url.set(pom.url.get()) url.set(pom.url.get())
connection.set("scm:git:${url.get()}.git") connection.set("scm:git:${url.get()}.git")
developerConnection.set("scm:git:${url.get()}.git") developerConnection.set("scm:git:${url.get()}.git")
} }
} }
} }
} }
repositories { repositories {
maven { maven {
name = "SonaType" name = "SonaType"
url = uri(libraryVersion.endsWith("-SNAPSHOT") ? url = uri(libraryVersion.endsWith("-SNAPSHOT") ?
"https://oss.sonatype.org/content/repositories/snapshots" : "https://oss.sonatype.org/content/repositories/snapshots" :
"https://oss.sonatype.org/service/local/staging/deploy/maven2") "https://oss.sonatype.org/service/local/staging/deploy/maven2")
credentials { credentials {
username = project.findProperty("ossrhUsername") username = project.findProperty("ossrhUsername")
password = project.findProperty("ossrhPassword") password = project.findProperty("ossrhPassword")
} }
} }
} }
} }
if (!libraryVersion.endsWith("-SNAPSHOT")) { if (!libraryVersion.endsWith("-SNAPSHOT")) {
signing { signing {
useGpgCmd() useGpgCmd()
sign(publishing.publications["release"]) sign(publishing.publications["release"])
} }
} }
} }
} }

View File

@ -76,8 +76,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version> <version>3.1</version>
<configuration> <configuration>
<source>1.7</source> <source>16</source>
<target>1.7</target> <target>16</target>
<fork>true</fork> <fork>true</fork>
<showWarnings>true</showWarnings> <showWarnings>true</showWarnings>
</configuration> </configuration>