Merge pull request #62 from dotnet/generate_coreLib_ni_when_install
[platform/core/dotnet/launcher.git] / NativeLauncher / installer-plugin / ni_common.h
index 4b17905..0981090 100644 (file)
 
 typedef std::function<void (std::string)> afterCreate;
 
+typedef enum {
+       NI_ERROR_NONE = 0,
+       NI_ERROR_INVALID_PARAMETER = -1,
+       NI_ERROR_ALREADY_EXIST = -2,
+       NI_ERROR_NO_SUCH_FILE = -3,
+       NI_ERROR_INVALID_PACKAGE = -4,
+       NI_ERROR_NOT_SUPPORTED = -5,
+       NI_ERROR_UNKNOWN = -9
+} ni_error_e;
+
 /**
  * @brief : structure which contains directory info
  */
@@ -33,9 +43,9 @@ typedef struct NiCommonOption {
 /**
  * @brief initialize NICommon
  * @param[in] options to initialize path
- * @return 0 on success, otherwise a negative error value
+ * @return ni_error_e 0 on success, otherwise a negative error value
  */
-int initNICommon(NiCommonOption* option);
+ni_error_e initNICommon(NiCommonOption* option);
 
 /**
  * @brief finalize NICommon
@@ -52,28 +62,9 @@ void createNiPlatform(bool enableR2R);
  * @brief create native image for specific dll with file path.
  * @param[i] dllPath file path to generate native image
  * @param[i] enableR2R enable ready-to-run mode
+ * @return ni_error_e
  */
-void createNiDll(const std::string& dllPath, bool enableR2R);
-
-/**
- * @brief create native images with files under specific directory.
- * @param[i] rootPaths directories whicn contains DLLs
- * @param[i] count number of rootPath
- * @param[i] ignores DLL list which should be ignored
- * @param[i] igcount number of ignores
- * @param[i] cb callback function whicn will be called after generating native image
- * @param[i] enableR2R enable ready-to-run mode
- */
-void createNiUnderDirs(const std::string rootPaths[], int count, const std::string ignores[], int igcount, afterCreate cb, bool enableR2R);
-
-/**
- * @brief create native images with files under specific directory.
- * @param[i] rootPaths directories whicn contains DLLs
- * @param[i] count number of rootPath
- * @param[i] cb callback function whicn will be called after generating native image
- * @param[i] enableR2R enable ready-to-run mode
- */
-void createNiUnderDirs(const std::string rootPaths[], int count, afterCreate cb, bool enableR2R);
+ni_error_e createNiDll(const std::string& dllPath, bool enableR2R);
 
 /**
  * @brief create native images with files under specific directory.
@@ -87,18 +78,18 @@ void createNiUnderDirs(const std::string rootPaths[], int count, bool enableR2R)
  * @brief create native images for specific package. (All DLLs)
  * @param[i] pkgId package ID
  * @param[i] enableR2R enable ready-to-run mode
- * @return 0 on success, otherwise a negative error value
+ * @return ni_error_e
  */
-int createNiUnderPkgRoot(const std::string& pkgId, bool enableR2R);
+ni_error_e createNiUnderPkgRoot(const std::string& pkgId, bool enableR2R);
 
 /**
  * @brief create native image for specific dll in the package.
  * @Details All dlls in the package are added for reference when create native image.
  * @param[i] pkgId package ID
  * @param[i] enableR2R enable ready-to-run mode
- * @return 0 on success, otherwise a negative error value
+ * @return ni_error_e
  */
-int createNiDllUnderPkgRoot(const std::string& pkgId, const std::string& dllPath, bool enableR2R);
+ni_error_e createNiDllUnderPkgRoot(const std::string& pkgId, const std::string& dllPath, bool enableR2R);
 
 /**
  * @brief remove native images (NI file) for Platform DLLs (.NETCore + TizenFX)
@@ -115,13 +106,14 @@ void removeNiUnderDirs(const std::string rootPaths[], int count);
 /**
  * @brief remove native images for specific package.
  * @param[i] pkgId package ID
- * @return 0 on success, otherwise a negative error value
+ * @return ni_error_e
  */
-int removeNiUnderPkgRoot(const std::string& pkgId);
+ni_error_e removeNiUnderPkgRoot(const std::string& pkgId);
 
 /**
  * @brief regenerate native image for all installed application
+ * @return ni_error_e
  */
-int regenerateAppNI(bool enableR2R);
+ni_error_e regenerateAppNI(bool enableR2R = true);
 
 #endif /* __NI_COMMON_H__ */