Removed use of Anuken packr, removing windows32 builds.

This commit is contained in:
Yair Morgenstern 2022-10-12 23:39:57 +03:00
parent ad8c4a1e97
commit f04297acfd
4 changed files with 80 additions and 62 deletions

View File

@ -147,10 +147,6 @@ jobs:
./butler push deploy/Unciv-Linux64.zip yairm210/unciv:Linux64 --userversion ${{steps.tag.outputs.tag}}
./gradlew desktop:zipLinuxFilesForJar
wget -q -O jdk-windows-32.zip https://github.com/ojdkbuild/ojdkbuild/releases/download/java-1.8.0-openjdk-1.8.0.252-2.b09-x86/java-1.8.0-openjdk-1.8.0.252-2.b09.ojdkbuild.windows.x86.zip
./gradlew desktop:packrWindows32
./butler push deploy/Unciv-Windows32.zip yairm210/unciv:Windows32 --userversion ${{steps.tag.outputs.tag}}
# MacOS bundles correctly but does not run as intended, see https://github.com/yairm210/Unciv/issues/4970
# Disabled until this can be checked by sommeone who actually has a Mac computer
# wget -q -O jre-macOS.tar.gz https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.11%2B9/OpenJDK11U-jre_x64_mac_hotspot_11.0.11_9.tar.gz

View File

@ -19,16 +19,12 @@ buildscript {
google() // needed for com.android.tools.build:gradle
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
gradlePluginPortal()
maven { url = uri("https://jitpack.io") } // for the anuken packr
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${com.unciv.build.BuildConfig.kotlinVersion}")
classpath("de.richsource.gradle.plugins:gwt-gradle-plugin:0.6")
classpath("com.android.tools.build:gradle:7.1.3")
classpath("com.mobidevelop.robovm:robovm-gradle-plugin:2.3.1")
// This is for wrapping the .jar file into a standalone executable
classpath("com.github.anuken:packr:-SNAPSHOT")
}
}

View File

@ -1,8 +1,5 @@
import com.badlogicgames.packr.Packr
import com.badlogicgames.packr.PackrConfig
import com.unciv.build.BuildConfig
import com.unciv.build.BuildConfig.gdxVersion
import org.apache.tools.ant.taskdefs.condition.Os
plugins {
id("kotlin")
@ -71,7 +68,29 @@ tasks.register<Jar>("dist") { // Compiles the jar file
}
}
for (platform in PackrConfig.Platform.values()) {
enum class Platform(val desc: String) {
Windows32("windows32"), Windows64("windows64"), Linux32("linux32"), Linux64("linux64"), MacOS("mac");
}
class PackrConfig(
var platform: Platform? = null,
var jdk: String? = null,
var executable: String? = null,
var classpath: List<String>? = null,
var removePlatformLibs: List<String>? = null,
var mainClass: String? = null,
var vmArgs: List<String>? = null,
var minimizeJre: String? = null,
var cacheJre: File? = null,
var resources: List<File>? = null,
var outDir: File? = null,
var platformLibsOutDir: File? = null,
var iconResource: File? = null,
var bundleIdentifier: String? = null
)
for (platform in Platform.values()) {
val platformName = platform.toString()
tasks.create("packr${platformName}") {
@ -92,7 +111,6 @@ for (platform in PackrConfig.Platform.values()) {
outDir = file("packr")
}
doLast {
// https://gist.github.com/seanf/58b76e278f4b7ec0a2920d8e5870eed6
fun String.runCommand(workingDir: File) {
@ -113,36 +131,30 @@ for (platform in PackrConfig.Platform.values()) {
}
if (config.outDir.exists()) delete(config.outDir)
if (config.outDir!!.exists()) delete(config.outDir)
// Requires that both packr and the jre are downloaded, as per buildAndDeploy.yml, "Upload to itch.io"
// Use old version of packr - newer versions aren't Windows32-compliant
if (platform == PackrConfig.Platform.Windows32) {
config.jdk = "jdk-windows-32.zip"
Packr().pack(config)
} else {
val jdkFile =
val jdkFile =
when (platform) {
PackrConfig.Platform.Linux64 -> "jre-linux-64.tar.gz"
PackrConfig.Platform.Windows64 -> "jdk-windows-64.zip"
Platform.Linux64 -> "jre-linux-64.tar.gz"
Platform.Windows64 -> "jdk-windows-64.zip"
else -> "jre-macOS.tar.gz"
}
val platformNameForPackrCmd =
if (platform == PackrConfig.Platform.MacOS) "mac"
val platformNameForPackrCmd =
if (platform == Platform.MacOS) "mac"
else platform.name.toLowerCase()
val command = "java -jar $rootDir/packr-all-4.0.0.jar" +
" --platform $platformNameForPackrCmd" +
" --jdk $jdkFile" +
" --executable Unciv" +
" --classpath $jarFile" +
" --mainclass $mainClassName" +
" --vmargs Xmx1G " +
" --output ${config.outDir}"
command.runCommand(rootDir)
}
val command = "java -jar $rootDir/packr-all-4.0.0.jar" +
" --platform $platformNameForPackrCmd" +
" --jdk $jdkFile" +
" --executable Unciv" +
" --classpath $jarFile" +
" --mainclass $mainClassName" +
" --vmargs Xmx1G " +
" --output ${config.outDir}"
command.runCommand(rootDir)
}
tasks.register<Zip>("zip${platformName}") {

View File

@ -1,5 +1,3 @@
import com.badlogicgames.packr.Packr
import com.badlogicgames.packr.PackrConfig
import com.unciv.build.BuildConfig
plugins {
@ -66,7 +64,28 @@ tasks.register<Jar>("dist") { // Compiles the jar file
}
}
for (platform in PackrConfig.Platform.values()) {
enum class Platform(val desc: String) {
Windows32("windows32"), Windows64("windows64"), Linux32("linux32"), Linux64("linux64"), MacOS("mac");
}
class PackrConfig(
var platform: Platform? = null,
var jdk: String? = null,
var executable: String? = null,
var classpath: List<String>? = null,
var removePlatformLibs: List<String>? = null,
var mainClass: String? = null,
var vmArgs: List<String>? = null,
var minimizeJre: String? = null,
var cacheJre: File? = null,
var resources: List<File>? = null,
var outDir: File? = null,
var platformLibsOutDir: File? = null,
var iconResource: File? = null,
var bundleIdentifier: String? = null
)
for (platform in Platform.values()) {
val platformName = platform.toString()
tasks.create("packr${platformName}") {
@ -108,40 +127,35 @@ for (platform in PackrConfig.Platform.values()) {
}
if (config.outDir.exists()) delete(config.outDir)
if (config.outDir!!.exists()) delete(config.outDir)
// Requires that both packr and the jre are downloaded, as per buildAndDeploy.yml, "Upload to itch.io"
// Use old version of packr - newer versions aren't Windows32-compliant
if (platform == PackrConfig.Platform.Windows32) {
config.jdk = "jdk-windows-32.zip"
Packr().pack(config)
} else {
val jdkFile =
val jdkFile =
when (platform) {
PackrConfig.Platform.Linux64 -> "jre-linux-64.tar.gz"
PackrConfig.Platform.Windows64 -> "jdk-windows-64.zip"
Platform.Linux64 -> "jre-linux-64.tar.gz"
Platform.Windows64 -> "jdk-windows-64.zip"
else -> "jre-macOS.tar.gz"
}
val platformNameForPackrCmd =
if (platform == PackrConfig.Platform.MacOS) "mac"
val platformNameForPackrCmd =
if (platform == Platform.MacOS) "mac"
else platform.name.toLowerCase()
val command = "java -jar $rootDir/packr-all-4.0.0.jar" +
" --platform $platformNameForPackrCmd" +
" --jdk $jdkFile" +
" --executable UncivServer" +
" --classpath $jarFile" +
" --mainclass $mainClassName" +
" --vmargs Xmx1G " +
(if (platform == PackrConfig.Platform.MacOS) jvmArgsForMac.joinToString(" ") {
it.removePrefix("-")
}
else "") +
" --output ${config.outDir}"
command.runCommand(rootDir)
}
val command = "java -jar $rootDir/packr-all-4.0.0.jar" +
" --platform $platformNameForPackrCmd" +
" --jdk $jdkFile" +
" --executable UncivServer" +
" --classpath $jarFile" +
" --mainclass $mainClassName" +
" --vmargs Xmx1G " +
(if (platform == Platform.MacOS) jvmArgsForMac.joinToString(" ") {
it.removePrefix("-")
}
else "") +
" --output ${config.outDir}"
command.runCommand(rootDir)
}
tasks.register<Zip>("zip${platformName}") {