Skip to content

Commit 4151bf8

Browse files
committed
fix android mono export causing conflicts
1 parent 0f95e9f commit 4151bf8

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs

+14-11
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ private void _ExportBeginImpl(string[] features, bool isDebug, string path, long
216216

217217
bool embedBuildResults = ((bool)GetOption("dotnet/embed_build_outputs") || platform == OS.Platforms.Android) && platform != OS.Platforms.MacOS;
218218

219+
var exportedJars = new HashSet<string>();
220+
219221
foreach (PublishConfig config in targets)
220222
{
221223
string ridOS = config.RidOS;
@@ -325,14 +327,6 @@ private void _ExportBeginImpl(string[] features, bool isDebug, string path, long
325327
{
326328
string fileName = Path.GetFileName(path);
327329

328-
if (fileName.EndsWith(".jar"))
329-
{
330-
// We exclude jar files from the export since they should
331-
// already be included in the Godot templates, adding them
332-
// again would cause conflicts.
333-
return;
334-
}
335-
336330
if (IsSharedObject(fileName))
337331
{
338332
AddSharedObject(path, tags: new string[] { arch },
@@ -343,10 +337,19 @@ private void _ExportBeginImpl(string[] features, bool isDebug, string path, long
343337
return;
344338
}
345339

346-
static bool IsSharedObject(string fileName)
340+
bool IsSharedObject(string fileName)
347341
{
348-
if (fileName.EndsWith(".so") || fileName.EndsWith(".a")
349-
|| fileName.EndsWith(".dex"))
342+
if (fileName.EndsWith(".jar"))
343+
{
344+
// Don't export the same jar twice. Otherwise we will have conflicts.
345+
// This can happen when exporting for multiple architectures. Dotnet
346+
// stores the jars in .godot/mono/temp/bin/Export[Debug|Release] per
347+
// target architecture. Jars are cpu agnostic so only 1 is needed.
348+
var jarName = Path.GetFileName(fileName);
349+
return exportedJars.Add(jarName);
350+
}
351+
352+
if (fileName.EndsWith(".so") || fileName.EndsWith(".a") || fileName.EndsWith(".dex"))
350353
{
351354
return true;
352355
}

0 commit comments

Comments
 (0)