-
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
Embed some data files in libxamarin-app.so
#9367
base: main
Are you sure you want to change the base?
Conversation
2730842
to
40a46b6
Compare
6a18219
to
c69913c
Compare
b64f9e9
to
f31d1a1
Compare
bafa9e1
to
d76969a
Compare
d76969a
to
c450cb6
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -57,6 +57,12 @@ static partial void AddManualMapping () | |||
|
|||
public static ApplicationAttribute FromCustomAttributeProvider (ICustomAttributeProvider provider, TypeDefinitionCache cache) | |||
{ | |||
// `provider` might be null in situations when application configuration is broken, and it surfaces in a number of |
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.
I'd like to know more about this scenario? How is provider
null when the application config is broken?
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.
This happened in the XA0119 test (which is, itself, a broken configuration scenario) where there were no assemblies to load and the code in ManifestDocument would iterate over the list of assemblies like so:
foreach (var assemblyPath in Assemblies) {
var assembly = Resolver.GetAssembly (assemblyPath);
if (ApplicationAttribute.FromCustomAttributeProvider (assembly, cache) is ApplicationAttribute a) {
assemblyAttr.Add (a);
}
}
Each assembly
is an instance of ICustomAttributeProvider
, but Resolver.GetAssembly
would return null
since the assembly couldn't be found.
f2d1748
to
04b4ab8
Compare
if (assembly == null) { | ||
log.LogDebugMessage ($"Assembly '{assemblyPath}' not found."); | ||
continue; | ||
} | ||
|
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.
I think you can remove this with this one merged:
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.
I think I'd like to keep it, it's a good safeguard for situations when something goes really wrong - at least we have a clear message in the log, instead of a NREX
src/Xamarin.Android.Build.Tasks/Mono.Android/InstrumentationAttribute.Partial.cs
Outdated
Show resolved
Hide resolved
src/Xamarin.Android.Build.Tasks/Mono.Android/ApplicationAttribute.Partial.cs
Outdated
Show resolved
Hide resolved
src/Xamarin.Android.Build.Tasks/Mono.Android/PermissionAttribute.Partial.cs
Outdated
Show resolved
Hide resolved
src/Xamarin.Android.Build.Tasks/Mono.Android/PermissionGroupAttribute.Partial.cs
Outdated
Show resolved
Hide resolved
src/Xamarin.Android.Build.Tasks/Mono.Android/PermissionTreeAttribute.Partial.cs
Outdated
Show resolved
Hide resolved
src/Xamarin.Android.Build.Tasks/Mono.Android/SupportsGLTextureAttribute.Partial.cs
Outdated
Show resolved
Hide resolved
src/Xamarin.Android.Build.Tasks/Mono.Android/UsesFeatureAttribute.Partial.cs
Outdated
Show resolved
Hide resolved
src/Xamarin.Android.Build.Tasks/Mono.Android/UsesPermissionAttribute.Partial.cs
Outdated
Show resolved
Hide resolved
override_dirs [0] = override_dir; | ||
#if defined(DEBUG) | ||
log_debug (LOG_DEFAULT, "Creating public update directory: `%s`", override_dir); | ||
Util::create_public_directory (override_dir); |
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 are some cases we need to create the .__override__
directory in release mode that uses libmono-android.release.so
:
- Recording an AOT profile saves the
custom.aprof
file here - JIT times saves
methods.txt
here
These changes look like it would only create .__override__
in libmono-android.debug.so
? Is that the case?
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 other situation, for release build profiling, is handled here: https://github.com/dotnet/android/pull/9367/files/01677765e2d9f55b46b96aa43d24ffc50b430115#diff-5296758f320149c3439879b0262425a13756cddabe72b83f286a5ebfc392ec7fR1127
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.
@grendello that link doesn't work? I think the commit was rebased
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.
Oof, indeed, here's one which should work
android/src/native/monodroid/monodroid-glue.cc
Line 1127 in 8dfab2e
if (Util::create_directory (AndroidSystem::override_dirs[0], 0777, 000) < 0) { |
Even though we might not have any content to embed, we need the symbols to be present, because they're part of the `libxamarin-app.so` ABI expected by `libmonodroid.so`
0167776
to
bc47870
Compare
This reverts commit bc47870. It broke 481 tests
@jonathanpeppers reverting the |
@@ -61,6 +61,10 @@ public class GeneratePackageManagerJava : AndroidTask | |||
[Required] | |||
public bool EnablePreloadAssembliesDefault { get; set; } | |||
|
|||
// This property should be required but it will require modifying `monodroid` first | |||
//[Required] | |||
public string AndroidBinUtilsDirectory { get; set; } |
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.
I don't see a reference to GeneratePackageManagerJava in monodroid?
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 are none, but I got errors in some tests when the property was required. My guess is that, for some reason, AndroidBinUtilsDirectory
was empty in some tests with the commercial bits present.
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.
Hmm interesting.
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.
@grendello can we try adding the required back so I can see what the error was? It might be a build order issue which we are currently unaware of?
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.
Sure, will push a commit in a moment
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.
Looks like it worked this time, odd. Well, good :)
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Runtime blob config and assembly store are two candidates for embedding now.
If these two files are embedded in
libxamarin-app.so
, we can skip scanning theAPK for them and, potentially, speed up startup.
Changes implemented here give us a 2% speed up on the Displayed metrics, 2.7% on
the "Native to managed" metrics and 2% on the "Total runtime init" metrics.
Tests were performed on Pixel 6 Pro, using the
dotnet new android
template.