These are wip notes for the documentation
MyGame.java (or whatever your Main class is called)build.gradlelaunch4j configuration groupBuild automation is a blessing! Let's have a look at how to build and deploy your game using Gradle.
To build Windows executables, we are going to use the launch4j plugin. We set up different Gradle tasks for each target platform as well.
Your project's build.gradle should look something like this:
plugins {
id 'edu.sc.seis.launch4j' version '2.4.4'
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
archivesBaseName = "mygame"
version = "v1.0.2"
targetCompatibility = "1.8.0"
sourceSets {
main.java.srcDir "src"
main.java.srcDir "resources"
main.java.srcDir "sounds"
main.java.srcDir "maps"
main.java.srcDir "localization"
main.resources.includes = ["game.litidata"]
}
repositories {
mavenCentral()
}
dependencies {
compile project(':litiengine')
}
compileJava.options.encoding = 'UTF-8'
jar {
from {
configurations.runtime.collect {
it.isDirectory() ? it : zipTree(it)
}
configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
}
} {
exclude 'META-INF/services/**'
}
// make sure to only include service providers from the litiengine when directly referencing the project
from ("${project(':litiengine').projectDir}/resources/") {
include 'META-INF/services/**'
}
from('resources')
{
include '**/*'
exclude 'sprites/*'
}
from('sounds') { include '**/*' }
exclude '**/*.dll'
exclude '**/*.jnilib'
exclude '**/*.dylib'
exclude '**/*.so'
exclude 'junit**/**'
from 'game.litidata'
manifest {
attributes 'Class-Path': ".",
'Main-Class': "de.gurkenlabs.mygame.MyGame"
}
}
launch4j {
mainClassName = 'de.gurkenlabs.mygame.MyGame'
icon = 'icon.ico'
outputDir = 'libs'
outfile = archivesBaseName +'.exe'
companyName = 'gurkenlabs.de'
version = '1.0.2'
textVersion = '1.0.2'
copyright = '2020 gurkenlabs.de'
bundledJrePath = 'jre'
jvmOptions = ['-Xms256m', '-Xmx1024m']
cmdLine = '-release'
}
task copyNativeLibs(type: Copy) {
def litiengineLibs ='../litiengine/build/libs'
def buildFolder = new File(buildDir, 'libs')
from(litiengineLibs) {
include '**/*'
exclude '**/*.jar'
exclude '**/*.zip'
exclude 'LICENSE'
exclude 'lib/**'
}
from('/dist/'){
include 'icon.ico'
include 'config.properties'
include 'steam_appid.txt'
include 'jre/**'
}
into buildFolder
}
build.dependsOn copyNativeLibs
task distZipWindow(type: Zip) {
group 'build'
from 'build/libs/'
include '*.exe'
include '*.dll'
include 'config.properties'
include 'jre/**'
archiveName archivesBaseName + '-' + version + '-win.zip'
exclude archiveName
exclude 'jinput-dx8_64.dll'
exclude 'jinput-raw_64.dll'
exclude 'steam_api64.dll'
exclude 'steamworks4j64.dll'
destinationDir(file('build/libs/'))
}
task distZipLinux(type: Zip) {
group 'build'
from 'build/libs/'
include '*.jar'
include '*.so'
include 'config.properties'
archiveName archivesBaseName + '-' + version + '-linux.zip'
exclude archiveName
destinationDir(file('build/libs/'))
}
task distZipOSX(type: Zip) {
group 'build'
from 'build/libs/'
include '*.jar'
include '*.jnilib'
include '*.dylib'
include 'config.properties'
archiveName archivesBaseName + '-' + version + '-osx.zip'
exclude archiveName
destinationDir(file('build/libs/'))
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}config.propertiesGame.DEBUG = false in MyGame.java before building anything that is releasedmygame\build\libs\mygame-v1.X.X-win.zip mygame\build\libs\mygame-v1.X.X-linux.zip mygame\build\libs\mygame-v1.X.X-osx.zipjre folder, the jinput and steamworks x86 native assemblies, the config.properties file (and the mygame.exe executable in the Windows archive).Edit Steamworks Settings/Steampipe/BuildsUploadsUpload files and select the archivehttp://steamcommunity.com/games/{mygameid}/announcements/create/https://itch.io/dashboard/game/{mygameid}/devlog