#include "utils.h"
#include "ni_common.h"
#include "tac_common.h"
+#include "profile_common.h"
+#include "privilege_common.h"
#include "multi_target_resolver.h"
#include "log.h"
" (this option should be run as root)\n"
" --rm-all-app-profile - Remove application profile of all packages for all users\n"
" (this option should be run as root)\n"
+ " --check-all-app-privilege - Chcek application privilege of all package\n"
+ " (this option should be run as root)\n"
"\n"
"Options:\n"
- " --ibc-dir - Specify a directory containing IBC files\n"
+ " --mibc - Specify Mibc files. Sepatated with ':'.\n"
" --verbose - Display verbose information\n"
- " --inputbubble - Use inputbubble\n"
- " --inputbubbleref - Path of references for inputbubble (used with --inputbubble option)\n"
- " (If not set, all references are included to inputbubble.)\n"
- " --ref - Path of references\n"
- " (If not set, default system paths are used.)\n"
+ " --inputbubble - Compile input assemblies into one bubble with the assemblies described at --inputbubbleref option\n"
+ " Note!: If you do not have an accurate understanding of Bubble, do not use this option.\n"
+ " All assemblies in the bubble must be guaranteed to be compiled to the native image before execution.\n"
+ " If an uncompiled assembly is included in the bubble during execution, an unknown error may occur.\n"
+ " If --inputbubbleref option doesnot be set, only input files are included to bubble. \n"
+ " --inputbubbleref - Input bubble reference file(s) to be added to bubble (used with --inputbubble option)\n"
+ " --ref - Reference file(s) for compilation\n"
+ " (system paths are set automatically.)\n"
" --no-pipeline - Compile the dlls individually\n"
" --print-cmd - Print command and options\n"
+ " --skip-ro-app - Skip re-generate NI for apps installed RO area\n"
+ " (This option works with --ni-regen-all-app only)\n"
+ " --rm-origin-after-ni - Remove original dll after creating native image\n"
+ " Note!: App ATOC options(--ni-pkg, --ni-regen-all-app, --tac-regen-all) cannot be used with --rm-origin-after-ni option.\n"
+ " (Use only for assemblies that will not be AOTed again afterward.)\n"
+ " --set-priority - Sets the priority of the process to the specified values from -20(highest priority) to 19(lowest priority).(default : 0)\n"
+
"\n"
"Usage: dotnettool [options] [command] [arguments]\n"
"\n"
" # dotnettool --ni-pkg org.tizen.FormsGallery\n"
"4. Regenerate native images for all installed .net packages\n"
" # dotnettool --ni-regen-all-app\n"
- "5. Create native image for dll based on the IBC data\n"
- " # dotnettool --ibc-dir /tmp/ibcdata/ --ni-dll /usr/bin/Tizen.Runtime.dll\n"
+ "5. Create native image for dll based on the Mibc data\n"
+ " # dotnettool --mibc /tmp/ibcdata/in.mibc --ni-dll /usr/bin/Tizen.Runtime.dll\n"
"6. Remove profile for package\n"
" # dotnettool --rm-app-profile org.tizen.FormsGallery\n"
"\n");
opt->flags |= NI_FLAGS_NO_PIPELINE;
} else if (arg == "--print-cmd") {
opt->flags |= NI_FLAGS_PRINT_CMD;
- } else if (arg == "--ibc-dir") {
+ } else if (arg == "--skip-ro-app") {
+ opt->flags |= NI_FLAGS_SKIP_RO_APP;
+ } else if (arg == "--rm-origin-after-ni") {
+ opt->flags |= NI_FLAGS_RM_ORIGIN_AFTER_NI;
+ } else if (arg == "--set-priority") {
++i;
if (i >= argc) {
- _SOUT("Directory path containing IBC files should be followed for --ibc-dir option");
+ _SOUT("Priority value(-20 ~ 19) should be followed for --set-priority option");
+ DisplayUsage();
+ return 0;
+ }
+
+ opt->flags |= NI_FLAGS_SET_PRIORITY;
+ try {
+ opt->priority = std::stoi(argv[i]);
+ setPriority(opt);
+ } catch (...) {
+ _SERR("Invalid argument: %s", argv[i]);
+ DisplayUsage();
+ return 0;
+ }
+ } else if (arg == "--mibc") {
+ ++i;
+ if (i >= argc) {
+ _SOUT("File path containing Mibc files should be followed for --mibc option");
DisplayUsage();
return 0;
}
std::vector<std::string> paths;
splitPath(std::string(argv[i]), paths);
for (const auto &path : paths) {
- if (!isDirectory(path)) {
- _SERR("mibc path is missing or not exist");
+ if (!isFile(path) || isDirectory(path)) {
+ _SERR("Mibc file path is missing or does not exist");
return -1;
}
opt->mibcPath.push_back(path);
opt->flags |= NI_FLAGS_INPUT_BUBBLE_REF;
- std::vector<std::string> paths;
- splitPath(std::string(argv[i]), paths);
- for (const auto &path : paths) {
- if (!isDirectory(path)) {
- _SERR("intpubbubbleref path is missing or not exist");
- return -1;
- }
- opt->inputBubbleRefPath.push_back(path);
+ std::vector<std::string> files;
+ splitPath(std::string(argv[i]), files);
+ for (const auto &f : files) {
+ opt->inputBubbleRefFiles.push_back(f);
}
} else if (arg == "--ref") {
++i;
return 0;
}
- opt->flags |= NI_FLAGS_REF;
-
- std::vector<std::string> paths;
- splitPath(std::string(argv[i]), paths);
- for (const auto &path : paths) {
- if (!isDirectory(path)) {
- _SERR("ref path is missing or not exist");
- return -1;
- }
- opt->refPath.push_back(path);
+ std::vector<std::string> files;
+ splitPath(std::string(argv[i]), files);
+ for (const auto &f : files) {
+ opt->refFiles.push_back(f);
}
} else {
args.push_back(arg);
}
}
+ if (args.size() == 0) {
+ _SERR("The command is missing");
+ DisplayUsage();
+ return -1;
+ }
+
if (opt->flags & NI_FLAGS_INPUT_BUBBLE_REF && !(opt->flags & NI_FLAGS_INPUT_BUBBLE)) {
_SERR("--inputbubbleref option should be used with --inputbubble option");
DisplayUsage();
std::string cmd = std::string(*it);
it = args.erase(it);
- //sh-3.2# dotnettool --ni-system
+ //sh-3.2# dotnettool --ni-system [AssemblyDirectory] [AssemblyDirectory] ...
if (cmd == "--ni-system") {
- int ret = createNIPlatform(opt);
+ std::string inputs;
+ while (it != args.end()) {
+ const std::string dir = std::string(*it);
+ inputs = inputs + ":" + dir;
+ it = args.erase(it);
+ }
+ int ret = createNIPlatform(inputs, opt);
if (ret != NI_ERROR_NONE) {
_SERR("Failed to generate system NI");
}
if (args.size() < 1) {
_SERR("DLL path is missing");
}
+ std::vector<std::string> inputs;
while (it != args.end()) {
std::string dll = std::string(*it);
+ inputs.push_back(dll);
+ opt->refFiles.push_back(dll);
+ if (opt->flags & NI_FLAGS_INPUT_BUBBLE) {
+ opt->inputBubbleRefFiles.push_back(dll);
+ }
+ it = args.erase(it);
+ }
+
+ for (auto &dll : inputs) {
int ret = createNIDll(dll, opt);
- if (ret != NI_ERROR_NONE) {
+ if (ret != NI_ERROR_NONE && ret != NI_ERROR_ALREADY_EXIST) {
_SERR("Failed to generate NI file [%s]", dll.c_str());
break;
}
- it = args.erase(it);
}
}
//sh-3.2# dotnettool --ni-pkg [pkgId] [pkgId] ...
else if (cmd == "--ni-pkg") {
+ if (opt->flags & NI_FLAGS_RM_ORIGIN_AFTER_NI) {
+ _SERR("App AOTC options cannot be used with --rm-origin-after-ni option");
+ DisplayUsage();
+ return -1;
+ }
+
if (args.size() < 1) {
_SERR("Package name is missing");
}
if (args.size() < 1) {
_SERR("Directory path is missing");
}
+ std::string dir;
while (it != args.end()) {
- const std::string dir = std::string(*it);
- int ret = createNIUnderDirs(dir, opt);
- if (ret != NI_ERROR_NONE) {
- _SERR("Failed to generate NI directory");
- break;
+ if (!dir.empty()) {
+ dir += std::string(":");
}
+ dir += std::string(*it);
it = args.erase(it);
}
+ if (createNIUnderDirs(dir, opt) != NI_ERROR_NONE) {
+ _SERR("Failed to generate NI directory");
+ }
}
//sh-3.2# dotnettool --ni-reset-system
else if (cmd == "--ni-reset-system") {
}
//sh-3.2# dotnettool --ni-regen-all-app
else if (cmd == "--ni-regen-all-app") {
+ if (opt->flags & NI_FLAGS_RM_ORIGIN_AFTER_NI) {
+ _SERR("App AOTC options cannot be used with --rm-origin-after-ni option");
+ DisplayUsage();
+ return -1;
+ }
+
int ret = regenerateAppNI(opt);
if (ret != NI_ERROR_NONE) {
_SERR("Failed to regenerate all app NI");
}
//sh-3.2# dotnettool --tac-regen-all
else if (cmd == "--tac-regen-all") {
+ if (opt->flags & NI_FLAGS_RM_ORIGIN_AFTER_NI) {
+ _SERR("App AOTC options cannot be used with --rm-origin-after-ni option");
+ DisplayUsage();
+ return -1;
+ }
+
int ret = regenerateTACNI(opt);
if (ret != NI_ERROR_NONE) {
_SERR("Failed to regenerate all TAC");
}
//sh-3.2# dotnettool --resolve-all-app
else if (cmd == "--resolve-all-app") {
- int ret = resolveAllApps();
- if (ret != 0) {
- _SERR("Failed to remove unused multi-targeting files");
- }
+ resolveAllApps();
}
//sh-3.2# dotnettool --rm-app-profile [pkgId] [pkgId] ...
else if (cmd == "--rm-app-profile") {
}
while (it != args.end()) {
std::string pkg = std::string(*it);
- if (removeAppProfileData(pkg) != NI_ERROR_NONE) {
+ if (removeAppProfileData(pkg) != PROFILE_ERROR_NONE) {
_SERR("Failed to remove [%s] profile data", pkg.c_str());
}
it = args.erase(it);
else if (cmd == "--rm-all-app-profile") {
removeAllAppProfileData();
}
+ //sh-3.2# dotnettool --check-all-app-privilege
+ else if (cmd == "--check-all-app-privilege") {
+ checkAllAppPrivilege();
+ }
else {
_SERR("Unknown option [%s]", cmd.c_str());
DisplayUsage();
gettimeofday(&tv, NULL);
endtime = tv.tv_sec * 1000l + tv.tv_usec / 1000l;
- _SOUT("\nSpend time for dotnettool is [%d]ms", (int)(endtime - starttime));
+ int ms = (int)(endtime - starttime);
+ float sec = (float)(ms/1000);
+ _SOUT("\nSpend time for dotnettool is [%d]ms, [%.3f]sec", ms, sec);
return 0;
}