*/
ni_error_e createNIUnderPkgRoot(const std::string& pkgId, NIOption* opt);
+/**
+ * @brief create native images for all DLLs in a package with specified path.
+ * @param[in] rootPath path of package
+ * @param[in] flags additional flags for the image generator
+ * @parma[in] rpk if true, generate RPK native image (default value is false)
+ * @return ni_error_e
+ */
+ni_error_e createNIUnderPkgRootWithPath(const std::string& rootPath, NIOption* opt, bool rpk = false);
+
/**
* @brief remove platform native images (.NETCore + TizenFX)
*/
" --ni-dll - Create NI for DLL\n"
" --ni-pkg - Create NI for package\n"
" (If package is installed under RO area, NI files are generated under RW area)\n"
+ " --ni-pkg-with-path - Create NI for package with root path\n"
+ " (If package is installed under RO area, NI files are generated under RW area)\n"
" --ni-dir - Create NI for directory\n"
" --ni-reset-system - Remove System NI files\n"
" --ni-reset-all-app - Remove All App NI files\n"
}
}
+//sh-3.2# dotnettool --ni-pkg-with-path [path] [path] ...
+static void dotnettool_ni_pkg_with_path(NIOption* opt)
+{
+ if (opt->flags & NI_FLAGS_RM_ORIGIN_AFTER_NI) {
+ _SERR("App AOTC options cannot be used with --rm-origin-after-ni option");
+ DisplayUsage();
+ return;
+ }
+ if (args.size() < 1) {
+ _SERR("Package name is missing");
+ }
+ while (it != args.end()) {
+ std::string path = std::string(*it);
+ if (createNIUnderPkgRootWithPath(path, opt) != NI_ERROR_NONE) {
+ _SERR("Failed to generate app NI from path[%s]", path.c_str());
+ break;
+ }
+ it = args.erase(it);
+ }
+}
+
//sh-3.2# dotnettool --ni-dir [AssemblyDirectory] [AssemblyDirectory] ...
static void dotnettool_ni_dir(NIOption* opt)
{
else if (cmd == "--ni-pkg") {
dotnettool_ni_pkg(opt);
}
+ else if (cmd == "--ni-pkg-with-path") {
+ dotnettool_ni_pkg_with_path(opt);
+ }
else if (cmd == "--ni-dir") {
dotnettool_ni_dir(opt);
}
}
ni_error_e createNIUnderPkgRoot(const std::string& pkgId, NIOption* opt)
+{
+ std::string rootPath = getRootPath(pkgId);
+ if (rootPath.empty()) {
+ _SERR("Failed to get root path from [%s]", pkgId.c_str());
+ return NI_ERROR_INVALID_PACKAGE;
+ }
+
+ return createNIUnderPkgRootWithPath(rootPath, opt, isRPK(pkgId));
+}
+
+ni_error_e createNIUnderPkgRootWithPath(const std::string& rootPath, NIOption* opt, bool rpk)
{
if (!isR2RImage(concatPath(__pm->getRuntimePath(), "System.Private.CoreLib.dll"))) {
_SERR("The native image of System.Private.CoreLib does not exist.\n"
return NI_ERROR_CORE_NI_FILE;
}
- std::string rootPath = getRootPath(pkgId);
if (rootPath.empty()) {
- _SERR("Failed to get root path from [%s]", pkgId.c_str());
+ _SERR("Failed. rootPath should be set");
return NI_ERROR_INVALID_PACKAGE;
}
__pm->setAppRootPath(rootPath);
}
std::string targetDirs;
- if (isRPK(pkgId)) {
+ if (rpk) {
opt->flags &= ~NI_FLAGS_APPNI; // added to exclude logic of APP_NI
opt->flags |= NI_FLAGS_NO_PIPELINE; // added the flag to set the output path
std::string paths = getResourcePaths(rootPath);
if (paths.empty()) {
- _SERR("Failed to get rpk paths from [%s]", pkgId.c_str());
+ _SERR("Failed to get rpk paths from rootPath[%s]", rootPath.c_str());
return NI_ERROR_UNKNOWN;
}
targetDirs = paths;