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");
67 if (createNIUnderPkgRoot(pkgId, flags) != NI_ERROR_NONE) {
68 _ERR("Failed to generate application to native image [%s]", pkgId);
72 _INFO("Complete make application to native image");
77 extern "C" int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char *pkgId, const char *appId, GList *list)
79 return PKGMGR_MDPARSER_PLUGIN_INSTALL(pkgId, appId, list);
82 extern "C" int PKGMGR_MDPARSER_PLUGIN_UNINSTALL(const char *pkgId, const char *appId, GList *list)
87 extern "C" int PKGMGR_MDPARSER_PLUGIN_REMOVED(const char *pkgId, const char *appId, GList *list)
89 return PKGMGR_MDPARSER_PLUGIN_UPGRADE(pkgId, appId, list);
92 extern "C" int PKGMGR_MDPARSER_PLUGIN_CLEAN(const char *pkgId, const char *appId, GList *list)
94 // Can be multiple apps in one package
95 if (aotPluginFinished) {
96 _INFO("AOT plugin already finished(CLEAN)");
99 aotPluginFinished = true;
105 extern "C" int PKGMGR_MDPARSER_PLUGIN_UNDO(const char *pkgId, const char *appId, GList *list)
107 // Can be multiple apps in one package
108 if (aotPluginFinished) {
109 _INFO("AOT plugin already finished(UNDO)");
112 aotPluginFinished = true;