forked from MovingBlocks/DestinationSol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
179 lines (154 loc) · 6.96 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/*
* Copyright 2020 The Terasology Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
id 'de.undercouch.download' version '4.0.4'
}
apply from: '../config/gradle/common.gradle'
apply from: "../config/gradle/jre.gradle"
project.ext.mainClassName = "org.destinationsol.desktop.SolDesktop"
dependencies {
implementation project(":engine")
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-controllers-lwjgl3:$gdxVersion"
implementation group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.25'
implementation group: 'org.terasology.crashreporter', name: 'cr-destsol', version: '4.0.0'
}
task run(type: JavaExec) {
dependsOn classes
//TODO: Remove extra args when the splash screen works on Macs again - see https://github.com/MovingBlocks/DestinationSol/issues/414
if (System.properties["os.name"].toLowerCase().contains("mac")) {
jvmArgs = ["-splash:../engine/src/main/resources/assets/textures/mainMenu/mainMenuLogo.png", "-XstartOnFirstThread", "-Dlog4j.configuration=log4j-debug.properties"]
String[] runArgs = ["-noSplash"]
args runArgs
}
else {
jvmArgs = ["-splash:../engine/src/main/resources/assets/textures/mainMenu/mainMenuLogo.png", "-Dlog4j.configuration=log4j-debug.properties"]
}
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = rootProject.projectDir
ignoreExitValue true
}
jar {
archiveName = "solDesktop.jar"
manifest {
def manifestClasspath = configurations.runtimeClasspath.collect { it.getName() }.join(" ")
attributes 'Main-Class': project.mainClassName
attributes("Class-Path": manifestClasspath)
attributes "SplashScreen-Image": "mainMenuLogo.png"
}
}
task moduleDist(type: Sync) {
into("$distsDir/app/modules")
rootProject.destinationSolModules().each { module ->
dependsOn ":modules:$module.name" + ":jar"
println "Distributing $module.name..."
from("$rootDir/modules/${module.name}/build/libs") {
include "*.jar"
}
}
}
task copyLaunchers (type: Copy) {
description = "Copy launchers into the distribution folder."
from("$rootDir/launcher")
include("*.sh", "*.exe")
into("$distsDir/app")
}
task libsDist(type: Copy) {
description = "Copy libs directory into the distribution folder."
dependsOn jar
from jar
from configurations.runtimeClasspath
into("$distsDir/app/libs")
}
task distUnbundledJRE() {
description = "Creates an application package without any bundled JRE."
group 'Distribution'
dependsOn jar
dependsOn copyLaunchers
}
distUnbundledJRE.finalizedBy libsDist
distUnbundledJRE.finalizedBy moduleDist
task distZipUnbundledJRE(type: Zip) {
description = "Creates an application package and zip archive without any bundled JRE."
group 'Distribution'
dependsOn distUnbundledJRE
from "$distsDir/app"
archiveName = "DestinationSol.zip"
}
task distBundleJREs {
description = "Creates an application package with a bundled JRE."
group 'Distribution'
dependsOn distUnbundledJRE
dependsOn downloadJreAll
}
task distZipBundleJREs (type: Zip) {
description = "Creates an application package and zip archive with a bundled JRE."
group 'Distribution'
dependsOn distBundleJREs
from "$distsDir/app"
archiveName = "DestinationSol.zip"
}
// TODO: LibGDX Generated config for Eclipse. Needs adjustment for assets not being in the Android facade
eclipse {
project {
name = appName + "-desktop"
linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/android/assets'
file {
whenMerged { project ->
def destinationSolRunConfig = new XmlParser().parseText('''
<!--<?xml version="1.0" encoding="UTF-8" standalone="no"?>-->
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/DestinationSol-desktop/src/main/java/org/destinationsol/desktop/SolDesktop.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.destinationsol.desktop.SolDesktop"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="DestinationSol-desktop"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-splash:../engine/src/main/resources/assets/textures/mainMenu/mainMenuLogo.png -Dlog4j.configuration=log4j-debug.properties"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:DestinationSol-engine}"/>
</launchConfiguration>
''')
def writer = new FileWriter(file("DestinationSol.launch"))
def printer = new XmlNodePrinter(new PrintWriter(writer))
printer.setPreserveWhitespace(true)
printer.print(destinationSolRunConfig)
}
}
}
}
task afterEclipseImport(description: "Post processing after project generation", group: "IDE") {
doLast {
def classpath = new XmlParser().parse(file(".classpath"))
new Node(classpath, "classpathentry", [kind: 'src', path: 'assets']);
def writer = new FileWriter(file(".classpath"))
def printer = new XmlNodePrinter(new PrintWriter(writer))
printer.setPreserveWhitespace(true)
printer.print(classpath)
}
}
tasks.withType(JavaExec) {
if (System.getProperty('DEBUG', 'false') == 'true') {
jvmArgs '-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9099', '-Dlog4j.configuration=log4j-debug.properties'
}
}