You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently, the whole platform SDKs and all native libraries used in a {N} app are included in the metadata binary files. To reduce app size and improve startup performance, we should allow app and plugin developers to specify which entities (e.g. Clang modules or Java packages) need to be accessible from JavaScript and omit the ones that aren't used.
Describe the solution you'd like
Plugins should be able to declare their native API usage from JavaScript using a file called native-api-usage.json, located in each of its platforms directories (platforms/android or platforms/ios). Its format should be like:
{
"uses": [
"java.util:List"
]
}
Apps should be able to opt-in and out of filtering for either platform, using similar specification lists in files named native-api-usage.json, located in App_Resources/Android or App_Resources/iOS:
Each entry declares a pattern which is whitelisting or blacklisting a specific set of native entities. The following rules apply:
Entries are of the form <pattern1>[:pattern2]
On Android, the first pattern is matched against Java package names, while the optional second one -- against classes, interfaces, enums, etc.
On iOS, the first pattern is matched against Clang module/submodule names, while the optional second one -- against structs, global functions, enums, Objective-C interfaces, protocols, categories, etc.
Patterns support wildcards (* (any number of characters) and ? (a single character)).
An unspecified or empty pattern is functionally equivalent to being set to * (matching everything)
If the whitelist is empty, all supported metadata entities are included, except those matching at least one entry of the blacklist
If both lists are empty, the behavior is the same as before the implementation of this feature
If whitelist-plugins-usages is true, all plugins' usage specifications are automatically appended to the application's whitelist, otherwise they are ignored. If this option is not specified explicitly, it should default to false, but if there's at least one entry in the whitelist CLI should check whether all plugins specs are present in the whitelist and emit a warning stating which plugins' entries are missing.
Additional context
After following the logic of the rules, CLI should prepare a pair of lists for each of the platforms. These lists should be saved as whitelist.mdg and blacklist.mdg in both platforms/ios and platforms/android
Each line of these files should contain one entry from the JSON specs or should start with # or // and be treated as a comment.
Notice
Most of the system iOS frameworks define implicit submodules (e.g. CoreFoundation.CFData), that's why to completely include a whole module a rule such as CoreFoundation* will be needed (strictly speaking 2 rules will be needed such as CoreFoundation and CoreFoundation.* if you don't want to risk to include other modules that start with the same prefix, like an imaginary CoreFoundation2 for example)
Is your feature request related to a problem? Please describe.
Currently, the whole platform SDKs and all native libraries used in a {N} app are included in the metadata binary files. To reduce app size and improve startup performance, we should allow app and plugin developers to specify which entities (e.g. Clang modules or Java packages) need to be accessible from JavaScript and omit the ones that aren't used.
Describe the solution you'd like
native-api-usage.json
, located in each of its platforms directories (platforms/android
orplatforms/ios
). Its format should be like:native-api-usage.json
, located inApp_Resources/Android
orApp_Resources/iOS
:Each entry declares a pattern which is whitelisting or blacklisting a specific set of native entities. The following rules apply:
<pattern1>[:pattern2]
*
(any number of characters) and?
(a single character)).*
(matching everything)whitelist-plugins-usages
istrue
, all plugins' usage specifications are automatically appended to the application's whitelist, otherwise they are ignored. If this option is not specified explicitly, it should default tofalse
, but if there's at least one entry in the whitelist CLI should check whether all plugins specs are present in the whitelist and emit a warning stating which plugins' entries are missing.Additional context
After following the logic of the rules, CLI should prepare a pair of lists for each of the platforms. These lists should be saved as
whitelist.mdg
andblacklist.mdg
in bothplatforms/ios
andplatforms/android
Each line of these files should contain one entry from the JSON specs or should start with
#
or//
and be treated as a comment.Notice
Most of the system iOS frameworks define implicit submodules (e.g.
CoreFoundation.CFData
), that's why to completely include a whole module a rule such asCoreFoundation*
will be needed (strictly speaking 2 rules will be needed such asCoreFoundation
andCoreFoundation.*
if you don't want to risk to include other modules that start with the same prefix, like an imaginaryCoreFoundation2
for example)This issue is related to: NativeScript/ios-jsc#1209 and NativeScript/android#1485
The text was updated successfully, but these errors were encountered: