Bug-fix: fix target dll searching logic
[platform/core/dotnet/launcher.git] / NativeLauncher / inc / ni_common.h
index 9fcd321..28b387f 100644 (file)
@@ -18,6 +18,9 @@
 #define __NI_COMMON_H__
 
 #include <functional>
+#include <vector>
+#include <string>
+#include <cstdint>
 
 #ifndef DWORD
 #define DWORD uint32_t
 /**
  * Common flags passed to crossgen()
 */
-#define NI_FLAGS_ENABLER2R              0x0001
-#define NI_FLAGS_APPNI                  0x0002
-#define NI_FLAGS_COMPATIBILITY          0x0004
-#define NI_FLAGS_VERBOSE                0x0008
-#define NI_FLAGS_INSTRUMENT             0x1000
+#define NI_FLAGS_APPNI                  0x0001
+#define NI_FLAGS_VERBOSE                0x0002
+#define NI_FLAGS_APP_UNDER_RO_AREA      0x0004
+#define NI_FLAGS_INPUT_BUBBLE           0x0010
+#define NI_FLAGS_INPUT_BUBBLE_REF       0x0020
+#define NI_FLAGS_EXTRA_REF              0x0040
+#define NI_FLAGS_NO_PIPELINE            0x0080
+#define NI_FLAGS_MIBC                   0x0100
+#define NI_FLAGS_PRINT_CMD              0x0200
+#define NI_FLAGS_SKIP_RO_APP            0x0400
+#define NI_FLAGS_RM_ORIGIN_AFTER_NI     0x0800
+#define NI_FLAGS_SET_PRIORITY           0x1000
 
 typedef std::function<void (std::string)> afterCreate;
 
@@ -42,24 +52,30 @@ typedef enum {
        NI_ERROR_INVALID_PACKAGE = -4,
        NI_ERROR_NOT_SUPPORTED = -5,
        NI_ERROR_CORE_NI_FILE = -6,
+       NI_ERROR_ABNORMAL_PROCESS_TERMINATION = -7,
        NI_ERROR_UNKNOWN = -9
 } ni_error_e;
 
+typedef struct NIOption{
+       DWORD flags;
+       std::vector<std::string> refFiles;
+       std::vector<std::string> extraRefPath;
+       std::vector<std::string> inputBubbleRefFiles;
+       std::vector<std::string> mibcPath;
+       int priority;
+} NIOption;
+
 /**
- * @brief : structure which contains base directory info
+ * @brief get NIOption structure for setting
+ * @return NIOption*
  */
-typedef struct NiCommonOption {
-       std::string runtimeDir; /**< .NETCore Runtime directory */
-       std::string tizenFXDir; /**< TizenFX directory */
-       std::string extraDirs; /**< ":" seperated directories which can be set by plugins */
-} NiCommonOption;
+NIOption* getNIOption();
 
 /**
  * @brief initialize NICommon
- * @param[i] options base directory info
  * @return ni_error_e 0 on success, otherwise a negative error value
  */
-ni_error_e initNICommon(NiCommonOption* option);
+ni_error_e initNICommon();
 
 /**
  * @brief finalize NICommon
@@ -69,92 +85,72 @@ void finalizeNICommon();
 
 /**
  * @brief create native images for platform DLLs (.NETCore + TizenFX)
- * @param[i] flags additional flags for the image generator
+ * @param[in] paths paths to directories which contains extra platform dlls
+ * @param[in] flags additional flags for the image generator
  * @return ni_error_e
  */
-ni_error_e createNiPlatform(DWORD flags);
+ni_error_e createNIPlatform(std::string& extraInputs, NIOption* opt);
 
 /**
  * @brief create a native image for a single DLL
- * @param[i] dllPath path to input DLL
- * @param[i] flags additional flags for the image generator
+ * @param[in] dllPath path to input DLL
+ * @param[in] flags additional flags for the image generator
  * @return ni_error_e
  */
-ni_error_e createNiDll(const std::string& dllPath, DWORD flags);
-
-/**
- * @brief create native images for TAC DLLs
- * @param[i] rootPaths paths to TAC directories
- * @param[i] count length of rootPaths
- * @param[i] flags additional flags for the image generator
- */
-void createNiUnderTAC(const std::string rootPaths[], int count, DWORD flags);
+ni_error_e createNIDll(const std::string& dllPath, NIOption* opt);
 
-/**
- * @brief creates a symbolic link file, the native image of TAC for specific package.
- * @param[i] pkgId package ID
- * @param[i] flags additional flags for the image generator
- * @return ni_error_e
- */
-ni_error_e createTACPkgRoot(const std::string& pkgId, DWORD flags);
 
 /**
  * @brief create native images for all DLLs under directories
- * @param[i] rootPaths paths to directories
- * @param[i] count length of rootPaths
- * @param[i] flags additional flags for the image generator
+ * @param[in] rootPaths paths to directories
+ * @param[in] flags additional flags for the image generator
  * @return ni_error_e
  */
-ni_error_e createNiUnderDirs(const std::string rootPaths[], int count, DWORD flags);
+ni_error_e createNIUnderDirs(const std::string& rootPaths, NIOption* opt);
 
 /**
  * @brief create native images for all DLLs in a package
- * @param[i] pkgId package ID
- * @param[i] flags additional flags for the image generator
+ * @param[in] pkgId package ID
+ * @param[in] flags additional flags for the image generator
  * @return ni_error_e
  */
-ni_error_e createNiUnderPkgRoot(const std::string& pkgId, DWORD flags);
-
-/**
- * @brief create a native image for a single dll in a package
- * @param[i] pkgId package ID
- * @param[i] dllPath path to input DLL
- * @param[i] flags additional flags for the image generator
- * @return ni_error_e
- */
-ni_error_e createNiDllUnderPkgRoot(const std::string& pkgId, const std::string& dllPath, DWORD flags);
+ni_error_e createNIUnderPkgRoot(const std::string& pkgId, NIOption* opt);
 
 /**
  * @brief remove platform native images (.NETCore + TizenFX)
  */
-void removeNiPlatform();
+void removeNIPlatform();
 
 /**
  * @brief remove native images under directories
- * @param[i] rootPaths paths to directories
- * @param[i] count length of rootPaths
+ * @param[in] rootPaths paths to directories
  */
-void removeNiUnderDirs(const std::string rootPaths[], int count);
+void removeNIUnderDirs(const std::string& rootPaths);
 
 /**
  * @brief remove native images of a package
- * @param[i] pkgId package ID
+ * @param[in] pkgId package ID
  * @return ni_error_e
  */
-ni_error_e removeNiUnderPkgRoot(const std::string& pkgId);
+ni_error_e removeNIUnderPkgRoot(const std::string& pkgId);
 
 /**
- * @brief regenerate native images of all installed applications
- * @param[i] flags additional flags for the image generator
+ * @brief regenerate native images of all installed packages (tpk, rpk)
+ * @param[in] flags additional flags for the image generator
  * @return ni_error_e
  */
-ni_error_e regenerateAppNI(DWORD flags);
+ni_error_e regeneratePkgNI(NIOption* opt);
 
 /**
  * @brief regenerate native image of TAC for all shared assembly.
- * @param[i] flags additional flags for the image generator
+ * @param[in] flags additional flags for the image generator
  * @return ni_error_e
  */
-ni_error_e regenerateTACNI(DWORD flags);
+ni_error_e regenerateTACNI(NIOption* opt);
+
+/**
+ * @brief Sets the priority of the process to the specified values from -20 to 19.(default : 0)
+ */
+void setPriority(NIOption* opt);
 
 #endif /* __NI_COMMON_H__ */