/**
* @brief regenerate native images of all installed packages (tpk, rpk)
* @param[in] flags additional flags for the image generator
+ * @param[in] removeOnly if it is set true, ni creation is skipped (default : false)
* @return ni_error_e
*/
-ni_error_e regeneratePkgNI(NIOption* opt);
+ni_error_e regeneratePkgNI(NIOption* opt, bool removeOnly = false);
/**
* @brief regenerate native image of TAC for all shared assembly.
* @param[in] flags additional flags for the image generator
+ * @param[in] removeOnly if it is set true, ni creation is skipped. (default : false)
* @return ni_error_e
*/
-ni_error_e regenerateTACNI(NIOption* opt);
+ni_error_e regenerateTACNI(NIOption* opt, bool removeOnly = false);
/**
* @brief Sets the priority of the process to the specified values from -20 to 19.(default : 0)
" (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"
" --ni-reset-pkg - Remove App NI files\n"
" --ni-reset-dir - Remove NI for directory\n"
" --ni-regen-all-app - Re-generate All App NI files\n"
+ " --tac-reset-all - Remove All TAC NI files\n"
" --tac-regen-all - Re-generate All TAC files\n"
" --tac-restore-db - Restore TAC Database\n"
" --tac-disable-pkg - Disable TAC for package\n"
else if (cmd == "--ni-reset-system") {
removeNIPlatform();
}
+ //sh-3.2# dotnettool --ni-reset-all-app
+ else if (cmd == "--ni-reset-all-app") {
+ int ret = regeneratePkgNI(opt, true);
+ if (ret != NI_ERROR_NONE) {
+ _SERR("Failed to reset all app NI");
+ }
+ }
//sh-3.2# dotnettool --ni-reset-pkg [pkgId] [pkgId] ...
else if (cmd == "--ni-reset-pkg") {
if (args.size() < 1) {
_SERR("Failed to regenerate all app NI");
}
}
+ //sh-3.2# dotnettool --tac-reset-all
+ else if (cmd == "--tac-reset-all") {
+ int ret = regenerateTACNI(opt, true);
+ if (ret != NI_ERROR_NONE) {
+ _SERR("Failed to remove all TAC NI files");
+ }
+ }
//sh-3.2# dotnettool --tac-regen-all
else if (cmd == "--tac-regen-all") {
if (opt->flags & NI_FLAGS_RM_ORIGIN_AFTER_NI) {
return doAOTList(dllList, refPaths, opt);
}
-static ni_error_e removeAndCreateNI(const char* pkgId, NIOption* pOptions)
-{
- if (removeNIUnderPkgRoot(pkgId) != NI_ERROR_NONE) {
- _SERR("Failed to remove previous dlls from [%s]", pkgId);
- return NI_ERROR_UNKNOWN;
- }
-
- if (createNIUnderPkgRoot(pkgId, pOptions) != NI_ERROR_NONE) {
- _SERR("Failed to generate NI file [%s]", pkgId);
- return NI_ERROR_UNKNOWN;
- }
-
- _SOUT("Complete make native image for pkg (%s)", pkgId);
- return NI_ERROR_NONE;
-}
-
static bool isReadOnlyPkg(std::string pkgId)
{
int ret = 0;
return NI_ERROR_NONE;
}
-ni_error_e regeneratePkgNI(NIOption* opt)
+ni_error_e regeneratePkgNI(NIOption* opt, bool removeOnly)
{
std::vector<std::string> pkgList;
ni_error_e ret = NI_ERROR_NONE;
continue;
}
- if (removeAndCreateNI(pkg.c_str(), opt) != NI_ERROR_NONE) {
+ if (removeNIUnderPkgRoot(pkg) != NI_ERROR_NONE) {
_SERR("Failed to remove previous dlls from [%s]", pkg.c_str());
ret = NI_ERROR_UNKNOWN;
- } else {
- _SOUT("Complete make application to native image");
+ }
+
+ if (!removeOnly) {
+ if (createNIUnderPkgRoot(pkg, opt) != NI_ERROR_NONE) {
+ _SERR("Failed to generate NI file [%s]", pkg.c_str());
+ ret = NI_ERROR_UNKNOWN;
+ } else {
+ _SOUT("Complete make application to native image");
+ }
}
}
return 0;
}
-ni_error_e regenerateTACNI(NIOption* opt)
+ni_error_e regenerateTACNI(NIOption* opt, bool removeOnly)
{
removeNIUnderDirs(__DOTNET_DIR);
- pkgmgrinfo_appinfo_metadata_filter_h handle;
- int ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
- if (ret != PMINFO_R_OK) {
- return NI_ERROR_UNKNOWN;
- }
+ if (!removeOnly) {
+ pkgmgrinfo_appinfo_metadata_filter_h handle;
+ int ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
+ if (ret != PMINFO_R_OK) {
+ return NI_ERROR_UNKNOWN;
+ }
- ret = pkgmgrinfo_appinfo_metadata_filter_add(handle, TAC_METADATA_KEY, METADATA_VALUE_TRUE);
- if (ret != PMINFO_R_OK) {
- pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
- return NI_ERROR_UNKNOWN;
- }
+ ret = pkgmgrinfo_appinfo_metadata_filter_add(handle, TAC_METADATA_KEY, METADATA_VALUE_TRUE);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
+ return NI_ERROR_UNKNOWN;
+ }
+
+ ret = pkgmgrAppMDFilterForeach(handle, regenTacCb, &opt);
+ if (ret != 0) {
+ pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
+ return NI_ERROR_UNKNOWN;
+ }
- ret = pkgmgrAppMDFilterForeach(handle, regenTacCb, &opt);
- if (ret != 0) {
pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
- return NI_ERROR_UNKNOWN;
}
- pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
-
return NI_ERROR_NONE;
}