-
Notifications
You must be signed in to change notification settings - Fork 70
/
build.gradle
144 lines (115 loc) · 4.03 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
import org.gradle.internal.os.OperatingSystem
plugins {
id "java"
id "application" // for "run" task
id 'edu.sc.seis.launch4j' version '3.0.6' // for generating .exe
id 'org.beryx.runtime' version '1.13.1' // for generating JRE
id "io.github.goooler.shadow" version "8.1.8" // only needed to make linux build
}
def buildDir = layout.buildDirectory.get().asFile
def workingDir = "$buildDir/app"
application {
mainClass = "com.particle_life.app.Main" // required for "run" task
if (OperatingSystem.current() == OperatingSystem.MAC_OS) {
applicationDefaultJvmArgs = ["-XstartOnFirstThread"]
}
}
// copy resources to build directory
tasks.register("copyResources", Copy) {
from "$projectDir/src/main/resources"
into workingDir
}
run {
dependsOn(tasks.copyResources)
delegate.workingDir = workingDir
}
launch4j {
icon = "${projectDir}/favicon.ico"
mainClassName = 'com.particle_life.app.Main'
dontWrapJar = true
requires64Bit = true
bundledJrePath = "jre"
}
// creates folder "jre"
runtime {
options = ["--compress", "2"]
modules = [
"jdk.zipfs" // needed for "jar" FileSystemProvider (ZipFileSystemProvider), not detected automatically by plugin
]
additive = true
}
tasks.register('copyJre', Copy) {
dependsOn tasks.runtime
from "$buildDir/jre"
into "$workingDir/jre"
}
tasks.register('copyLaunch4j', Copy) {
dependsOn tasks.createExe
from "$buildDir/launch4j"
into workingDir
}
tasks.register('assembleApp') {
dependsOn tasks.copyLaunch4j, tasks.copyResources, tasks.copyJre
}
tasks.register('zipApp', Zip) {
dependsOn tasks.assembleApp
from workingDir
destinationDirectory = layout.buildDirectory.dir("zipApp")
archiveFileName = "particle-life-app.zip"
}
group 'com.particle.life.app'
ext {
lwjglVersion = '3.3.0'
imguiVersion = '1.86.2'
}
jar {
// This ignores all resource files when bundling the JAR.
// Reason: We don't want our "resources" files to be included
// in the JAR, but instead outside, next to the executable.
processResources.exclude('*')
}
project.ext.lwjglVersion = "3.3.0"
switch (OperatingSystem.current()) {
case OperatingSystem.LINUX:
def osArch = System.getProperty("os.arch")
project.ext.natives = osArch.startsWith("arm") || osArch.startsWith("aarch64")
? "linux-${osArch.contains("64") || osArch.startsWith("armv8") ? "arm64" : "arm32"}"
: "linux"
break
case OperatingSystem.MAC_OS:
project.ext.natives = "macos"
break
case OperatingSystem.WINDOWS:
def osArch = System.getProperty("os.arch")
project.ext.natives = osArch.contains("64")
? "windows${osArch.startsWith("aarch64") ? "-arm64" : ""}"
: "windows-x86"
break
}
repositories {
mavenCentral()
mavenLocal()
// JitPack allows to easily add dependencies on GitHub repos
// (e.g. implementation 'com.github.User:Repo:Tag')
maven { url "https://jitpack.io" } // this line should be at the end of the repositories
}
dependencies {
// Particle Life Backend
implementation "com.github.tom-mohr:particle-life:v0.5.1"
// YAML Parser "YamlBeans"
implementation 'com.esotericsoftware.yamlbeans:yamlbeans:1.17'
// TOML Parser
implementation 'com.moandjiezana.toml:toml4j:0.7.2'
// Apache Commons Text (for Levenshtein distance)
implementation 'org.apache.commons:commons-text:1.12.0'
// Linear Algebra Library "JOML"
implementation 'org.joml:joml:1.10.1'
// GUI Library "Dear ImGui"
implementation "io.github.spair:imgui-java-binding:$imguiVersion"
implementation "io.github.spair:imgui-java-natives-$natives:$imguiVersion"
// LWJGL (Lightweight Java Game Library)
// see https://www.lwjgl.org/customize for a list of all available contents
[".lwjgl", ".glfw", ".opengl", ".stb"].each {
implementation "org.lwjgl.osgi:org.lwjgl$it:$lwjglVersion"
}
}