From 6d634b7b4578729ae7b7f50cb47ed1cb797f56ca Mon Sep 17 00:00:00 2001 From: JCash Date: Mon, 14 Oct 2024 16:00:48 +0200 Subject: [PATCH] cleanup --- .../java/com/defold/extender/Extender.java | 2 +- .../com/defold/extender/ExtenderUtil.java | 14 +++++++++-- .../extender/builders/CSharpBuilder.java | 25 +++++-------------- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/server/src/main/java/com/defold/extender/Extender.java b/server/src/main/java/com/defold/extender/Extender.java index ed4df67b..9f904aff 100644 --- a/server/src/main/java/com/defold/extender/Extender.java +++ b/server/src/main/java/com/defold/extender/Extender.java @@ -1079,7 +1079,7 @@ private List buildExtensionInternal_CSharp(File manifest, Map context = createContext(manifestContext); - // Make sure the engine libraries isn't starting with "lib" (i.e. "libextension" -> "extension") + // Make sure the engine libraries aren't starting with "lib" (i.e. "libextension" -> "extension") List libs = (List)context.get("engineLibs"); if (ExtenderUtil.isWindowsTarget(this.platform)) { diff --git a/server/src/main/java/com/defold/extender/ExtenderUtil.java b/server/src/main/java/com/defold/extender/ExtenderUtil.java index 4134ae99..775d7e5a 100644 --- a/server/src/main/java/com/defold/extender/ExtenderUtil.java +++ b/server/src/main/java/com/defold/extender/ExtenderUtil.java @@ -724,8 +724,18 @@ public static String switchExtension(String name, String newExt) { public static boolean isAppleTarget(String platform) { return platform.equals("arm64-osx") || platform.equals("x86_64-osx") || - platform.equals("x86_64-ios") || - platform.equals("arm64-ios"); + platform.equals("arm64-ios") || + platform.equals("x86_64-ios"); + } + + public static boolean isMacOSTarget(String platform) { + return platform.equals("arm64-osx") || + platform.equals("x86_64-osx"); + } + + public static boolean isIOSTarget(String platform) { + return platform.equals("arm64-ios") || + platform.equals("x86_64-ios"); } public static boolean isWebTarget(String platform) { diff --git a/server/src/main/java/com/defold/extender/builders/CSharpBuilder.java b/server/src/main/java/com/defold/extender/builders/CSharpBuilder.java index e8bea9f9..2b7a3258 100644 --- a/server/src/main/java/com/defold/extender/builders/CSharpBuilder.java +++ b/server/src/main/java/com/defold/extender/builders/CSharpBuilder.java @@ -3,7 +3,6 @@ import org.apache.commons.io.FileUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; @@ -127,22 +126,10 @@ private static String convertPlatform(String platform) { return "unknown_platform"; } - private static boolean ismacOS(String platform) { - return platform.equals("arm64-osx") || platform.equals("x86_64-osx"); - } - - private static boolean isiOS(String platform) { - return platform.equals("arm64-ios") || platform.equals("x86_64-ios"); - } - - private static boolean isWindows(String platform) { - return platform.equals("x86-win32") || platform.equals("x86_64-win32"); - } - private static String getLibName(String platform, String name) { String prefix = "lib"; String suffix = ".a"; - if (isWindows(platform)) + if (ExtenderUtil.isWindowsTarget(platform)) { prefix = ""; suffix = ".lib"; @@ -153,7 +140,7 @@ private static String getLibName(String platform, String name) { private static String getObjName(String platform, String name) { String prefix = "lib"; String suffix = ".o"; - if (isWindows(platform)) + if (ExtenderUtil.isWindowsTarget(platform)) { prefix = ""; suffix = ".obj"; @@ -223,17 +210,17 @@ private static void addLibFlags(String platform, List linkFlags) throws paths.add(getLibName(platform, "standalonegc-enabled")); String aotSuffix = ""; - if (isWindows(platform)) + if (ExtenderUtil.isWindowsTarget(platform)) aotSuffix = ".Aot"; paths.add(getLibName(platform, "System.IO.Compression.Native" + aotSuffix)); paths.add(getLibName(platform, "System.Globalization.Native" + aotSuffix)); - if (ismacOS(platform)) + if (ExtenderUtil.isMacOSTarget(platform)) { paths.add(getLibName(platform, "System.Native")); paths.add(getLibName(platform, "Runtime.VxsortEnabled")); } - else if (isiOS(platform)) + else if (ExtenderUtil.isIOSTarget(platform)) { paths.add(getLibName(platform, "System.Native")); paths.add(getLibName(platform, "stdc++compat")); @@ -241,7 +228,7 @@ else if (isiOS(platform)) paths.add(getLibName(platform, "System.Security.Cryptography.Native.Apple")); linkFlags.add("-licucore"); } - else if (isWindows(platform)) + else if (ExtenderUtil.isWindowsTarget(platform)) { paths.add(getLibName(platform, "Runtime.VxsortEnabled")); linkFlags.add("-lbcrypt");