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;
26 NI_ERROR_INVALID_PARAMETER = -1,
27 NI_ERROR_ALREADY_EXIST = -2,
28 NI_ERROR_NO_SUCH_FILE = -3,
29 NI_ERROR_INVALID_PACKAGE = -4,
30 NI_ERROR_NOT_SUPPORTED = -5,
35 * @brief : structure which contains directory info
37 typedef struct NiCommonOption {
38 std::string runtimeDir; /**< .NETCore Runtime directory */
39 std::string tizenFXDir; /**< TizenFX directory */
40 std::string extraDirs; /**< ":" seperated directories which can be set by plugins */
44 * @brief initialize NICommon
45 * @param[in] options to initialize path
46 * @return ni_error_e 0 on success, otherwise a negative error value
48 ni_error_e initNICommon(NiCommonOption* option);
51 * @brief finalize NICommon
52 * @details Before re-initialize NICommon, you have to finalize current NICommon first.
54 void finalizeNICommon();
57 * @brief create native images (NI file) for Platform DLLs (.NETCore + TizenFX)
59 void createNiPlatform(bool enableR2R);
62 * @brief create native image for specific dll with file path.
63 * @param[i] dllPath file path to generate native image
64 * @param[i] enableR2R enable ready-to-run mode
67 ni_error_e createNiDll(const std::string& dllPath, 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] enableR2R enable ready-to-run mode
75 void createNiUnderDirs(const std::string rootPaths[], int count, bool enableR2R);
78 * @brief create native images for specific package. (All DLLs)
79 * @param[i] pkgId package ID
80 * @param[i] enableR2R enable ready-to-run mode
83 ni_error_e createNiUnderPkgRoot(const std::string& pkgId, bool enableR2R);
86 * @brief create native image for specific dll in the package.
87 * @Details All dlls in the package are added for reference when create native image.
88 * @param[i] pkgId package ID
89 * @param[i] enableR2R enable ready-to-run mode
92 ni_error_e createNiDllUnderPkgRoot(const std::string& pkgId, const std::string& dllPath, bool enableR2R);
95 * @brief remove native images (NI file) for Platform DLLs (.NETCore + TizenFX)
97 void removeNiPlatform();
100 * @brief remove native images under specific directory.
101 * @param[i] rootPaths directories whicn contains native image
102 * @param[i] count number of rootPath
104 void removeNiUnderDirs(const std::string rootPaths[], int count);
107 * @brief remove native images for specific package.
108 * @param[i] pkgId package ID
111 ni_error_e removeNiUnderPkgRoot(const std::string& pkgId);
114 * @brief regenerate native image for all installed application
117 ni_error_e regenerateAppNI(bool enableR2R = true);
119 #endif /* __NI_COMMON_H__ */