2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __NI_COMMON_H__
18 #define __NI_COMMON_H__
22 typedef std::function<void (std::string)> afterCreate;
25 * @brief : structure which contains directory info
27 typedef struct NiCommonOption {
28 std::string runtimeDir; /**< .NETCore Runtime directory */
29 std::string tizenFXDir; /**< TizenFX directory */
30 std::string extraDirs; /**< ":" seperated directories which can be set by plugins */
34 * @brief initialize NICommon
35 * @param[in] options to initialize path
36 * @return 0 on success, otherwise a negative error value
38 int initNICommon(NiCommonOption* option);
41 * @brief finalize NICommon
42 * @details Before re-initialize NICommon, you have to finalize current NICommon first.
44 void finalizeNICommon();
47 * @brief create native images (NI file) for Platform DLLs (.NETCore + TizenFX)
49 void createNiPlatform(bool enableR2R);
52 * @brief create native image for specific dll with file path.
53 * @param[i] dllPath file path to generate native image
54 * @param[i] enableR2R enable ready-to-run mode
56 void createNiDll(const std::string& dllPath, bool enableR2R);
59 * @brief create native images with files under specific directory.
60 * @param[i] rootPaths directories whicn contains DLLs
61 * @param[i] count number of rootPath
62 * @param[i] ignores DLL list which should be ignored
63 * @param[i] igcount number of ignores
64 * @param[i] cb callback function whicn will be called after generating native image
65 * @param[i] enableR2R enable ready-to-run mode
67 void createNiUnderDirs(const std::string rootPaths[], int count, const std::string ignores[], int igcount, afterCreate cb, bool enableR2R);
70 * @brief create native images with files under specific directory.
71 * @param[i] rootPaths directories whicn contains DLLs
72 * @param[i] count number of rootPath
73 * @param[i] cb callback function whicn will be called after generating native image
74 * @param[i] enableR2R enable ready-to-run mode
76 void createNiUnderDirs(const std::string rootPaths[], int count, afterCreate cb, bool enableR2R);
79 * @brief create native images with files under specific directory.
80 * @param[i] rootPaths directories whicn contains DLLs
81 * @param[i] count number of rootPath
82 * @param[i] enableR2R enable ready-to-run mode
84 void createNiUnderDirs(const std::string rootPaths[], int count, bool enableR2R);
87 * @brief create native images for specific package. (All DLLs)
88 * @param[i] pkgId package ID
89 * @param[i] enableR2R enable ready-to-run mode
90 * @return 0 on success, otherwise a negative error value
92 int createNiUnderPkgRoot(const std::string& pkgId, bool enableR2R);
95 * @brief create native image for specific dll in the package.
96 * @Details All dlls in the package are added for reference when create native image.
97 * @param[i] pkgId package ID
98 * @param[i] enableR2R enable ready-to-run mode
99 * @return 0 on success, otherwise a negative error value
101 int createNiDllUnderPkgRoot(const std::string& pkgId, const std::string& dllPath, bool enableR2R);
104 * @brief remove native images (NI file) for Platform DLLs (.NETCore + TizenFX)
106 void removeNiPlatform();
109 * @brief remove native images under specific directory.
110 * @param[i] rootPaths directories whicn contains native image
111 * @param[i] count number of rootPath
113 void removeNiUnderDirs(const std::string rootPaths[], int count);
116 * @brief remove native images for specific package.
117 * @param[i] pkgId package ID
118 * @return 0 on success, otherwise a negative error value
120 int removeNiUnderPkgRoot(const std::string& pkgId);
123 * @brief regenerate native image for all installed application
125 int regenerateAppNI();
127 #endif /* __NI_COMMON_H__ */