Browse Source

[.NET] Fix gradle builds for multiple ABIs

Include the needed .NET jar in the Godot templates so it's always available, then we don't need to include the jar from a .NET publish which could fail when exporting to multiple architectures because it would attempt to add the same jar for each architecture.
Raul Santos 8 months ago
parent
commit
d526d523b4

+ 12 - 2
modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs

@@ -323,7 +323,17 @@ namespace GodotTools.Export
                                 {
                                     if (platform == OS.Platforms.Android)
                                     {
-                                        if (IsSharedObject(Path.GetFileName(path)))
+                                        string fileName = Path.GetFileName(path);
+
+                                        if (fileName.EndsWith(".jar"))
+                                        {
+                                            // We exclude jar files from the export since they should
+                                            // already be included in the Godot templates, adding them
+                                            // again would cause conflicts.
+                                            return;
+                                        }
+
+                                        if (IsSharedObject(fileName))
                                         {
                                             AddSharedObject(path, tags: new string[] { arch },
                                                 Path.Join(projectDataDirName,
@@ -336,7 +346,7 @@ namespace GodotTools.Export
                                         static bool IsSharedObject(string fileName)
                                         {
                                             if (fileName.EndsWith(".so") || fileName.EndsWith(".a")
-                                             || fileName.EndsWith(".jar") || fileName.EndsWith(".dex"))
+                                             || fileName.EndsWith(".dex"))
                                             {
                                                 return true;
                                             }

+ 1 - 4
platform/android/java/app/build.gradle

@@ -70,10 +70,7 @@ dependencies {
     }
 
     // .NET dependencies
-    String jar = '../../../../modules/mono/thirdparty/libSystem.Security.Cryptography.Native.Android.jar'
-    if (file(jar).exists()) {
-        monoImplementation files(jar)
-    }
+    monoImplementation fileTree(dir: 'monoLibs', include: ['*.jar'])
 }
 
 android {

+ 0 - 0
modules/mono/thirdparty/libSystem.Security.Cryptography.Native.Android.jar → platform/android/java/app/monoLibs/libSystem.Security.Cryptography.Native.Android.jar