Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ _ResolveAssemblies MSBuild target.
<IntermediateAssembly Remove="@(IntermediateAssembly)" />
<IntermediateAssembly Include="$(_OuterIntermediateAssembly)" />
</ItemGroup>
<ItemGroup Condition=" '@(_DebugSymbolsIntermediatePath->Count())' != '0' ">
<_DebugSymbolsIntermediatePath Remove="@(_DebugSymbolsIntermediatePath)" />
<_DebugSymbolsIntermediatePath Include="$([System.IO.Path]::ChangeExtension ($(_OuterIntermediateAssembly), '.pdb'))" />
</ItemGroup>
</Target>

<Target Name="_ResolveAssemblies">
Expand Down Expand Up @@ -67,8 +71,8 @@ _ResolveAssemblies MSBuild target.
Condition=" '%(Identity)' != '' "
/>
<ProcessAssemblies
InputAssemblies="@(_ResolvedAssemblyFiles)"
ResolvedSymbols="@(_ResolvedSymbolFiles)"
InputAssemblies="@(_ResolvedAssemblyFiles->Distinct())"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is @(_ResolvedAssemblyFiles->Distinct()) potentially stored in a file anywhere? Presumably this expression controls @(_ProcessedShrunkAssemblies)? .Distinct() may change the ordering, and I don't know if that ordering is consistent from one process run to the next, so if this is "somehow" stored in a file anywhere, it may result in bad dependency tracking.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

->Distinct() in MSBuild preserves ordering, I asked Rainer about this before:

https://github.com/dotnet/msbuild/blob/6605cdf6e969fa670bab736a0aca415da2080cdb/src/Build/Evaluation/Expander.cs#L2517-L2555

@(_ResolvedAssemblyFiles) won't be used anywhere else, but the outputs of <ProcessAssemblies/> will be.

ResolvedSymbols="@(_ResolvedSymbolFiles->Distinct())"
IncludeDebugSymbols="$(AndroidIncludeDebugSymbols)"
LinkMode="$(AndroidLinkMode)">
<Output TaskParameter="OutputAssemblies" ItemName="_ProcessedAssemblies" />
Expand Down Expand Up @@ -121,10 +125,10 @@ _ResolveAssemblies MSBuild target.
<Target Name="_PrepareAssemblies"
DependsOnTargets="$(_PrepareAssembliesDependsOnTargets)">
<ItemGroup Condition=" '$(AndroidLinkMode)' == 'None' And '$(AndroidIncludeDebugSymbols)' == 'true' ">
<_ResolvedAssemblies Include="@(ResolvedAssemblies->'$(MonoAndroidIntermediateAssemblyDir)%(DestinationSubPath)')" />
<_ResolvedUserAssemblies Include="@(ResolvedUserAssemblies->'$(MonoAndroidIntermediateAssemblyDir)%(DestinationSubPath)')" />
<_ResolvedFrameworkAssemblies Include="@(ResolvedFrameworkAssemblies->'$(MonoAndroidIntermediateAssemblyDir)%(DestinationSubPath)')" />
<_ResolvedSymbols Include="@(ResolvedSymbols->'$(MonoAndroidIntermediateAssemblyDir)%(DestinationSubPath)')" />
<_ResolvedAssemblies Include="@(ResolvedAssemblies->'$(MonoAndroidIntermediateAssemblyDir)%(DestinationSubPath)')" Condition=" '%(DestinationSubPath)' != '' " />
<_ResolvedUserAssemblies Include="@(ResolvedUserAssemblies->'$(MonoAndroidIntermediateAssemblyDir)%(DestinationSubPath)')" Condition=" '%(DestinationSubPath)' != '' " />
<_ResolvedFrameworkAssemblies Include="@(ResolvedFrameworkAssemblies->'$(MonoAndroidIntermediateAssemblyDir)%(DestinationSubPath)')" Condition=" '%(DestinationSubPath)' != '' " />
<_ResolvedSymbols Include="@(ResolvedSymbols->'$(MonoAndroidIntermediateAssemblyDir)%(DestinationSubPath)')" Condition=" '%(DestinationSubPath)' != '' " />
<_ShrunkAssemblies Include="@(_ResolvedAssemblies)" />
<_ShrunkUserAssemblies Include="@(_ResolvedUserAssemblies)" />
<_ShrunkFrameworkAssemblies Include="@(_ResolvedFrameworkAssemblies)" />
Expand Down
7 changes: 1 addition & 6 deletions src/Xamarin.Android.Build.Tasks/Tasks/ProcessAssemblies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,7 @@ public override bool RunTask ()
assembly.SetMetadata ("FrameworkAssembly", frameworkAssembly.ToString ());
assembly.SetMetadata ("HasMonoAndroidReference", MonoAndroidHelper.HasMonoAndroidReference (reader).ToString ());
} else {
Log.LogDebugMessage ($"Removing duplicate: {assembly.ItemSpec}");

var symbolPath = Path.ChangeExtension (assembly.ItemSpec, ".pdb");
if (symbols.Remove (symbolPath)) {
Log.LogDebugMessage ($"Removing duplicate: {symbolPath}");
}
symbols.Remove (Path.ChangeExtension (assembly.ItemSpec, ".pdb"));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,14 +359,16 @@ public void DotNetBuild (string runtimeIdentifiers, bool isRelease)
var apkPath = Path.Combine (outputPath, "UnnamedProject.UnnamedProject.apk");
FileAssert.Exists (apkPath);
using (var apk = ZipHelper.OpenZip (apkPath)) {
apk.AssertContainsEntry (apkPath, $"assemblies/{proj.ProjectName}.dll", shouldContainEntry: expectEmbeddedAssembies);
apk.AssertContainsEntry (apkPath, $"assemblies/{proj.ProjectName}.pdb", shouldContainEntry: !CommercialBuildAvailable && !isRelease);
var rids = runtimeIdentifiers.Split (';');
foreach (var abi in rids.Select (MonoAndroidHelper.RuntimeIdentifierToAbi)) {
apk.AssertContainsEntry (apkPath, $"lib/{abi}/libmonodroid.so");
apk.AssertContainsEntry (apkPath, $"lib/{abi}/libmonosgen-2.0.so");
if (rids.Length > 1) {
apk.AssertContainsEntry (apkPath, $"assemblies/{abi}/System.Private.CoreLib.dll", expectEmbeddedAssembies);
apk.AssertContainsEntry (apkPath, $"assemblies/{abi}/System.Private.CoreLib.dll", shouldContainEntry: expectEmbeddedAssembies);
} else {
apk.AssertContainsEntry (apkPath, "assemblies/System.Private.CoreLib.dll", expectEmbeddedAssembies);
apk.AssertContainsEntry (apkPath, "assemblies/System.Private.CoreLib.dll", shouldContainEntry: expectEmbeddedAssembies);
}
}
}
Expand Down