1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Merge pull request #98066 from TCROC/fix-android-mono-export

Fix Android mono export with 2 or more cpu architectures fails
This commit is contained in:
Thaddeus Crews
2025-02-10 12:21:32 -06:00
3 changed files with 18 additions and 12 deletions

View File

@@ -216,6 +216,8 @@ namespace GodotTools.Export
bool embedBuildResults = ((bool)GetOption("dotnet/embed_build_outputs") || platform == OS.Platforms.Android) && platform != OS.Platforms.MacOS;
var exportedJars = new HashSet<string>();
foreach (PublishConfig config in targets)
{
string ridOS = config.RidOS;
@@ -325,14 +327,6 @@ namespace GodotTools.Export
{
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 },
@@ -343,10 +337,19 @@ namespace GodotTools.Export
return;
}
static bool IsSharedObject(string fileName)
bool IsSharedObject(string fileName)
{
if (fileName.EndsWith(".so") || fileName.EndsWith(".a")
|| fileName.EndsWith(".dex"))
if (fileName.EndsWith(".jar"))
{
// Don't export the same jar twice. Otherwise we will have conflicts.
// This can happen when exporting for multiple architectures. Dotnet
// stores the jars in .godot/mono/temp/bin/Export[Debug|Release] per
// target architecture. Jars are cpu agnostic so only 1 is needed.
var jarName = Path.GetFileName(fileName);
return exportedJars.Add(jarName);
}
if (fileName.EndsWith(".so") || fileName.EndsWith(".a") || fileName.EndsWith(".dex"))
{
return true;
}

View File

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