@@ -60,8 +60,8 @@ tasks.register<Jar>("dist") { // Compiles the jar file
60
60
}
61
61
}
62
62
63
- enum class Platform (val desc : String ) {
64
- Windows32 ( " windows32 " ) , Windows64 ( " windows64 " ) , Linux32 ( " linux32 " ) , Linux64 ( " linux64 " ) , MacOS ( " mac " ) ;
63
+ enum class Platform () {
64
+ Windows32 , Windows64 , Linux32 , Linux64 , MacOS ;
65
65
}
66
66
67
67
class PackrConfig (
@@ -81,10 +81,8 @@ class PackrConfig(
81
81
var bundleIdentifier : String? = null
82
82
)
83
83
84
- for (platform in Platform .values()) {
85
- val platformName = platform.toString()
86
-
87
- tasks.create(" packr${platformName} " ) {
84
+ for (platform in Platform .entries) {
85
+ tasks.register(" packr${platform.name} " ) {
88
86
dependsOn(tasks.getByName(" dist" ))
89
87
90
88
// Needs to be here and not in doLast because the zip task depends on the outDir
@@ -127,16 +125,16 @@ for (platform in Platform.values()) {
127
125
128
126
// Requires that both packr and the jre are downloaded, as per buildAndDeploy.yml, "Upload to itch.io"
129
127
130
- val jdkFile =
131
- when (platform) {
132
- Platform .Linux64 -> " jre-linux-64.tar.gz"
133
- Platform .Windows64 -> " jdk-windows-64.zip"
134
- else -> " jre-macOS.tar.gz"
135
- }
128
+ val jdkFile = when (platform) {
129
+ Platform .Linux64 -> " jre-linux-64.tar.gz"
130
+ Platform .Windows64 -> " jdk-windows-64.zip"
131
+ else -> " jre-macOS.tar.gz"
132
+ }
136
133
137
- val platformNameForPackrCmd =
138
- if (platform == Platform .MacOS ) " mac"
139
- else platform.name.lowercase()
134
+ val platformNameForPackrCmd = when (platform) {
135
+ Platform .MacOS -> " mac"
136
+ else -> platform.name.lowercase()
137
+ }
140
138
141
139
val command = " java -jar $rootDir /packr-all-4.0.0.jar" +
142
140
" --platform $platformNameForPackrCmd " +
@@ -150,17 +148,17 @@ for (platform in Platform.values()) {
150
148
}
151
149
else " " ) +
152
150
" --output ${config.outDir} "
153
- command.runCommand(rootDir)
154
151
152
+ command.runCommand(rootDir)
155
153
}
156
154
157
- tasks.register<Zip >(" zip${platformName } " ) {
158
- archiveFileName.set(" UncivServer-${platformName } .zip" )
155
+ tasks.register<Zip >(" zip${platform.name } " ) {
156
+ archiveFileName.set(" UncivServer-${platform.name } .zip" )
159
157
from(config.outDir)
160
158
destinationDirectory.set(deployFolder)
161
159
}
162
160
163
- finalizedBy(" zip${platformName } " )
161
+ finalizedBy(" zip${platform.name } " )
164
162
}
165
163
}
166
164
0 commit comments