The Pre-Compiled app skips the TAC (#444) accepted/tizen/7.0/unified/20221216.133937 accepted/tizen/unified/20221213.123154
author최종헌/Common Platform Lab(SR)/삼성전자 <j-h.choi@samsung.com>
Mon, 12 Dec 2022 08:09:46 +0000 (17:09 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Mon, 12 Dec 2022 08:09:46 +0000 (17:09 +0900)
Change-Id: I8aa987f98d4e5a5deb68cea543ea05faef73277f

NativeLauncher/inc/launcher_env.h
NativeLauncher/tool/ni_common.cc
NativeLauncher/tool/tac_common.cc
NativeLauncher/tool/tac_installer.cc

index 8b481f2..31de2a5 100644 (file)
@@ -35,6 +35,7 @@
 #define NET_STANDARD_LIBRARY_NUGET   "NETStandard.Library"
 #define PLATFORM_TPA_CACHE           "/usr/share/dotnet.tizen/lib/platform_tpa_cache"
 #define DISABLE_IPV6_FILE            "._TIZEN_DOTNET_SYSTEM_NET_DISABLEIPV6"
+#define PRE_COMPILED_PACKAGE_FILE    "._TIZEN_DOTNET_PRE_COMPILED_PACKAGE"
 
 #if defined (__aarch64__)
 #define ARCHITECTURE_IDENTIFIER      "arm64"
index 9fe6e18..ecfeee2 100644 (file)
@@ -669,7 +669,7 @@ static ni_error_e createCoreLibNI(NIOption* opt)
                                if (rename(niTmpCoreLib.c_str(), coreLib.c_str())) {
                                        _SERR("Failed to rename from System.Private.CoreLib.ni.dll.tmp to Private.CoreLib.dll");
                                        return NI_ERROR_CORE_NI_FILE;
-                               }                               
+                               }
                        } else {
                                if (rename(niCoreLib.c_str(), coreLib.c_str())) {
                                        _SERR("Failed to rename from System.Private.CoreLib.ni.dll to Private.CoreLib.dll");
@@ -1191,6 +1191,7 @@ ni_error_e regenerateAppNI(NIOption* opt)
 static int regenTacCb(pkgmgrinfo_appinfo_h handle, void *userData)
 {
        char *pkgId = NULL;
+       char *root = NULL;
        NIOption **pOpt = (NIOption**)userData;
 
        int ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgId);
@@ -1199,6 +1200,18 @@ static int regenTacCb(pkgmgrinfo_appinfo_h handle, void *userData)
                return -1;
        }
 
+       ret = pkgmgrinfo_appinfo_get_root_path(handle, &root);
+       if (ret != PMINFO_R_OK) {
+               _SERR("Failed to get root path");
+               return -1;
+       }
+
+       std::string binPath = concatPath(std::string(root), "bin");
+       if (exist(concatPath(binPath, PRE_COMPILED_PACKAGE_FILE))) {
+               _INFO("The %s is a Pre-Compiled package. So, skip the TAC", pkgId);
+               return 0;
+       }
+
        sqlite3 *tac_db = openDB(TAC_APP_LIST_DB);
        if (!tac_db) {
                _SERR("Sqlite open error");
index 7755565..2824a37 100644 (file)
@@ -83,8 +83,6 @@ static int tac_restoreDBCb(pkgmgrinfo_appinfo_h handle, void *userData)
        char *pkgId = NULL;
        char *root = NULL;
        char *exec = NULL;
-       std::string rootPath;
-       std::string execName;
 
        int ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgId);
        if (ret != PMINFO_R_OK) {
@@ -92,21 +90,21 @@ static int tac_restoreDBCb(pkgmgrinfo_appinfo_h handle, void *userData)
                return -1;
        }
 
-       enableTACPackage(std::string(pkgId));
-
        ret = pkgmgrinfo_appinfo_get_root_path(handle, &root);
        if (ret != PMINFO_R_OK) {
                _SERR("Failed to get root path");
                return -1;
        }
-       rootPath = std::string(root);
+       std::string rootPath = std::string(root);
 
        ret = pkgmgrinfo_appinfo_get_exec(handle, &exec);
        if (ret != PMINFO_R_OK) {
                _SERR("Failed to get exec name");
                return -1;
        }
-       execName = std::string(exec).substr(std::string(exec).rfind('/') + 1);
+       std::string execName = std::string(exec).substr(std::string(exec).rfind('/') + 1);
+
+       enableTACPackage(std::string(pkgId));
 
        std::vector<std::string> parserData;
        std::string binDir = concatPath(rootPath, "bin");
@@ -134,6 +132,7 @@ static int tac_restoreDBCb(pkgmgrinfo_appinfo_h handle, void *userData)
                }
        }
        parserData.clear();
+
        return 0;
 }
 
@@ -261,6 +260,12 @@ tac_error_e enableTACPackage(const std::string& pkgId)
                return TAC_ERROR_INVALID_PACKAGE;
        }
 
+       std::string binDir = concatPath(rootPath, "bin");
+       if (exist(concatPath(binDir, PRE_COMPILED_PACKAGE_FILE))) {
+               _INFO("The %s is a Pre-Compiled package. So, skip the TAC", pkgId.c_str());
+               return TAC_ERROR_NONE;
+       }
+
        std::string execName = getExecName(pkgId);
        if (execName.empty()) {
                _SERR("Failed to get exec name from [%s]", pkgId.c_str());
index 6e7d377..f512400 100644 (file)
@@ -260,6 +260,11 @@ int tacInstall(const std::string& pkgId, tac_state state, bool tacForce)
        }
 
        std::string binPath = concatPath(rootPath, "bin");
+       if (exist(concatPath(binPath, PRE_COMPILED_PACKAGE_FILE))) {
+               _INFO("The %s is a Pre-Compiled package. So, skip the TAC", pkgId.c_str());
+               return 0;
+       }
+
        std::string metaValue = getMetadataValue(pkgId, TAC_METADATA_KEY);
        if (!tacForce) {
                if (metaValue.empty()) {
@@ -492,6 +497,11 @@ int tacUpgrade(const std::string& pkgId, tac_state state, bool tacForce)
        }
 
        std::string binPath = concatPath(rootPath, "bin");
+       if (exist(concatPath(binPath, PRE_COMPILED_PACKAGE_FILE))) {
+               _INFO("The %s is a Pre-Compiled package. So, skip the TAC", pkgId.c_str());
+               state = TAC_STATE_REMOVED;
+       }
+
        if (state == TAC_STATE_REMOVED) {
                _INFO("Skipped to parse of deps.json");
        } else { //TAC_STATE_UPGRADE