From: 최종헌/Common Platform Lab(SR)/Engineer/삼성전자 Date: Wed, 8 Jul 2020 08:55:26 +0000 (+0900) Subject: Code cleanup and Add missing flag (#257) X-Git-Tag: submit/tizen/20200708.002229~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2487aa4c124aead2fbe9b4e76238a532e75d787b;p=platform%2Fcore%2Fdotnet%2Flauncher.git Code cleanup and Add missing flag (#257) Change-Id: I9e882fd196edb192c61641c7394fb18531293401 --- diff --git a/NativeLauncher/CMakeLists.txt b/NativeLauncher/CMakeLists.txt index 53cdf86..c23d325 100644 --- a/NativeLauncher/CMakeLists.txt +++ b/NativeLauncher/CMakeLists.txt @@ -249,4 +249,3 @@ INSTALL(FILES inc/ni_common.h DESTINATION ${INCLUDEDIR}) INSTALL(FILES inc/tac_common.h DESTINATION ${INCLUDEDIR}) INSTALL(FILES ../dotnet-launcher.pc DESTINATION ${LIBDIR}/pkgconfig) INSTALL(FILES dotnet-launcher.info DESTINATION /usr/share/parser-plugins) - diff --git a/NativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc b/NativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc index 86fbc3c..dd35e47 100644 --- a/NativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc +++ b/NativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc @@ -20,7 +20,6 @@ #include #include -#include #include #include @@ -30,6 +29,7 @@ #define LOG_TAG "DOTNET_INSTALLER_PLUGIN" bool aotPluginInstalled = false; +bool aotPluginFinished = false; extern "C" int PKGMGR_MDPARSER_PLUGIN_INSTALL(const char *pkgId, const char *appId, GList *list) { @@ -51,7 +51,7 @@ 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 0; + return -1; } if (metaValue == METADATA_VALUE) { @@ -89,13 +89,26 @@ extern "C" int PKGMGR_MDPARSER_PLUGIN_REMOVED(const char *pkgId, const char *app extern "C" int PKGMGR_MDPARSER_PLUGIN_CLEAN(const char *pkgId, const char *appId, GList *list) { - // it can be call without initializeNICommon() + // Can be multiple apps in one package + if (aotPluginFinished) { + _INFO("AOT plugin already finished(CLEAN)"); + return 0; + } + aotPluginFinished = true; + finalizeNICommon(); return 0; } extern "C" int PKGMGR_MDPARSER_PLUGIN_UNDO(const char *pkgId, const char *appId, GList *list) { + // Can be multiple apps in one package + if (aotPluginFinished) { + _INFO("AOT plugin already finished(UNDO)"); + return 0; + } + aotPluginFinished = true; + finalizeNICommon(); return 0; } diff --git a/NativeLauncher/tool/ni_common.cc b/NativeLauncher/tool/ni_common.cc index 3f73edb..2454ab8 100644 --- a/NativeLauncher/tool/ni_common.cc +++ b/NativeLauncher/tool/ni_common.cc @@ -246,7 +246,7 @@ static ni_error_e crossgen(const std::string& dllPath, const std::string& appPat } if (checkNIExistence(dllPath)) { - fprintf(stderr, "Already ni file is exist for %s\n", dllPath.c_str()); + //fprintf(stderr, "Already ni file is exist for %s\n", dllPath.c_str()); return NI_ERROR_ALREADY_EXIST; } @@ -534,7 +534,6 @@ ni_error_e createNIUnderDirs(const std::string rootPaths, DWORD flags) } auto convert = [&rootPaths, flags](const std::string& path, const std::string& filename) { - // if path is symlink, donot generate crossgen if (!crossgen(path, rootPaths.c_str(), flags)) { waitInterval(); @@ -577,6 +576,7 @@ ni_error_e createNIUnderDirs(const std::string rootPaths, DWORD flags) bf::create_symlink(originNIPath, symNIPath); copySmackAndOwnership(symPath.c_str(), symNIPath.c_str(), true); fprintf(stdout, "%s symbolic link file generated successfully.\n", symNIPath.c_str()); + _INFO("%s symbolic link file generated successfully.", symNIPath.c_str()); } } } catch (const bf::filesystem_error& error) { diff --git a/NativeLauncher/util/path_manager.cc b/NativeLauncher/util/path_manager.cc index 250f6fb..072db9e 100644 --- a/NativeLauncher/util/path_manager.cc +++ b/NativeLauncher/util/path_manager.cc @@ -17,10 +17,10 @@ #include #include #include +#include #include #include -#include #include #include "utils.h" @@ -225,9 +225,8 @@ const std::string& PathManager::getAppNIPaths() return appNIPaths; } -// return native dll searching paths for app +// return native dll searching paths for app const std::string& PathManager::getNativeDllSearchingPaths() { return nativeDllSearchingPaths; } - diff --git a/NativeLauncher/util/plugin_manager.cc b/NativeLauncher/util/plugin_manager.cc index d0e829e..a797ced 100644 --- a/NativeLauncher/util/plugin_manager.cc +++ b/NativeLauncher/util/plugin_manager.cc @@ -37,6 +37,8 @@ int initializePluginManager(const char* appType) __pluginFunc = (PluginFunc*)calloc(sizeof(PluginFunc), 1); if (!__pluginFunc) { _ERR("fail to allocate memory for plugin function structure"); + dlclose(__pluginLib); + __pluginLib = NULL; return -1; } __pluginFunc->initialize = (plugin_initialize_ptr)dlsym(__pluginLib, "plugin_initialize"); @@ -62,7 +64,11 @@ int initializePluginManager(const char* appType) void finalizePluginManager() { + if (!initializedPluginManager) + return; + _INFO("Plugin manager finalize called"); + if (__pluginFunc) { free(__pluginFunc); __pluginFunc = NULL;