@@ -216,6 +216,8 @@ private void _ExportBeginImpl(string[] features, bool isDebug, string path, long
216
216
217
217
bool embedBuildResults = ( ( bool ) GetOption ( "dotnet/embed_build_outputs" ) || platform == OS . Platforms . Android ) && platform != OS . Platforms . MacOS ;
218
218
219
+ var exportedJars = new HashSet < string > ( ) ;
220
+
219
221
foreach ( PublishConfig config in targets )
220
222
{
221
223
string ridOS = config . RidOS ;
@@ -325,14 +327,6 @@ private void _ExportBeginImpl(string[] features, bool isDebug, string path, long
325
327
{
326
328
string fileName = Path . GetFileName ( path ) ;
327
329
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
-
336
330
if ( IsSharedObject ( fileName ) )
337
331
{
338
332
AddSharedObject ( path , tags : new string [ ] { arch } ,
@@ -343,10 +337,19 @@ private void _ExportBeginImpl(string[] features, bool isDebug, string path, long
343
337
return ;
344
338
}
345
339
346
- static bool IsSharedObject ( string fileName )
340
+ bool IsSharedObject ( string fileName )
347
341
{
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" ) )
350
353
{
351
354
return true ;
352
355
}
0 commit comments