ābuild.gradleā file :
plugins {
id 'application'
id 'java'
id "de.undercouch.download" version "5.1.0"
id 'idea'
id "io.github.0ffz.github-packages" version "1.2.1" // Plugin for anonymous inclusion of artifacts hosted in github package registry
}
description = 'CubeGame application'
java {
sourceCompatibility = '17'
targetCompatibility = '17'
}
ext.jmonkeyengineVersion = '3.6.1-stable'
mainClassName = 'barna.cubegame.CubeGame'
if (!hasProperty('mainClass')) {
ext.mainClass = mainClassName
}
jar.manifest.attributes('Main-Class': mainClassName)
repositories {
maven githubPackage.invoke("riccardobl/undefined")
maven { url "https://jitpack.io" }
mavenCentral()
mavenLocal()
}
application {
if (System.getProperty("os.name").toLowerCase().contains("mac")) {
applicationDefaultJvmArgs = ['-XstartOnFirstThread'] // this is when using a Mac as a development machine which requires the AppKit main UI thread to be used for GUI applications
}
}
dependencies {
// You can read more about how to add dependencies here:
// https://docs.gradle.org/current/userguide/dependency_management.html#sec:how_to_declare_your_dependencies
implementation 'org.jmonkeyengine:jme3-core:' + jmonkeyengineVersion
implementation 'org.jmonkeyengine:jme3-desktop:' + jmonkeyengineVersion
runtimeOnly 'org.jmonkeyengine:jme3-jogg:' + jmonkeyengineVersion
runtimeOnly 'org.jmonkeyengine:jme3-plugins:' + jmonkeyengineVersion
implementation 'org.jmonkeyengine:jme3-niftygui:' + jmonkeyengineVersion
implementation 'org.jmonkeyengine:jme3-effects:' + jmonkeyengineVersion
implementation 'org.jmonkeyengine:jme3-terrain:' + jmonkeyengineVersion
implementation 'org.jmonkeyengine:jme3-jbullet:' + jmonkeyengineVersion
runtimeOnly 'org.jmonkeyengine:jme3-lwjgl3:' + jmonkeyengineVersion
implementation 'com.github.Jeddic:particlemonkey:1.0.2'
implementation 'com.github.joliver82:jme3-wireframe:1.0.2'
implementation 'net.aaaagames:PBRTerrain:1.0.2'
implementation 'com.github.stephengold:Wes:0.7.2'
implementation 'com.github.stephengold:Heart:8.6.0'
implementation 'org.apache.logging.log4j:log4j-core:2.24.0'
implementation 'org.apache.logging.log4j:log4j-api:2.24.0'
implementation 'com.rvandoosselaer:blocks:1.7.0'
implementation 'com.github.grizeldi:HoloShader:-SNAPSHOT'
implementation 'com.github.riccardobl.DDSWriter:dds_writer:1.3.2'
implementation 'com.github.stephengold:Minie:7.7.0'
implementation 'com.simsilica:lemur:1.16.0'
implementation 'com.simsilica:lemur-proto:1.13.0'
implementation 'wf.frk:jme-igui:0.1.2'
}
distZip {
//having a degenerate folder within the dist zip complicates generating the other zips
eachFile { file ->
String path = file.relativePath
file.setPath(path.substring(path.indexOf("/") + 1, path.length()))
}
includeEmptyDirs(false)
}
//See https://api.adoptium.net/v3/assets/feature_releases/11/ga?image_type=jre for jre urls
def windowsJreUrl = "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.6%2B10/OpenJDK17U-jre_x64_windows_hotspot_17.0.6_10.zip"
def linuxJreUrl = "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.6%2B10/OpenJDK17U-jre_x64_linux_hotspot_17.0.6_10.tar.gz"
def macJreUrl = "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.6%2B10/OpenJDK17U-jre_x64_mac_hotspot_17.0.6_10.tar.gz"
task downloadWindowsJre(type: Download) {
src windowsJreUrl
dest new File(buildDir, '/jres/windowsJre.zip')
overwrite false
}
task downloadAndUnzipWindowsJre(dependsOn: downloadWindowsJre, type: Copy) {
from zipTree(downloadWindowsJre.dest)
into "${buildDir}/jres/windowsJre/"
includeEmptyDirs(false)
filesMatching("**") {
it.path = it.path.replaceAll("^[a-zA-Z0-9.+-]*[/\\\\]", "jre/") //rename the top level to something standard so the rest of the script will be easier
}
}
task buildWindowsDistribution(dependsOn: [distZip, downloadAndUnzipWindowsJre], type: Copy)
{
group 'distribution'
from files("${projectDir}/scripts/desktopDeployment/CubeGame.bat"), zipTree(distZip.archiveFile), "${buildDir}/jres/windowsJre"
into new File(buildDir, 'distributions/CubeGame-windows')
includeEmptyDirs false
exclude 'bin/**' //we are adding our own run scripts, exclude the ones coming from distZip
}
task zipWindowsDistribution( dependsOn:buildWindowsDistribution, type: Zip) {
group 'distribution'
archiveFileName = "CubeGame-windows.zip"
destinationDirectory = file("$buildDir/distributions")
from "$buildDir/distributions/CubeGame-windows"
}
task downloadLinuxJre(type: Download) {
src linuxJreUrl
dest new File(buildDir, '/jres/linuxJre.tar.gz')
overwrite false
}
task downloadAndUnzipLinuxJre(dependsOn: downloadLinuxJre, type: Copy) {
from tarTree(downloadLinuxJre.dest)
into "${buildDir}/jres/linuxJre/"
includeEmptyDirs(false)
filesMatching("**") {
it.path = it.path.replaceAll("^[a-zA-Z0-9.+-]*[/\\\\]", "jre/") //rename the top level to something standard so the rest of the script will be easier
}
}
task buildLinuxDistribution(dependsOn: [distZip, downloadAndUnzipLinuxJre], type: Copy)
{
group 'distribution'
from files("${projectDir}/scripts/desktopDeployment/CubeGame.sh"){
fileMode 0755
}
from zipTree(distZip.archiveFile)
from "${buildDir}/jres/linuxJre"
into new File(buildDir, 'distributions/CubeGame-linux')
includeEmptyDirs false
exclude 'bin/**' //we are adding our own run scripts, exclude the ones coming from distZip
}
task zipLinuxDistribution( dependsOn:buildLinuxDistribution, type: Zip) {
group 'distribution'
archiveFileName = "CubeGame-linux.tar.gz"
destinationDirectory = file("$buildDir/distributions")
from ("$buildDir/distributions/CubeGame-linux"){
include('**.sh')
include('**/java')
fileMode 0755
}
from ("$buildDir/distributions/CubeGame-linux"){
exclude('**.sh')
exclude('**/java')
}
}
task downloadMacJre(type: Download) {
src macJreUrl
dest new File(buildDir, '/jres/macJre.tar.gz')
overwrite false
}
task downloadAndUnzipMacJre(dependsOn: downloadMacJre, type: Copy) {
from tarTree(downloadMacJre.dest)
into "${buildDir}/jres/macJre/"
includeEmptyDirs(false)
filesMatching("**") {
it.path = it.path.replaceAll("^[a-zA-Z0-9.+-]*[/\\\\]", "jre/") //rename the top level to something standard so the rest of the script will be easier
}
}
task buildMacDistribution(dependsOn: [distZip, downloadAndUnzipMacJre], type: Copy)
{
group 'distribution'
from files("${projectDir}/scripts/desktopDeployment/CubeGame.command"){
fileMode 0755
}
from zipTree(distZip.archiveFile)
from "${buildDir}/jres/macJre"
into new File(buildDir, 'distributions/CubeGame-mac')
includeEmptyDirs false
exclude 'bin/**' //we are adding our own run scripts, exclude the ones coming from distZip
}
task zipMacDistribution( dependsOn:buildMacDistribution, type: Zip) {
group 'distribution'
archiveFileName = "CubeGame-mac.tar.gz"
destinationDirectory = file("$buildDir/distributions")
from ("$buildDir/distributions/CubeGame-mac"){
include('**.command')
include('**/java')
fileMode 0755
}
from ("$buildDir/distributions/CubeGame-mac"){
exclude('**.command')
exclude('**/java')
}
}
task buildAllDistributions{
group 'distribution'
dependsOn 'zipWindowsDistribution'
dependsOn 'zipLinuxDistribution'
dependsOn 'zipMacDistribution'
doLast {
println("Distributions created in build/distributions folder")
}
}
// cleanup tasks
clean.dependsOn('cleanDLLs', 'cleanDyLibs', 'cleanLogs', 'cleanSOs')
task cleanDLLs(type: Delete) {
delete fileTree(dir: '.', include: '*.dll')
}
task cleanDyLibs(type: Delete) {
delete fileTree(dir: '.', include: '*.dylib')
}
task cleanLogs(type: Delete) {
delete fileTree(dir: '.', include: 'hs_err_pid*.log')
}
task cleanSOs(type: Delete) {
delete fileTree(dir: '.', include: '*.so')
}
task fund(){
doLast {
java.awt.Desktop.desktop.browse "https://start.jmonkeyengine.org/#!funding=JME_DESKTOP,8113%2F189b56af-a1be-4036-8ac7-2b62a94935ff,2466%2Fb37a302d-261d-4823-8208-6b9b45595801,22975%2F2930932e-7688-493a-ad00-bc473df0f076,11511%2F15054f52-c439-4bfb-9a73-80260b486333,11511%2Fe534fc1e-5b78-46b7-a831-d5d40cbd9dcd,LOG4J2,16130%2F1a85df6f-4bb6-4c85-9e77-b5119662ed54,16912%2F435ebd61-fbbc-4e10-a490-234c222b4312,16283%2FDDSWriter,11511%2F38308161-c3cf-4e23-8754-528ca8387c11,LEMUR,16283%2Fjme-igui,JME_NIFTY,JME_EFFECTS,JME_TERRAIN,JME_JBULLET".toURI()
}
}
Nota : I also have 2 errors :
Unresolved dependency: com.rvandoosselaer:blocks:1.7.0
Unresolved dependency: net.aaaagames:PBRTerrain:1.0.2