ni_error_e createNiDll(const std::string& dllPath, bool enableR2R);
/**
+ * @brief create native images for TAC DLLs.
+ * @param[i] rootPaths directories whicn contains DLLs
+ * @param[i] count number of rootPath
+ */
+void createNiUnderTAC(const std::string rootPaths[], int count);
+
+/**
* @brief create native images with files under specific directory.
* @param[i] rootPaths directories whicn contains DLLs
* @param[i] count number of rootPath
std::string originPath = bf::read_symlink(symPath).string();
std::string originNiPath = originPath.substr(0, originPath.rfind(".dll")) + ".ni.dll";
if (!bf::exists(originNiPath)) {
- if(createNiDll(originPath, false) != NI_ERROR_NONE) {
+ if(createNiDllUnderPkgRoot(pkgId, originPath, false) != NI_ERROR_NONE) {
_ERR("Failed to create NI file [%s]", originPath.c_str());
return -1;
}
#define __XSTR(x) #x
#define __STR(x) __XSTR(x)
static const char* __CROSSGEN_PATH = __STR(CROSSGEN_PATH);
+static const char* __TAC_DIR = __STR(TAC_DIR);
#ifdef UNIQUE_DEFAULT_BASE_ADDR_SUPPORT
static const char* __SYSTEM_BASE_FILE = __STR(SYSTEM_BASE_FILE);
return NI_ERROR_UNKNOWN;
}
- if (isAppNI) {
+ if (isAppNI && strstr(absNiPath.c_str(), __TAC_DIR) == NULL) {
absNiPath = getAppNIPath(absNiPath);
}
return status;
}
+void createNiUnderTAC(const std::string rootPaths[], int count)
+{
+ std::string appPaths;
+ try {
+ for (auto& nuget : bf::recursive_directory_iterator(__TAC_DIR)) {
+ std::string nugetPath = nuget.path().string();
+ if (bf::is_directory(nugetPath)) {
+ appPaths += nugetPath;
+ appPaths += ':';
+ }
+ }
+ if (appPaths.back() == ':') {
+ appPaths.pop_back();
+ }
+
+ auto convert = [&appPaths](const std::string& path, const char* name) {
+ if (strstr(path.c_str(), TAC_APP_LIST_DB) != NULL ||
+ strstr(path.c_str(), TAC_APP_LIST_RESTORE_DB) != NULL ||
+ strstr(path.c_str(), TAC_SHA_256_INFO) != NULL)
+ return;
+ if (!crossgen(path, appPaths.c_str(), false)) {
+ waitInterval();
+ }
+ };
+
+ for (int i = 0; i < count; i++) {
+ scanFilesInDir(rootPaths[i], convert, -1);
+ }
+ } catch (const bf::filesystem_error& error) {
+ fprintf(stderr, "Failed to recursive directory: %s", error.what());
+ return;
+ }
+}
+
void createNiUnderDirs(const std::string rootPaths[], int count, bool enableR2R, bool isAppNI)
{
createCoreLibNI(enableR2R);
{
const std::string tacDir[] = {__TAC_DIR};
removeNiUnderDirs(tacDir, 1);
-
- auto convert = [](const std::string& path, std::string name) {
- if (strstr(path.c_str(), TAC_APP_LIST_DB) != NULL ||
- strstr(path.c_str(), TAC_APP_LIST_RESTORE_DB) != NULL ||
- strstr(path.c_str(), TAC_SHA_256_INFO) != NULL)
- return;
- if(createNiDll(path, false) != NI_ERROR_NONE) {
- fprintf(stderr, "Failed to create NI file [%s]\n", path.c_str());
- return;
- }
- };
- scanFilesInDir(tacDir[0], convert, -1);
+ createNiUnderTAC(tacDir, 1);
return TAC_ERROR_NONE;
}
}
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 &&
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) {
}
}
}
+ appDependencies.clear();
ifs.close();
}
}