Skip to content

Commit

Permalink
transition from Gradle's Groovy DSL to its Kotlin DSL
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed May 22, 2024
1 parent f22189b commit 01a8a93
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 121 deletions.
106 changes: 0 additions & 106 deletions build.gradle

This file was deleted.

109 changes: 109 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// Gradle script to build the Maud project

import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform

plugins {
application // to build JVM applications
checkstyle // to analyze Java sourcecode for style violations
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.register<JavaExec>("runForceDialog") {
args("--forceDialog")
mainClass = "maud.Maud"
description = "Runs the editor after displaying the Settings dialog."
}

application {
mainClass = "maud.Maud"
}

checkstyle {
toolVersion = libs.versions.checkstyle.get()
}

tasks.withType<JavaCompile>().all { // Java compile-time options:
options.compilerArgs.add("-Xdiags:verbose")
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_20)) {
// Suppress warnings that source value 8 is obsolete.
options.compilerArgs.add("-Xlint:-options")
}
options.compilerArgs.add("-Xlint:unchecked")
//options.setDeprecation(true) // to provide detailed deprecation warnings
options.encoding = "UTF-8"
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_1_10)) {
options.release = 8
}
}

val isMacOS = DefaultNativePlatform.getCurrentOperatingSystem().isMacOsX()

tasks.withType<JavaExec>().all { // Java runtime options:
if (isMacOS) {
jvmArgs("-XstartOnFirstThread")
} else {
//args("--forceDialog")
}
//args("--openGL3")
//args("--openGL33")
//args("--skipStartup")
//args("--verbose") // to enable additional log output
classpath = sourceSets.main.get().getRuntimeClasspath()
enableAssertions = true
//jvmArgs("-verbose:gc")
jvmArgs("-Xms4g", "-Xmx4g") // to enlarge the Java heap
//jvmArgs("-XX:+UseG1GC", "-XX:MaxGCPauseMillis=10")
}

configurations.all {
resolutionStrategy.cacheChangingModulesFor(0, "seconds") // to disable caching of snapshots
}

dependencies {
// from mavenCentral (or mavenLocal) repositories:
implementation(libs.acorus)
implementation(libs.heart)
implementation(libs.jme.ttf)
implementation(libs.jme3.blender)
implementation(libs.jme3.lwjgl)
implementation(libs.jme3.plugins)
implementation(libs.jme3.utilities.nifty)
implementation(libs.logback.classic)
implementation(libs.minie)
implementation(libs.skyControl)
implementation(libs.wes)
runtimeOnly(libs.jme3.awt.dialogs)
runtimeOnly(libs.jme3.desktop)
//runtimeOnly(libs.jme3.testdata.old)
runtimeOnly(libs.nashorn.core)
runtimeOnly(libs.nifty.style.black)

// from jitpack repositories:
implementation(libs.jme3.xbuf.loader)
}

// Register cleanup tasks:

tasks.named("clean") {
dependsOn("cleanDLLs", "cleanDyLibs", "cleanLogs", "cleanSOs")
}

tasks.register<Delete>("cleanDLLs") { // extracted Windows native libraries
delete(fileTree(".").matching{ include("*.dll") })
}
tasks.register<Delete>("cleanDyLibs") { // extracted macOS native libraries
delete(fileTree(".").matching{ include("*.dylib") })
}
tasks.register<Delete>("cleanLogs") { // JVM crash logs
delete(fileTree(".").matching{ include("hs_err_pid*.log") })
}
tasks.register<Delete>("cleanSandbox") { // Acorus sandbox
delete("Written Assets")
}
tasks.register<Delete>("cleanSOs") { // extracted Linux and Android native libraries
delete(fileTree(".").matching{ include("*.so") })
}
15 changes: 0 additions & 15 deletions settings.gradle

This file was deleted.

15 changes: 15 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// global build settings for the Maud project

rootProject.name = "Maud"

dependencyResolutionManagement {
repositories {
//mavenLocal() // to find libraries installed locally
mavenCentral() // to find libraries released to the Maven Central repository
maven { url = uri("https://jitpack.io") } // to find jme3_xbuf_loader
//maven { url = uri("https://s01.oss.sonatype.org/content/groups/staging") } // to find libraries staged but not yet released
//maven { url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots") } // to find public snapshots of libraries
}
}

// no subprojects

0 comments on commit 01a8a93

Please sign in to comment.