From: Woongsuk Cho Date: Thu, 18 Jul 2024 06:14:25 +0000 (+0900) Subject: Skip AOT in plugin when pkg contains ni files X-Git-Tag: accepted/tizen/8.0/unified/20240724.010425^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Faccepted%2Ftizen_8.0_unified;hp=7a9e29f666e952f7ad36d67ea21bd5f3b6578981;p=platform%2Fcore%2Fdotnet%2Flauncher.git Skip AOT in plugin when pkg contains ni files --- diff --git a/NativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc b/NativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc index 91928a7..68b3d91 100644 --- a/NativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc +++ b/NativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc @@ -33,6 +33,11 @@ bool aotPluginInstalled = false; bool aotPluginFinished = false; +typedef struct metadata_s { + const char* key; + const char* value; +} metadata_t; + extern "C" int PKGMGR_MDPARSER_PLUGIN_INSTALL(const char *pkgId, const char *appId, GList *list) { // Can be multiple apps in one package @@ -50,13 +55,29 @@ extern "C" int PKGMGR_MDPARSER_PLUGIN_INSTALL(const char *pkgId, const char *app } } - std::string metaValue = getMetadataValue(std::string(pkgId), AOT_METADATA_KEY); - if (metaValue.empty()) { - _ERR("Failed to get metadata from [%s]", pkgId); - return -1; + bool doAOT = false; + GList* iter = list; + while (iter) { + metadata_t* md = static_cast(iter->data); + if (strcmp(AOT_METADATA_KEY, md->key) == 0) { + if (strcmp(METADATA_VALUE_TRUE, md->value) == 0) { + doAOT = true; + } + break; + } + iter = g_list_next(iter); + } + + // if package contains native image, skip AOT. + std::string rootPath = getRootPath(pkgId); + if (!rootPath.empty()) { + if (exist(concatPath(rootPath, concatPath("bin", APP_NI_SUB_DIR)))) { + _INFO("Package already contains native images. Skip native image generation"); + doAOT = false; + } } - if (metaValue == METADATA_VALUE_TRUE) { + if (doAOT) { _DBG("Prefer dotnet application AOT set TRUE"); if (initNICommon() != NI_ERROR_NONE) { diff --git a/NativeLauncher/tool/ni_common.cc b/NativeLauncher/tool/ni_common.cc index ecfeee2..96247a8 100644 --- a/NativeLauncher/tool/ni_common.cc +++ b/NativeLauncher/tool/ni_common.cc @@ -1059,6 +1059,10 @@ ni_error_e createNIUnderPkgRoot(const std::string& pkgId, NIOption* opt) if (isReadOnlyArea(rootPath)) { opt->flags |= NI_FLAGS_APP_UNDER_RO_AREA; opt->flags |= NI_FLAGS_NO_PIPELINE; + std::string tmpPath = replaceAll(rootPath, getBaseName(rootPath), __READ_ONLY_APP_UPDATE_DIR); + if (!removeAll(tmpPath)){ + _SERR("Fail to remove RO App update path : %s", tmpPath.c_str()); + } _SERR("Only no-pipeline mode supported for RO app. Set no-pipeline option forcibly"); } else { opt->flags &= ~NI_FLAGS_APP_UNDER_RO_AREA; diff --git a/packaging/715.dotnet_regen_app_ni.patch.sh b/packaging/715.dotnet_regen_app_ni.patch.sh index c877058..12496a9 100644 --- a/packaging/715.dotnet_regen_app_ni.patch.sh +++ b/packaging/715.dotnet_regen_app_ni.patch.sh @@ -4,6 +4,9 @@ PATH=/usr/bin:/bin:/usr/sbin:/sbin +# remove application native image files of RO app +rm -rf /opt/usr/dotnet/apps/* + /usr/bin/dotnettool --tac-regen-all /usr/bin/dotnettool --ni-regen-all-app --skip-ro-app /usr/bin/dotnettool --resolve-all-app