forked from rednblackgames/HyperLap2D
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
214 lines (189 loc) · 8.63 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
buildscript {
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
google()
}
dependencies {
classpath "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
}
}
plugins {
id 'java'
id 'org.beryx.runtime' version '1.12.2'
}
group 'games.rednblack'
version '0.0.7'
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url 'https://jitpack.io' }
google()
}
ext {
appName = 'HyperLap2D'
packMain = ["art/textures", "assets/style/", "uiskin"]
packSplash = ["art/splash_textures", "assets/splash/", "splash"]
}
sourceSets {
test {
java.srcDir 'src/test/java'
resources.srcDir 'src/test/resources'
}
}
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.tools.texturepacker.TexturePacker
task packTextures {
TexturePacker.Settings settings = new TexturePacker.Settings()
settings.legacyOutput = false
settings.filterMin = Texture.TextureFilter.Linear
settings.filterMag = Texture.TextureFilter.Linear
settings.duplicatePadding = true
if (project.ext.has('packMain')) {
logger.info "Calling TexturePacker: " + packMain
TexturePacker.processIfModified(settings, file(packMain[0]).absolutePath, file(packMain[1]).absolutePath, (String) packMain[2])
}
if (project.ext.has('packSplash')) {
logger.info "Calling TexturePacker: " + packSplash
TexturePacker.processIfModified(settings, file(packSplash[0]).absolutePath, file(packSplash[1]).absolutePath, (String) packSplash[2])
}
}
mainClassName = "games.rednblack.editor.Main"
project.ext.assetsDir = new File("assets/")
def osName = System.getProperty('os.name').toLowerCase(Locale.ROOT)
task runHyperLap2D(dependsOn: classes, type: JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
}
task dist(type: Jar) {
from files(sourceSets.main.output.classesDirs)
from files(sourceSets.main.output.resourcesDir)
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
from files(project.assetsDir)
manifest {
attributes 'Main-Class': project.mainClassName
}
destinationDirectory = file("$buildDir/lib")
}
jpackageImage.dependsOn dist
jpackage.dependsOn dist
dependencies {
implementation "com.badlogicgames.gdx:gdx:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
implementation("com.badlogicgames.gdx:gdx-tools:$gdxVersion") {
exclude group: 'com.badlogicgames.gdx', module: 'gdx-backend-lwjgl'
}
implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
implementation "com.badlogicgames.ashley:ashley:$ashleyVersion"
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
implementation "org.lwjgl:lwjgl-tinyfd:3.3.3"
implementation "org.lwjgl:lwjgl-tinyfd:3.3.3:natives-linux"
implementation "org.lwjgl:lwjgl-tinyfd:3.3.3:natives-linux-arm32"
implementation "org.lwjgl:lwjgl-tinyfd:3.3.3:natives-linux-arm64"
implementation "org.lwjgl:lwjgl-tinyfd:3.3.3:natives-macos"
implementation "org.lwjgl:lwjgl-tinyfd:3.3.3:natives-macos-arm64"
implementation "org.lwjgl:lwjgl-tinyfd:3.3.3:natives-windows"
implementation "org.lwjgl:lwjgl-tinyfd:3.3.3:natives-windows-x86"
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
implementation project(":hyperlap2d-common-api")
implementation project(":hyperlap2d-runtime-libgdx")
implementation project(":h2d-libgdx-spine-extension")
implementation project(":h2d-libgdx-talos-extension")
implementation project(":h2d-libgdx-spriter-extension")
implementation project(":libgdx-spriter-runtime")
implementation "com.talosvfx:talos-libgdx:$talosVersion"
implementation "space.earlygrey:shapedrawer:$shapedrawerVersion"
implementation "com.rafaskoberg.gdx:typing-label:$typingLabelVersion"
implementation "com.kotcrab.vis:vis-ui:$visuiVersion"
implementation "com.esotericsoftware.spine:spine-libgdx:$spineVersion"
implementation "com.mortennobel:java-image-scaling:0.8.5"
implementation "org.apache.commons:commons-lang3:3.11"
implementation "commons-io:commons-io:2.7"
implementation 'net.mountainblade:modular:1.0'
testImplementation group: 'junit', name: 'junit', version: '4.12'
}
def getBuildVersion = {
if (project.hasProperty('SNAPSHOT')) {
return getVersion() + (project.hasProperty('WORKFLOW_RUN') ? WORKFLOW_RUN : "$System.env.WORKFLOW_RUN")
} else {
return getVersion()
}
}
runtime {
javaHome.set(System.getProperty("java.home"))
options = ['--strip-debug',
'--compress', '2',
'--no-header-files',
'--no-man-pages',
'--strip-native-commands',
'--vm', 'server']
modules = ['java.base',
'java.desktop',
'java.compiler',
'java.logging',
'java.management',
'jdk.crypto.cryptoki',
'jdk.crypto.ec',
'jdk.unsupported']
distDir = file(buildDir)
task clearTmpDir(type: Delete) {
delete "$buildDir/tempDir"
}
//"C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe" -nologo -spdb -cultures:zh-CN -ext WixUtilExtension
// -out F:\gdx\HyperLap2D\build\jpackage\HyperLap2D-0.0.7.msi -ext WixUIExtension
// -loc F:\gdx\HyperLap2D\build\tempDir\config\MsiInstallerStrings_zh_CN.wxl -b F:\gdx\HyperLap2D\build\tempDir\config
// F:\gdx\HyperLap2D\build\tempDir\wixobj\main.wixobj F:\gdx\HyperLap2D\build\tempDir\wixobj\bundle.wixobj
task execFinalCmd(type: Exec) {
workingDir "$buildDir/tempDir"
def cmd_ = [
'light.exe', '-nologo', '-spdb', '-cultures:zh-CN', '-ext', 'WixUtilExtension',
'-out', "$buildDir/jpackage/HyperLap2D-${getBuildVersion()}.msi", '-ext', 'WixUIExtension', '-loc',
"$workingDir/config/MsiInstallerStrings_zh_CN.wxl", '-b', "$workingDir/config",
"$workingDir/wixobj/main.wixobj", "$workingDir/wixobj/bundle.wixobj"
]
commandLine cmd_
}
//Because of jpackage issues. before use this task. should clear tempDir(clearTmpDir task).
//then run this task(it will be failed), and be use final cmd task(execFinalCmd task) build exe file.
jpackage {
setVersion(getBuildVersion())
mainJar = dist.archiveFileName.get()
imageOptions += ['--app-version', getBuildVersion(), '--vendor', 'Red & Black Games', '--description', 'HyperLap2D Editor', '--name', 'HyperLap2D']
installerOptions += ['--license-file', 'LICENSE']
if (osName.contains('windows')) {
imageOptions += ["--icon", file("icons/icon.ico"), '--copyright', '(c) 2021, Red & Black Games']
installerType = 'msi'
installerOptions += ['--win-dir-chooser', '--win-menu',
'--win-shortcut', '--vendor', 'Red & Black Games',
'--description', 'HyperLap2D Editor',
'--temp', "${buildDir}/tempDir",
'--win-upgrade-uuid', 'e5f64fb6-111f-41f3-8f33-03b90e1a3a32']
resourceDir = file("resources-windows")
} else if (osName.contains('linux')) {
imageOptions += ["--icon", file("icons/HyperLap2D.png")]
installerType = 'deb'
installerOptions += [
'--linux-menu-group', 'Development', '--linux-deb-maintainer', 'business@rednblack.games',
'--linux-shortcut'
]
resourceDir = file("resources-linux")
} else if (osName.contains('mac')) {
imageOptions += ['--copyright', '(c) 2021, Red & Black Games', "--icon", file("icons/icon.icns")
, '--resource-dir', "${projectDir}/resources-macos"]
jvmArgs = ['-XstartOnFirstThread', '-Djava.awt.headless=true']
installerOptions += ['--verbose', '--app-version', getBuildVersion(), '--vendor', 'Red & Black Games', '--resource-dir', "${projectDir}/resources-macos"]
installerType = 'dmg'
resourceDir = file("resources-macos")
}
}
}
tasks.withType(JavaCompile) {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
options.encoding = "UTF-8"
}