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 #include "ni_common.h"
25 #include <pkgmgr_installer_info.h>
30 #define LOG_TAG "DOTNET_INSTALLER_PLUGIN"
32 bool aotPluginInstalled = false;
33 bool aotPluginFinished = false;
35 extern "C" int PKGMGR_MDPARSER_PLUGIN_INSTALL(const char *pkgId, const char *appId, GList *list)
37 // Can be multiple apps in one package
38 if (aotPluginInstalled) {
39 _INFO("AOT plugin already installed");
42 aotPluginInstalled = true;
45 if (!pkgmgr_installer_info_get_skip_optimization(&skipOpt)) {
47 _DBG("Skip dotnet AOT");
52 std::string metaValue = getMetadataValue(std::string(pkgId), AOT_METADATA_KEY);
53 if (metaValue.empty()) {
54 _ERR("Failed to get metadata from [%s]", pkgId);
58 if (metaValue == METADATA_VALUE) {
59 _DBG("Prefer dotnet application AOT set TRUE");
61 if (initNICommon() != NI_ERROR_NONE) {
62 _ERR("Fail to initialize NI Common");
66 NIOption* opt = getNIOption();
68 _ERR("Fail to create option structure.");
72 if (createNIUnderPkgRoot(pkgId, opt) != NI_ERROR_NONE) {
73 _ERR("Failed to generate application to native image [%s]", pkgId);
77 _INFO("Complete make application to native image");
82 extern "C" int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char *pkgId, const char *appId, GList *list)
84 return PKGMGR_MDPARSER_PLUGIN_INSTALL(pkgId, appId, list);
87 extern "C" int PKGMGR_MDPARSER_PLUGIN_UNINSTALL(const char *pkgId, const char *appId, GList *list)
92 extern "C" int PKGMGR_MDPARSER_PLUGIN_REMOVED(const char *pkgId, const char *appId, GList *list)
94 return PKGMGR_MDPARSER_PLUGIN_UPGRADE(pkgId, appId, list);
97 extern "C" int PKGMGR_MDPARSER_PLUGIN_CLEAN(const char *pkgId, const char *appId, GList *list)
99 // Can be multiple apps in one package
100 if (aotPluginFinished) {
101 _INFO("AOT plugin already finished(CLEAN)");
104 aotPluginFinished = true;
110 extern "C" int PKGMGR_MDPARSER_PLUGIN_UNDO(const char *pkgId, const char *appId, GList *list)
112 // Can be multiple apps in one package
113 if (aotPluginFinished) {
114 _INFO("AOT plugin already finished(UNDO)");
117 aotPluginFinished = true;