Skip to content

Commit

Permalink
[One .NET] exclude libxamarin-debug-app-helper.so from Release builds (
Browse files Browse the repository at this point in the history
…#5874)

Fixes: #5855

Currently, in .NET 6, any `.so` file in our runtime pack is included
in apps by default. This is the nature of how native libraries coming
from NuGet packages work. They just get added based on the file path
and `$(RuntimeIdentifier)` of the project.

We already have a special case for `libmono-android.release.so` and
`libmono-android.debug.so` that uses `$(AndroidIncludeDebugSymbols)`
as a way to know which native library is needed.

We can do the same thing here and exclude
`libxamarin-debug-app-helper.so`, which should only be included in
`Debug` builds.

This saves ~37K for all Release apps:

    -37,104 lib/arm64-v8a/libxamarin-debug-app-helper.so *1
  • Loading branch information
jonathanpeppers authored Apr 27, 2021
1 parent 29ee180 commit a916ee0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public override bool RunTask ()
continue;
library.SetMetadata ("ArchiveFileName", "libmonodroid.so");
}
} else if (fileName == "libxamarin-debug-app-helper") {
// libxamarin-debug-app-helper.so is only needed for Debug builds
if (!IncludeDebugSymbols)
continue;
}
output.Add (library);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,17 @@
"Size": 3588112
},
"lib/arm64-v8a/libmonodroid.so": {
"Size": 347016
},
"lib/arm64-v8a/libxamarin-debug-app-helper.so": {
"Size": 37104
"Size": 346992
},
"META-INF/ANDROIDD.SF": {
"Size": 2405
"Size": 2289
},
"META-INF/ANDROIDD.RSA": {
"Size": 1213
},
"META-INF/MANIFEST.MF": {
"Size": 2278
"Size": 2162
}
},
"PackageSize": 2828142
"PackageSize": 2815764
}
Original file line number Diff line number Diff line change
Expand Up @@ -1856,7 +1856,7 @@
"Size": 433196
},
"lib/arm64-v8a/libxamarin-app.so": {
"Size": 142528
"Size": 142776
},
"lib/arm64-v8a/libSystem.IO.Compression.Native.so": {
"Size": 776168
Expand All @@ -1871,10 +1871,7 @@
"Size": 3588112
},
"lib/arm64-v8a/libmonodroid.so": {
"Size": 347016
},
"lib/arm64-v8a/libxamarin-debug-app-helper.so": {
"Size": 37104
"Size": 346992
},
"META-INF/androidx.versionedparcelable_versionedparcelable.version": {
"Size": 6
Expand Down Expand Up @@ -1991,14 +1988,14 @@
"Size": 339
},
"META-INF/ANDROIDD.SF": {
"Size": 80343
"Size": 80227
},
"META-INF/ANDROIDD.RSA": {
"Size": 1213
},
"META-INF/MANIFEST.MF": {
"Size": 80216
"Size": 80100
}
},
"PackageSize": 8623661
"PackageSize": 8611283
}

0 comments on commit a916ee0

Please sign in to comment.