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
55 * @return 0 on success, otherwise a negative error value
57 int createNiDll(const std::string& dllPath, bool enableR2R);
60 * @brief create native images with files under specific directory.
61 * @param[i] rootPaths directories whicn contains DLLs
62 * @param[i] count number of rootPath
63 * @param[i] enableR2R enable ready-to-run mode
64 * @param[i] isAppNI if you want to create ni files under nativeImage directory, set it true
66 void createNiUnderDirs(const std::string rootPaths[], int count, bool enableR2R, bool isAppNI = false);
69 * @brief create native images for specific package. (All DLLs)
70 * @param[i] pkgId package ID
71 * @param[i] enableR2R enable ready-to-run mode
72 * @return 0 on success, otherwise a negative error value
74 int createNiUnderPkgRoot(const std::string& pkgId, bool enableR2R);
77 * @brief create native image for specific dll in the package.
78 * @Details All dlls in the package are added for reference when create native image.
79 * @param[i] pkgId package ID
80 * @param[i] enableR2R enable ready-to-run mode
81 * @return 0 on success, otherwise a negative error value
83 int createNiDllUnderPkgRoot(const std::string& pkgId, const std::string& dllPath, bool enableR2R);
86 * @brief remove native images (NI file) for Platform DLLs (.NETCore + TizenFX)
88 void removeNiPlatform();
91 * @brief remove native images under specific directory.
92 * @param[i] rootPaths directories whicn contains native image
93 * @param[i] count number of rootPath
95 void removeNiUnderDirs(const std::string rootPaths[], int count);
98 * @brief remove native images for specific package.
99 * @param[i] pkgId package ID
100 * @return 0 on success, otherwise a negative error value
102 int removeNiUnderPkgRoot(const std::string& pkgId);
105 * @brief regenerate native image for all installed application
107 int regenerateAppNI(bool enableR2R = true);
109 #endif /* __NI_COMMON_H__ */