-
Notifications
You must be signed in to change notification settings - Fork 564
Make all assemblies RID-specific #8478
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
Changes from 1 commit
1aed8ca
1a44132
3b251e1
daf3ed3
4850b10
7be2b35
e073491
972c8dd
4f46c74
6dd5b92
41243e5
e46460c
852eb02
9c1b501
a74c50e
eef6ece
97a2b62
3fc39cb
ec90aff
17ac554
32b647b
be79df0
e875b3e
bb7fe3d
f3e83d3
729eb76
0ef0996
4608ba2
a4747e8
5bb6684
7721aae
6111487
29747b6
446fbec
52e324f
2aa2356
4363e0f
4cab3b7
3d780b1
17dfba3
7da09bd
15be134
a0a28c1
ef6fa49
5a5960b
41a3b51
5097e23
333f3a7
b8c35a6
a6eb63f
c3ae673
5bb9d5d
91aa1f8
91c5675
9cdd0c4
85f98d7
46a9f84
6c92354
ecfbee8
38b0f64
6465410
83a92cd
54a48eb
45d9a68
a763218
2d9896a
0c42a46
e592ce9
354ade9
5a78e46
fa6fe8b
7f932f6
5f3598a
0f50a85
0233691
4630e3c
ef715a4
b7ce0e6
697072e
1f0e208
99f86d9
776ab5f
2577394
c4c65be
80b9c64
5ceece9
52bfb96
2aab14b
13dd0cc
0982d2d
0c836e4
d2ca304
9b8181d
8297613
0afc041
be460e0
6e1dd73
ab09406
08408b9
c0f5b3b
81a2162
2a0621e
6d5604d
ececd2d
6bc842c
eb84482
dfa36e8
87e2067
dee8cf3
203e6a2
20f4794
c95d321
d98858c
6a82a2d
85521b5
41ccfdb
de9a18d
fc5eff0
f55b42a
1c9c698
1025090
644d4a9
4b3d535
65b7ba4
4612446
d6efffe
a2a98f4
1176d3d
81c05a4
6e90924
5f9be55
f876742
4e712cc
a611d3a
5923ee1
3d22ecf
04c1d8d
b4a57c4
639c6fd
fb5124f
e6ed1ed
01f03a3
2a3c8fe
05e34de
7776434
3fe9d64
b76adeb
fa101bb
8d1bb33
d6eee9a
4c026ff
24519c0
6a45c63
082da85
20a4023
d709b49
06329f8
8429091
30e7420
0939db2
fb17eec
a4987ef
baf8cc2
d98a069
383f887
3ea6c6a
8c4d5aa
a922440
f788c1b
5d8604c
1b51b7b
5a6d37f
d706ffe
2a67bee
d86dbe3
703f019
45e4994
7db8c52
9e95566
66f3db0
1216016
154e70f
06b9106
8c8929c
3551a42
74457bb
357cbaa
3cc8731
7468112
9ec4ed3
f565006
a459ada
4c671f3
f860251
153253e
106703d
879604c
f3c8cd0
4824318
21941a4
288984b
6298902
3c1da09
b5b618c
0de64f8
3b4089d
2e40843
075ca5d
36b33e7
b108461
f5cce9e
164b211
d0b4c25
c135880
6d39914
40ddf67
b73a7d6
d40ed29
9421587
15358a3
59b0474
ce1be18
fe3ad02
5d6559a
b3559e6
46f08c8
1e15b0d
e439510
b197520
fb86fd0
747da76
d856c52
3d1b475
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
I need to change the assembly name mangling characters as, as it appears, Android doesn't like `#` or `%` when deploying a Debug build apk with `extractNativeLibs=true` in the manifest. In such case, none of the entries with `#` and `%` characters anywhere in the name (also tested `!`) will be extracted to the filesystem. TBC tomorrow, the great quest to find the Character That Works.
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1239,6 +1239,7 @@ EmbeddedAssemblies::register_from_apk (const char *apk_file, monodroid_should_re | |
| return number_of_found_assemblies; | ||
| } | ||
|
|
||
| template<bool MangledNamesMode> | ||
| force_inline bool | ||
| EmbeddedAssemblies::maybe_register_assembly_from_filesystem ( | ||
| [[maybe_unused]] monodroid_should_register should_register, | ||
|
|
@@ -1255,17 +1256,21 @@ EmbeddedAssemblies::maybe_register_assembly_from_filesystem ( | |
| state.file_name = dir_entry->d_name; | ||
| }; | ||
|
|
||
| // We're only interested in "mangled" file names, namely those starting with either the `#` or the `%` characters | ||
| if (dir_entry->d_name[0] == '#') { | ||
| assembly_count++; | ||
| copy_dentry_and_update_state (entry_name, state, dir_entry); | ||
| unmangle_name<UnmangleRegularAssembly> (entry_name); | ||
| } else if (dir_entry->d_name[0] == '%') { | ||
| assembly_count++; | ||
| copy_dentry_and_update_state (entry_name, state, dir_entry); | ||
| unmangle_name<UnmangleSatelliteAssembly> (entry_name); | ||
| if constexpr (MangledNamesMode) { | ||
| // We're only interested in "mangled" file names, namely those starting with either the `#` or the `%` characters | ||
| if (dir_entry->d_name[0] == '#') { | ||
| assembly_count++; | ||
| copy_dentry_and_update_state (entry_name, state, dir_entry); | ||
| unmangle_name<UnmangleRegularAssembly> (entry_name); | ||
| } else if (dir_entry->d_name[0] == '%') { | ||
| assembly_count++; | ||
| copy_dentry_and_update_state (entry_name, state, dir_entry); | ||
| unmangle_name<UnmangleSatelliteAssembly> (entry_name); | ||
| } else { | ||
| return false; | ||
| } | ||
| } else { | ||
| return false; | ||
| // TODO: check for .dll and .pdb extensions | ||
| } | ||
| state.data_offset = 0; | ||
|
|
||
|
|
@@ -1313,12 +1318,10 @@ EmbeddedAssemblies::maybe_register_blob_from_filesystem ( | |
| return true; | ||
| } | ||
|
|
||
| size_t | ||
| EmbeddedAssemblies::register_from_filesystem (monodroid_should_register should_register) noexcept | ||
| force_inline size_t | ||
| EmbeddedAssemblies::register_from_filesystem (const char *lib_dir_path,bool look_for_mangled_names, monodroid_should_register should_register) noexcept | ||
| { | ||
| log_debug (LOG_ASSEMBLY, "Registering assemblies from the filesystem"); | ||
|
|
||
| const char *lib_dir_path = androidSystem.app_lib_directories[0]; | ||
| log_debug (LOG_ASSEMBLY, "Looking for assemblies in '%s'", lib_dir_path); | ||
| DIR *lib_dir = opendir (lib_dir_path); // TODO: put it in a scope guard at some point | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand the comment; put what in a "scope guard"?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. …or is this about an RAII wrapper aorund
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, it'd be a wrapper to close the directory when the scope is no longer valid. |
||
| if (lib_dir == nullptr) { | ||
| log_warn (LOG_ASSEMBLY, "Unable to open app library directory '%s': %s", lib_dir_path, std::strerror (errno)); | ||
|
|
@@ -1343,9 +1346,12 @@ EmbeddedAssemblies::register_from_filesystem (monodroid_should_register should_r | |
| } | ||
|
|
||
| auto register_fn = | ||
| application_config.have_assembly_store ? | ||
| std::mem_fn (&EmbeddedAssemblies::maybe_register_blob_from_filesystem) : | ||
| std::mem_fn (&EmbeddedAssemblies::maybe_register_assembly_from_filesystem); | ||
| application_config.have_assembly_store ? std::mem_fn (&EmbeddedAssemblies::maybe_register_blob_from_filesystem) : | ||
| (look_for_mangled_names ? | ||
| std::mem_fn (&EmbeddedAssemblies::maybe_register_assembly_from_filesystem<true>) : | ||
| std::mem_fn (&EmbeddedAssemblies::maybe_register_assembly_from_filesystem<false> | ||
| ) | ||
| ); | ||
|
|
||
| size_t assembly_count = 0; | ||
| do { | ||
|
|
@@ -1364,6 +1370,13 @@ EmbeddedAssemblies::register_from_filesystem (monodroid_should_register should_r | |
| continue; | ||
| } | ||
|
|
||
| #if defined (DEBUG) | ||
| if (!should_register (cur->d_name)) { | ||
| log_debug (LOG_ASSEMBLY, "In Debug build, '%s' should not be registered", cur->d_name); | ||
| continue; | ||
| } | ||
| #endif // def DEBUG | ||
|
|
||
| // ...and we can handle the runtime config entry | ||
| if (!runtime_config_blob_found && std::strncmp (cur->d_name, SharedConstants::RUNTIME_CONFIG_BLOB_NAME, sizeof (SharedConstants::RUNTIME_CONFIG_BLOB_NAME) - 1) == 0) { | ||
| log_debug (LOG_ASSEMBLY, "Mapping runtime config blob from '%s'", cur->d_name); | ||
|
|
@@ -1389,6 +1402,31 @@ EmbeddedAssemblies::register_from_filesystem (monodroid_should_register should_r | |
| } while (true); | ||
| closedir (lib_dir); | ||
|
|
||
| return assembly_count; | ||
| } | ||
|
|
||
| size_t | ||
| EmbeddedAssemblies::register_from_filesystem (monodroid_should_register should_register) noexcept | ||
| { | ||
| log_debug (LOG_ASSEMBLY, "Registering assemblies from the filesystem"); | ||
|
|
||
| constexpr bool LookForMangledNames = true; | ||
| size_t assembly_count = register_from_filesystem ( | ||
| androidSystem.app_lib_directories[0], | ||
| LookForMangledNames, | ||
| should_register | ||
| ); | ||
|
|
||
| #if defined(DEBUG) | ||
| constexpr bool DoNotLookForMangledNames = false; | ||
|
|
||
| assembly_count += register_from_filesystem ( | ||
| androidSystem.get_primary_override_dir (), | ||
| DoNotLookForMangledNames, | ||
| should_register | ||
| ); | ||
| #endif | ||
|
|
||
| log_debug (LOG_ASSEMBLY, "Found %zu assemblies on the filesystem", assembly_count); | ||
| return assembly_count; | ||
| } | ||
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.
Space after
,.