Add --skip-ro-app option
authorWoongsuk Cho <ws77.cho@samsung.com>
Tue, 29 Mar 2022 22:34:50 +0000 (07:34 +0900)
committer조웅석/Common Platform Lab(SR)/삼성전자 <ws77.cho@samsung.com>
Tue, 19 Apr 2022 22:22:44 +0000 (07:22 +0900)
The "--ni-regen-all-app" option performs AOTC again for all installed apps.
If the "--ni-regen-all-app" option is performed after FOTA (OTN),
an error may occur or unnecessary AOTC may be performed by running AOTC for an app installed in the RO area.

To avoid this situation, the "--skip-ro-app" option is added.
If this option is set, native image regenration for apps installed in the RO area is skipped.

Note! this option works with "--ni-regen-all-app" option only.

NativeLauncher/inc/ni_common.h
NativeLauncher/tool/dotnettool.cc
NativeLauncher/tool/ni_common.cc
packaging/715.dotnet_regen_app_ni.patch.sh

index ca53f72136aa13d83ec0408b7fd0b732fcfc15c4..cec0125aec9aa47b87a685c759440fc93b1953ad 100644 (file)
@@ -38,6 +38,7 @@
 #define NI_FLAGS_NO_PIPELINE            0x0080
 #define NI_FLAGS_MIBC                   0x0100
 #define NI_FLAGS_PRINT_CMD              0x0200
+#define NI_FLAGS_SKIP_RO_APP            0x0400
 
 typedef std::function<void (std::string)> afterCreate;
 
index 4ecba2446dcffc2264191279440e9059f1ea1e03..79334a5ea1e7be8cca669ad92e51f638399d0465 100644 (file)
@@ -64,6 +64,8 @@ void DisplayUsage() {
                "                                   (If not set, default system paths are used.)\n"
                "       --no-pipeline             - Compile the dlls individually\n"
                "       --print-cmd               - Print command and options\n"
+               "       --skip-ro-app             - Skip re-generate NI for apps installed RO area\n"
+               "                                   (This option works with --ni-regen-all-app only)\n"
                "\n"
                "Usage: dotnettool [options] [command] [arguments]\n"
                "\n"
@@ -120,6 +122,8 @@ int main(int argc, char* argv[])
                        opt->flags |= NI_FLAGS_NO_PIPELINE;
                } else if (arg == "--print-cmd") {
                        opt->flags |= NI_FLAGS_PRINT_CMD;
+               } else if (arg == "--skip-ro-app") {
+                       opt->flags |= NI_FLAGS_SKIP_RO_APP;
                } else if (arg == "--ibc-dir") {
                        ++i;
                        if (i >= argc) {
index ab93a46bda3de45736c6bdf44dea7c53551b7e9e..199426f7e0a176819731c758991322ef4117d43a 100644 (file)
@@ -682,6 +682,18 @@ static int appAotCb(pkgmgrinfo_appinfo_h handle, void *userData)
        int ret = 0;
        NIOption **pOptions = (NIOption**)userData;
 
+       if ((*pOptions)->flags & NI_FLAGS_SKIP_RO_APP) {
+               bool isSystem = false;
+               int ret = pkgmgrinfo_appinfo_is_system(handle, &isSystem);
+               if (ret != PMINFO_R_OK) {
+                       _SERR("Failed to check that app is System or not\n");
+                       return -1;
+               }
+               if (isSystem) {
+                       return 0;
+               }
+       }
+
        ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgId);
        if (ret != PMINFO_R_OK) {
                _SERR("Failed to get pkgid");
index 16113957caff0aa63e26d751d66906e042b93593..fe3037c4ed8ee31efa8f43f0607f213af5976637 100644 (file)
@@ -5,6 +5,6 @@
 PATH=/usr/bin:/bin:/usr/sbin:/sbin
 
 /usr/bin/dotnettool --tac-regen-all
-/usr/bin/dotnettool --ni-regen-all-app
+/usr/bin/dotnettool --ni-regen-all-app --skip-ro-app
 /usr/bin/dotnettool --resolve-all-app
 /usr/bin/dotnettool --rm-all-app-profile