-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Xamarin.Android.Build.Tasks] fix Debug mode and $(PublishTrimmed) #9452
Conversation
[Test] | ||
public void CheckDebugModeWithTrimming () | ||
{ | ||
bool usesAssemblyStores = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you want to make this a parameter? The value never changes from false
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test didn't work with true
, it doesn't seem to find any assembly stores. This could be another bug? But I manually checked and saw the assemblies inside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't find any assembly stores because there are no assemblies in the build (the _Shrunk*
item groups are empty)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must be with FastDev enabled, because without it I don't see the _Shrunk*
groups populated :(
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
There is a problem if you have the combination: * `Configuration=Debug` * `PublishTrimmed=true` We emit an `XA0119` warning with this combination, as there is not a good reason to do it. But unfortunately, the build will be completely broken as all the .NET assemblies don't make it to the `.apk`! I could reproduce this in a test. The fix is that the logic in the `<ProcessAssemblies/>` MSBuild task needs to match the logic in the `_PrepareAssemblies` MSBuild target: if (PublishTrimmed && !AndroidIncludeDebugSymbols) { //... ShrunkAssemblies = shrunkAssemblies.ToArray (); } Should match: <ItemGroup Condition=" '$(PublishTrimmed)' == 'true' and '$(AndroidIncludeDebugSymbols)' != 'true' "> With the preceding `<ItemGroup>` having the inverse of this `Condition`. Going forward, we could probably refactor some of this logic to make things simpler, but this is a reasonable fix for now.
4b5f0b5
to
e5609d4
Compare
This comment was marked as outdated.
This comment was marked as outdated.
Ok, the fix was actually in C#, in the |
…9452) There is a problem if you have the combination: * `Configuration=Debug` * `PublishTrimmed=true` We emit an `XA0119` warning with this combination, as there is not a good reason to do it. But unfortunately, the build will be completely broken as all the .NET assemblies don't make it to the `.apk`! I could reproduce this in a test. The fix is that the logic in the `<ProcessAssemblies/>` MSBuild task: if (PublishTrimmed && !AndroidIncludeDebugSymbols) { //... ShrunkAssemblies = shrunkAssemblies.ToArray (); } Has a case, where we did not fill out the `ShrunkAssemblies` `[Output]` item group: if (!AndroidIncludeDebugSymbols) { // existing logic... } else { ShrunkAssemblies = OutputAssemblies; } Going forward, we could probably refactor some of this logic to make things simpler, but this is a reasonable fix for now.
There is a problem if you have the combination:
Configuration=Debug
PublishTrimmed=true
We emit an
XA0119
warning with this combination, as there is not a good reason to do it.But unfortunately, the build will be completely broken as all the .NET assemblies don't make it to the
.apk
! I could reproduce this in a test.The fix is that the logic in the
<ProcessAssemblies/>
MSBuild task:Has a case, where we did not fill out the
ShrunkAssemblies
[Output]
item group:Going forward, we could probably refactor some of this logic to make things simpler, but this is a reasonable fix for now.