X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=NativeLauncher%2Ftool%2Fmulti_target_resolver.cc;h=e787b9ea2f656b078dc2b5d3bb4db682dd4ebbbb;hb=50662703de60935c936c11768a0c530e88f50f50;hp=317aae46a6658fff04ff03239aba5e202d8bc09d;hpb=ebad648f17029c908403b945f4c04631a25e4312;p=platform%2Fcore%2Fdotnet%2Flauncher.git diff --git a/NativeLauncher/tool/multi_target_resolver.cc b/NativeLauncher/tool/multi_target_resolver.cc index 317aae4..e787b9e 100644 --- a/NativeLauncher/tool/multi_target_resolver.cc +++ b/NativeLauncher/tool/multi_target_resolver.cc @@ -25,26 +25,54 @@ static const char* __TIZEN_RID_VERSION_KEY = "db/dotnet/tizen_rid_version"; static const char* __TIZEN_TFM_SUPPORT_KEY = "db/dotnet/tizen_tfm_support"; +static const char* __DOTNET_RUNTIME_VERSION_KEY = "db/dotnet/runtime_version"; +static std::vector platform_version_list; +/* +Priority | RID | TFM +---------|---------------------|----------------------- +1 | tizen.X.Y.Z-{arch} | netX.Y-tizenX.Y ~ 6.5 +2 | tizen.X.Y.Z | netX.Y-tizen +3 | tizen-{arch}, tizen | netX.Y +4 | linux-{arch}, linux | tizen90 ~ 40 +5 | unix-{arch}, unix | net5.0 +6 | any | netcoreapp3.1 ~ 1.0 +7 | base | netstandard2.1 ~ 1.0 +*/ + +static int convertStrVersionToInt(const std::string& version) +{ + int ret = 0; + for (unsigned int i = 0; i < version.length(); i++) { + if (std::isdigit(int(version[i]))) { + ret = ret * 10 + (int(version[i]) - '0'); + } + } + return ret; +} static std::vector getRidFallbackGraph() { std::vector RID_FALLBACK_GRAPH; - char* tizen_rid = vconf_get_str(__TIZEN_RID_VERSION_KEY); - if (tizen_rid) { - std::vector version; - splitPath(tizen_rid, version); - std::reverse(std::begin(version), std::end(version)); - for (unsigned int i = 0; i < version.size(); i++) { - RID_FALLBACK_GRAPH.push_back(std::string("tizen." + version[i] + "-" + ARCHITECTURE_IDENTIFIER)); - RID_FALLBACK_GRAPH.push_back(std::string("tizen." + version[i])); + char* tizen_rid_version = vconf_get_str(__TIZEN_RID_VERSION_KEY); + if (tizen_rid_version) { + std::vector rid_version; + splitPath(tizen_rid_version, rid_version); + std::reverse(std::begin(rid_version), std::end(rid_version)); + for (auto& ridVersion : rid_version) { + //.NET 6.0 is supported from Tizen 6.5.0 + if (convertStrVersionToInt(ridVersion) >= 650) { + platform_version_list.push_back(ridVersion.substr(0, ridVersion.rfind('.'))); + } + RID_FALLBACK_GRAPH.push_back(std::string("tizen." + ridVersion + "-" + ARCHITECTURE_IDENTIFIER)); + RID_FALLBACK_GRAPH.push_back(std::string("tizen." + ridVersion)); } - free(tizen_rid); + free(tizen_rid_version); } std::vector RID_FALLBACK_OS = {"tizen", "linux", "unix"}; - for (unsigned int i = 0; i < RID_FALLBACK_OS.size(); i++) { - RID_FALLBACK_GRAPH.push_back(std::string(RID_FALLBACK_OS[i] + "-" + ARCHITECTURE_IDENTIFIER)); - RID_FALLBACK_GRAPH.push_back(std::string(RID_FALLBACK_OS[i])); + for (auto& os : RID_FALLBACK_OS) { + RID_FALLBACK_GRAPH.push_back(std::string(os + "-" + ARCHITECTURE_IDENTIFIER)); + RID_FALLBACK_GRAPH.push_back(std::string(os)); } RID_FALLBACK_GRAPH.push_back("any"); RID_FALLBACK_GRAPH.push_back("base"); @@ -54,14 +82,39 @@ static std::vector getRidFallbackGraph() static std::vector getTfmFallbackGraph() { - std::vector tfmList; + std::vector tfm_list; + char* dotnet_runtime_version = vconf_get_str(__DOTNET_RUNTIME_VERSION_KEY); + if (dotnet_runtime_version) { + std::vector dotnet_version; + splitPath(dotnet_runtime_version, dotnet_version); + for (auto& dotnetVersion : dotnet_version) { + dotnetVersion = dotnetVersion.substr(0, dotnetVersion.rfind('.')); + for (auto& platformVersion : platform_version_list) { + tfm_list.push_back(std::string("net" + dotnetVersion + "-tizen" + platformVersion)); + } + tfm_list.push_back(std::string("net" + dotnetVersion + "-tizen")); + tfm_list.push_back(std::string("net" + dotnetVersion)); + } + free(dotnet_runtime_version); + } + char* tizen_tfm = vconf_get_str(__TIZEN_TFM_SUPPORT_KEY); if (tizen_tfm) { - splitPath(tizen_tfm, tfmList); + splitPath(tizen_tfm, tfm_list); free(tizen_tfm); } + tfm_list.push_back("net5.0"); + + std::vector netcoreapp_version = {"3.1", "3.0", "2.2", "2.1", "2.0", "1.1", "1.0"}; + for (auto& version : netcoreapp_version) { + tfm_list.push_back(std::string("netcoreapp" + version)); + } + std::vector netstandard_version = {"2.1", "2.0", "1.6", "1.5", "1.4", "1.3", "1.2", "1.1", "1.0"}; + for (auto& version : netstandard_version) { + tfm_list.push_back(std::string("netstandard" + version)); + } - return tfmList; + return tfm_list; } // move all files under a certain directory to another directory @@ -128,9 +181,9 @@ int resolvePlatformSpecificFiles(const std::string& rootPath) _ERR("Failed to copy files from tfm path"); return -1; } + break; } } - break; } } @@ -152,12 +205,12 @@ static int appResolveCb(pkgmgrinfo_appinfo_h handle, void *user_data) ret = pkgmgrinfo_appinfo_get_root_path(handle, &rootPath); if (ret != PMINFO_R_OK) { - fprintf(stderr, "Failed to get root path"); + _SERR("Failed to get root path"); return -1; } if (resolvePlatformSpecificFiles(rootPath) != 0) { - fprintf(stderr, "Failed to resolve platform specific resources (%s)\n", rootPath); + _SERR("Failed to resolve platform specific resources (%s)", rootPath); return -1; } @@ -189,4 +242,3 @@ int resolveAllApps() return 0; } -