Ephemis/build.gradle

221 lines
8.2 KiB
Groovy

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 = 'Ephemia application'
java {
sourceCompatibility = '17'
targetCompatibility = '17'
}
ext.jmonkeyengineVersion = '3.5.2-stable'
mainClassName = 'io.github.simplexdevelopment.Ephemia'
if (!hasProperty('mainClass')) {
ext.mainClass = mainClassName
}
jar.manifest.attributes('Main-Class': mainClassName)
repositories {
maven { url "https://jcenter.bintray.com" }
maven { url "https://jitpack.io" }
mavenCentral()
mavenLocal()
}
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.jetbrains:annotations:20.1.0'
runtimeOnly 'org.jmonkeyengine:jme3-jogg:' + jmonkeyengineVersion
runtimeOnly 'org.jmonkeyengine:jme3-plugins:' + jmonkeyengineVersion
implementation 'org.jmonkeyengine:jme3-effects:' + jmonkeyengineVersion
implementation 'org.jmonkeyengine:jme3-terrain:' + jmonkeyengineVersion
implementation 'org.jmonkeyengine:jme3-networking:' + jmonkeyengineVersion
implementation 'org.jmonkeyengine:jme3-jbullet:' + jmonkeyengineVersion
runtimeOnly 'org.jmonkeyengine:jme3-lwjgl3:' + jmonkeyengineVersion
implementation 'com.simsilica:lemur:1.16.0'
implementation 'com.simsilica:lemur-proto:1.13.0'
implementation 'com.github.riccardobl.DDSWriter:dds_writer:1.3.2'
implementation 'com.github.grizeldi:HoloShader:-SNAPSHOT'
implementation 'com.github.stephengold:Minie:6.2.0+big3'
implementation 'com.github.Jeddic:particlemonkey:1.0.2'
implementation 'com.github.rvandoosselaer:Blocks:v1.7.1'
implementation 'org.apache.logging.log4j:log4j-core:2.19.0'
implementation 'org.apache.logging.log4j:log4j-api:2.19.0'
implementation 'com.github.tlf30:monkey-netty:0.1.1'
implementation 'com.github.stephengold:Wes:0.7.2'
implementation 'net.aaaagames:PBRTerrain:1.0.2'
implementation 'com.github.joliver82:jme3-wireframe:1.0.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/temurin11-binaries/releases/download/jdk-11.0.15%2B10/OpenJDK11U-jre_x64_windows_hotspot_11.0.15_10.zip"
def linuxJreUrl = "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15%2B10/OpenJDK11U-jre_x64_linux_hotspot_11.0.15_10.tar.gz"
def macJreUrl = "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15%2B10/OpenJDK11U-jre_x64_mac_hotspot_11.0.15_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/Ephemia.bat"), zipTree(distZip.archiveFile), "${buildDir}/jres/windowsJre"
into new File(buildDir, 'distributions/Ephemia-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 = "Ephemia-windows.zip"
destinationDirectory = file("$buildDir/distributions")
from "$buildDir/distributions/Ephemia-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/Ephemia.sh"){
fileMode 0755
}
from zipTree(distZip.archiveFile)
from "${buildDir}/jres/linuxJre"
into new File(buildDir, 'distributions/Ephemia-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 = "Ephemia-linux.tar.gz"
destinationDirectory = file("$buildDir/distributions")
from ("$buildDir/distributions/Ephemia-linux"){
include('**.sh')
include('**/java')
fileMode 0755
}
from ("$buildDir/distributions/Ephemia-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/Ephemia.command"){
fileMode 0755
}
from zipTree(distZip.archiveFile)
from "${buildDir}/jres/macJre"
into new File(buildDir, 'distributions/Ephemia-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 = "Ephemia-mac.tar.gz"
destinationDirectory = file("$buildDir/distributions")
from ("$buildDir/distributions/Ephemia-mac"){
include('**.command')
include('**/java')
fileMode 0755
}
from ("$buildDir/distributions/Ephemia-mac"){
exclude('**.command')
exclude('**/java')
}
}
task buildAllDistributions{
group 'distribution'
dependsOn 'zipWindowsDistribution'
dependsOn 'zipLinuxDistribution'
dependsOn 'zipMacDistribution'
}
// 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,JME_EFFECTS,JME_TERRAIN,JME_NETWORKING,LEMUR,11511%2F38308161-c3cf-4e23-8754-528ca8387c11,16283%2FDDSWriter,16912%2F435ebd61-fbbc-4e10-a490-234c222b4312,11511%2F2d0fc6de-2e4d-49b1-8372-4f364d79e175,8113%2F189b56af-a1be-4036-8ac7-2b62a94935ff,16130%2F1a85df6f-4bb6-4c85-9e77-b5119662ed54,LOG4J2,14991%2F929c156b-3b0e-42c7-8474-f6c58ed8a1d5,11511%2F15054f52-c439-4bfb-9a73-80260b486333,22975%2F2930932e-7688-493a-ad00-bc473df0f076,2466%2Fb37a302d-261d-4823-8208-6b9b45595801,JME_JBULLET".toURI()
}
}