@@ -78,9 +78,9 @@ public override bool RunTask ()
78
78
return ! Log . HasLoggedErrors ;
79
79
}
80
80
81
- void SetAssemblyAbiMetadata ( string abi , string assetType , ITaskItem assembly , ITaskItem ? symbol )
81
+ void SetAssemblyAbiMetadata ( string abi , string assetType , ITaskItem assembly , ITaskItem ? symbol , bool isDuplicate )
82
82
{
83
- if ( String . IsNullOrEmpty ( abi ) || String . Compare ( "native" , assetType , StringComparison . OrdinalIgnoreCase ) != 0 ) {
83
+ if ( String . IsNullOrEmpty ( abi ) || ( ! isDuplicate && String . Compare ( "native" , assetType , StringComparison . OrdinalIgnoreCase ) != 0 ) ) {
84
84
return ;
85
85
}
86
86
@@ -90,7 +90,7 @@ void SetAssemblyAbiMetadata (string abi, string assetType, ITaskItem assembly, I
90
90
}
91
91
}
92
92
93
- void SetAssemblyAbiMetadata ( ITaskItem assembly , ITaskItem ? symbol )
93
+ void SetAssemblyAbiMetadata ( ITaskItem assembly , ITaskItem ? symbol , bool isDuplicate )
94
94
{
95
95
string assetType = assembly . GetMetadata ( "AssetType" ) ;
96
96
string rid = assembly . GetMetadata ( "RuntimeIdentifier" ) ;
@@ -99,14 +99,14 @@ void SetAssemblyAbiMetadata (ITaskItem assembly, ITaskItem? symbol)
99
99
return ;
100
100
}
101
101
102
- SetAssemblyAbiMetadata ( AndroidRidAbiHelper . RuntimeIdentifierToAbi ( rid ) , assetType , assembly , symbol ) ;
102
+ SetAssemblyAbiMetadata ( AndroidRidAbiHelper . RuntimeIdentifierToAbi ( rid ) , assetType , assembly , symbol , isDuplicate ) ;
103
103
}
104
104
105
105
void SetMetadataForAssemblies ( List < ITaskItem > output , Dictionary < string , ITaskItem > symbols )
106
106
{
107
107
foreach ( var assembly in InputAssemblies ) {
108
108
var symbol = GetOrCreateSymbolItem ( symbols , assembly ) ;
109
- SetAssemblyAbiMetadata ( assembly , symbol ) ;
109
+ SetAssemblyAbiMetadata ( assembly , symbol , isDuplicate : false ) ;
110
110
symbol ? . SetDestinationSubPath ( ) ;
111
111
assembly . SetDestinationSubPath ( ) ;
112
112
assembly . SetMetadata ( "FrameworkAssembly" , IsFrameworkAssembly ( assembly ) . ToString ( ) ) ;
@@ -144,7 +144,7 @@ void DeduplicateAssemblies (List<ITaskItem> output, Dictionary<string, ITaskItem
144
144
if ( mvids . Count > 1 ) {
145
145
foreach ( var assembly in group ) {
146
146
var symbol = GetOrCreateSymbolItem ( symbols , assembly ) ;
147
- SetDestinationSubDirectory ( assembly , group . Key , symbol ) ;
147
+ SetDestinationSubDirectory ( assembly , group . Key , symbol , isDuplicate : true ) ;
148
148
output . Add ( assembly ) ;
149
149
}
150
150
} else {
@@ -158,6 +158,7 @@ void DeduplicateAssemblies (List<ITaskItem> output, Dictionary<string, ITaskItem
158
158
symbol ? . SetDestinationSubPath ( ) ;
159
159
assembly . SetDestinationSubPath ( ) ;
160
160
output . Add ( assembly ) ;
161
+ SetAssemblyAbiMetadata ( assembly , symbol , false ) ;
161
162
} else {
162
163
symbols . Remove ( Path . ChangeExtension ( assembly . ItemSpec , ".pdb" ) ) ;
163
164
}
@@ -197,18 +198,16 @@ bool Filter (ITaskItem item)
197
198
/// <summary>
198
199
/// Sets %(DestinationSubDirectory) and %(DestinationSubPath) based on %(RuntimeIdentifier)
199
200
/// </summary>
200
- void SetDestinationSubDirectory ( ITaskItem assembly , string fileName , ITaskItem ? symbol )
201
+ void SetDestinationSubDirectory ( ITaskItem assembly , string fileName , ITaskItem ? symbol , bool isDuplicate )
201
202
{
202
203
var rid = assembly . GetMetadata ( "RuntimeIdentifier" ) ;
203
204
string assetType = assembly . GetMetadata ( "AssetType" ) ;
204
205
205
206
// Satellite assemblies have `RuntimeIdentifier` set, but they shouldn't - they aren't specific to any architecture, so they should have none of the
206
207
// abi-specific metadata set
207
208
//
208
- // Likewise, only abi-specific assemblies (with `AssetType=native` metadata set) should have the `Destination*` metadata set
209
209
if ( ! String . IsNullOrEmpty ( assembly . GetMetadata ( "Culture" ) ) ||
210
- String . Compare ( "resources" , assetType , StringComparison . OrdinalIgnoreCase ) == 0 ||
211
- String . Compare ( "native" , assetType , StringComparison . OrdinalIgnoreCase ) != 0 ) {
210
+ String . Compare ( "resources" , assetType , StringComparison . OrdinalIgnoreCase ) == 0 ) {
212
211
rid = String . Empty ;
213
212
}
214
213
@@ -223,7 +222,7 @@ void SetDestinationSubDirectory (ITaskItem assembly, string fileName, ITaskItem?
223
222
symbol . SetMetadata ( "DestinationSubPath" , Path . Combine ( destination , Path . GetFileName ( symbol . ItemSpec ) ) ) ;
224
223
}
225
224
226
- SetAssemblyAbiMetadata ( abi , assetType , assembly , symbol ) ;
225
+ SetAssemblyAbiMetadata ( abi , assetType , assembly , symbol , isDuplicate ) ;
227
226
} else {
228
227
Log . LogDebugMessage ( $ "Android ABI not found for: { assembly . ItemSpec } ") ;
229
228
assembly . SetDestinationSubPath ( ) ;
0 commit comments