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
65 void createNiUnderDirs(const std::string rootPaths[], int count, bool enableR2R);
68 * @brief create native images for specific package. (All DLLs)
69 * @param[i] pkgId package ID
70 * @param[i] enableR2R enable ready-to-run mode
71 * @return 0 on success, otherwise a negative error value
73 int createNiUnderPkgRoot(const std::string& pkgId, bool enableR2R);
76 * @brief create native image for specific dll in the package.
77 * @Details All dlls in the package are added for reference when create native image.
78 * @param[i] pkgId package ID
79 * @param[i] enableR2R enable ready-to-run mode
80 * @return 0 on success, otherwise a negative error value
82 int createNiDllUnderPkgRoot(const std::string& pkgId, const std::string& dllPath, bool enableR2R);
85 * @brief remove native images (NI file) for Platform DLLs (.NETCore + TizenFX)
87 void removeNiPlatform();
90 * @brief remove native images under specific directory.
91 * @param[i] rootPaths directories whicn contains native image
92 * @param[i] count number of rootPath
94 void removeNiUnderDirs(const std::string rootPaths[], int count);
97 * @brief remove native images for specific package.
98 * @param[i] pkgId package ID
99 * @return 0 on success, otherwise a negative error value
101 int removeNiUnderPkgRoot(const std::string& pkgId);
104 * @brief regenerate native image for all installed application
106 int regenerateAppNI(bool enableR2R = true);
108 #endif /* __NI_COMMON_H__ */