Change to create a .native_image_tmp folder when creating NI
authorj-h.choi <j-h.choi@samsung.com>
Tue, 2 Jan 2024 06:44:39 +0000 (15:44 +0900)
committer조웅석/MDE Lab(SR)/삼성전자 <ws77.cho@samsung.com>
Thu, 4 Jan 2024 01:38:54 +0000 (10:38 +0900)
NativeLauncher/inc/launcher_env.h
NativeLauncher/tool/ni_common.cc

index cfaf0d6..df832c7 100644 (file)
@@ -24,6 +24,7 @@
 #define TAC_METADATA_KEY             "http://tizen.org/metadata/prefer_nuget_cache"
 #define METADATA_VALUE_TRUE          "true"
 #define APP_NI_SUB_DIR               ".native_image"
+#define APP_NI_SUB_TMP_DIR           ".native_image_tmp"
 #define TAC_SYMLINK_SUB_DIR          ".tac_symlink"
 #define TAC_SHA_256_INFO             ".SHA256.info"
 #define TAC_APP_LIST_DB              "/opt/usr/dotnet/.TAC.App.list.db"
index ecfeee2..f897251 100644 (file)
@@ -251,7 +251,7 @@ static std::string getAppNIFilePath(const std::string& absDllPath, NIOption* opt
        std::string prevPath;
 
        prevPath = getBaseName(absDllPath);
-       niDirPath = concatPath(prevPath, APP_NI_SUB_DIR);
+       niDirPath = concatPath(prevPath, APP_NI_SUB_TMP_DIR);
 
        if (opt->flags & NI_FLAGS_APP_UNDER_RO_AREA) {
                niDirPath = replaceAll(niDirPath, getBaseName(__pm->getAppRootPath()), __READ_ONLY_APP_UPDATE_DIR);
@@ -758,20 +758,30 @@ static ni_error_e doAOTList(std::vector<std::string>& dllList, const std::string
                }
        }
 
-       if (ret == NI_ERROR_NONE && opt->flags & NI_FLAGS_INPUT_BUBBLE) {
-               for (auto &dll : dllList) {
-                       std::string tmpFile;
-                       std::string niFile;
-                       if (opt->flags & NI_FLAGS_APPNI) {
-                               niFile = getAppNIFilePath(dll, opt);
-                       } else {
-                               niFile = getNIFilePath(dll);
-                       }
-                       tmpFile = niFile + ".tmp";
+       if (ret == NI_ERROR_NONE) {
+               if (opt->flags & NI_FLAGS_INPUT_BUBBLE) {
+                       for (auto &dll : dllList) {
+                               std::string tmpFile;
+                               std::string niFile;
+                               if (opt->flags & NI_FLAGS_APPNI) {
+                                       niFile = getAppNIFilePath(dll, opt);
+                               } else {
+                                       niFile = getNIFilePath(dll);
+                               }
+                               tmpFile = niFile + ".tmp";
 
-                       if (exist(tmpFile)) {
-                               moveFile(tmpFile, niFile);
-                               _SOUT("Native image %s generated successfully.", niFile.c_str());
+                               if (exist(tmpFile)) {
+                                       moveFile(tmpFile, niFile);
+                                       _SOUT("Native image %s generated successfully.", niFile.c_str());
+                               }
+                       }
+               }
+               if (opt->flags & NI_FLAGS_APPNI) {
+                       for (const auto &path : paths) {
+                               if (path.find("/bin") != std::string::npos) {
+                                       rename(concatPath(path, APP_NI_SUB_TMP_DIR).c_str(), concatPath(path, APP_NI_SUB_DIR).c_str());
+                                       break;
+                               }
                        }
                }
        }