Skip to content

Commit

Permalink
Modify build files for Gradle 8, Java 17
Browse files Browse the repository at this point in the history
  • Loading branch information
gpertzov committed Sep 28, 2024
1 parent 34ebdf0 commit 91b86be
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 82 deletions.
102 changes: 49 additions & 53 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,66 +1,62 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
google()
}
dependencies {
}
repositories {
mavenCentral()
maven { url 'https://s01.oss.sonatype.org' }
gradlePluginPortal()
mavenLocal()
google()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
}
}

allprojects {
apply plugin: "eclipse"
apply plugin: "idea"

version = '1.0'
ext {
appName = "darkly"
gdxVersion = '1.12.1'
roboVMVersion = '2.3.12'
box2DLightsVersion = '1.5'
ashleyVersion = '1.7.3'
aiVersion = '1.8.2'
gdxControllersVersion = '2.1.0'
jUnitVersion = '4.13'
}
apply plugin: 'idea'

repositories {
mavenLocal()
mavenCentral()
google()
gradlePluginPortal()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
// This allows you to "Build and run using IntelliJ IDEA", an option in IDEA's Settings.
idea {
module {
outputDir file('build/classes/java/main')
testOutputDir file('build/classes/java/test')
}
}

repositories {
mavenLocal()
mavenCentral()
google()
gradlePluginPortal()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}

project(":desktop") {
apply plugin: "java-library"

configure(subprojects) {
apply plugin: 'java-library'

dependencies {
implementation project(":core")
api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
}

project(":core") {
apply plugin: "java-library"

test {
useJUnit()
}

dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion"
testImplementation "junit:junit:$jUnitVersion"
}
compileJava {
options.incremental = true
}
}

tasks.eclipse.doLast {
delete ".project"
}
subprojects {
version = '$projectVersion'
ext.appName = 'darkly'
repositories {
mavenCentral()
maven { url 'https://s01.oss.sonatype.org' }
// You may want to remove the following line if you have errors downloading dependencies.
mavenLocal()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
maven { url 'https://jitpack.io' }
}
}
12 changes: 7 additions & 5 deletions core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
sourceCompatibility = 1.8
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

sourceSets.main.java.srcDirs = ["src/main/java"]
sourceSets.test.java.srcDirs = ["src/test/java"]
test {
useJUnit()
}

dependencies {
api "com.badlogicgames.ashley:ashley:$ashleyVersion"
api "com.badlogicgames.gdx:gdx:$gdxVersion"

eclipse.project {
name = appName + "-core"
testImplementation "junit:junit:$jUnitVersion"
}
55 changes: 32 additions & 23 deletions desktop/build.gradle
Original file line number Diff line number Diff line change
@@ -1,39 +1,48 @@
sourceCompatibility = 1.8
sourceSets.main.java.srcDirs = [ "src/" ]
buildscript {
repositories {
gradlePluginPortal()
}
}

dependencies {
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
implementation project(':core')
}

sourceSets.main.java.srcDirs = ["src/"]
sourceSets.main.resources.srcDirs = ["../core/assets"]

project.ext.mainClassName = "net.gpdev.darkly.desktop.DesktopLauncher"
project.ext.assetsDir = new File("../core/assets")

task run(dependsOn: classes, type: JavaExec) {
mainClass = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
mainClass = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
}

task debug(dependsOn: classes, type: JavaExec) {
mainClass = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
debug = true
mainClass = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
debug = true
}

task dist(type: Jar) {
manifest {
attributes 'Main-Class': project.mainClassName
}
dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
with jar
manifest {
attributes 'Main-Class': project.mainClassName
}
dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
with jar
}


dist.dependsOn classes

eclipse.project.name = appName + "-desktop"
6 changes: 5 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
org.gradle.daemon=true
org.gradle.jvmargs=-Xms128m -Xmx1500m
org.gradle.jvmargs=-Xms512M -Xmx1G -Dfile.encoding=UTF-8 -Dconsole.encoding=UTF-8
org.gradle.configureondemand=false
ashleyVersion=1.7.4
gdxVersion=1.12.1
jUnitVersion=4.13
projectVersion=1.0.0

0 comments on commit 91b86be

Please sign in to comment.