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, bool doGenUniqueBaseSystem);
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
65 * @param[i] doGenUniqueBaseSystem flag whether to generate unique default base address
68 ni_error_e createNiDll(const std::string& dllPath, bool enableR2R, bool doGenUniqueBaseSystem);
71 * @brief create native images with files under specific directory.
72 * @param[i] rootPaths directories whicn contains DLLs
73 * @param[i] count number of rootPath
74 * @param[i] enableR2R enable ready-to-run mode
75 * @param[i] doGenUniqueBaseSystem flag whether to generate unique default base address
76 * @param[i] isAppNI if you want to create ni files under nativeImage directory, set it true
78 void createNiUnderDirs(const std::string rootPaths[], int count, bool enableR2R, bool doGenUniqueBaseSystem, bool isAppNI = false);
81 * @brief create native images for specific package. (All DLLs)
82 * @param[i] pkgId package ID
83 * @param[i] enableR2R enable ready-to-run mode
86 ni_error_e createNiUnderPkgRoot(const std::string& pkgId, bool enableR2R);
89 * @brief create native image for specific dll in the package.
90 * @Details All dlls in the package are added for reference when create native image.
91 * @param[i] pkgId package ID
92 * @param[i] enableR2R enable ready-to-run mode
95 ni_error_e createNiDllUnderPkgRoot(const std::string& pkgId, const std::string& dllPath, bool enableR2R);
98 * @brief remove native images (NI file) for Platform DLLs (.NETCore + TizenFX)
100 void removeNiPlatform();
103 * @brief remove native images under specific directory.
104 * @param[i] rootPaths directories whicn contains native image
105 * @param[i] count number of rootPath
107 void removeNiUnderDirs(const std::string rootPaths[], int count);
110 * @brief remove native images for specific package.
111 * @param[i] pkgId package ID
114 ni_error_e removeNiUnderPkgRoot(const std::string& pkgId);
117 * @brief regenerate native image for all installed application
120 ni_error_e regenerateAppNI(bool enableR2R = true);
122 #endif /* __NI_COMMON_H__ */