Nuget with no dependency applies TAC
[platform/core/dotnet/launcher.git] / NativeLauncher / util / utils.cc
index 45b2bad..3d5a5f6 100644 (file)
@@ -619,6 +619,19 @@ std::vector<std::string> depsJsonParser(std::string rootPath, std::string execNa
                        }
                        const Json::Value runtimeTargetName = root["runtimeTarget"]["name"];
                        const Json::Value nugetPackages = root["targets"][runtimeTargetName.asString().c_str()];
+                       std::vector<std::string> appDependencies;
+                       for (auto& nuget : nugetPackages.getMemberNames()) {
+                               if (strstr(nuget.c_str(), (execName.substr(0, execName.find(".Tizen."))).c_str()) != NULL ||
+                                       strstr(nuget.c_str(), (execName.substr(0, execName.find(".dll"))).c_str()) != NULL) {
+                                       const Json::Value assemblies = nugetPackages[nuget.c_str()]["runtime"];
+                                       if (assemblies != Json::nullValue) {
+                                               const Json::Value dependencies = nugetPackages[nuget.c_str()]["dependencies"];
+                                               for (auto& dependency : dependencies.getMemberNames()) {
+                                                       appDependencies.push_back(dependency);
+                                               }
+                                       }
+                               }
+                       }
                        for (auto& nuget : nugetPackages.getMemberNames()) {
                                //Skip the nuget package related to Tizen
                                if (strstr(nuget.c_str(), TIZEN_DOTNET_NUGET) == NULL &&
@@ -634,6 +647,14 @@ std::vector<std::string> depsJsonParser(std::string rootPath, std::string execNa
                                                        if (strstr(dependency.c_str(), TIZEN_DOTNET_NUGET) == NULL &&
                                                                strstr(dependency.c_str(), NET_STANDARD_LIBRARY_NUGET) == NULL) {
                                                                hasDependency = true;
+                                                               for (auto& ad : appDependencies) {
+                                                                       if (!strcmp(ad.c_str(), dependency.c_str())) {
+                                                                               hasDependency = true;
+                                                                               break;
+                                                                       } else {
+                                                                               hasDependency = false;
+                                                                       }
+                                                               }
                                                        }
                                                }
                                                if (!hasDependency) {
@@ -660,6 +681,7 @@ std::vector<std::string> depsJsonParser(std::string rootPath, std::string execNa
                                        }
                                }
                        }
+                       appDependencies.clear();
                        ifs.close();
                }
        }