summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInhwan Lee <ideal.lee@samsung.com>2017-01-17 17:20:10 +0900
committerInhwan Lee <ideal.lee@samsung.com>2017-01-23 17:14:16 +0900
commit7b7f384e1bbab955a1369d2723a95753437fe053 (patch)
treeb1172599717d5cf3434de851906030d79629536b
parent4a3f29faebc1a96ce5197a25934538d79f0b1687 (diff)
downloadlauncher-7b7f384e1bbab955a1369d2723a95753437fe053.tar.gz
launcher-7b7f384e1bbab955a1369d2723a95753437fe053.tar.bz2
launcher-7b7f384e1bbab955a1369d2723a95753437fe053.zip
If application has specific metadata, appfw will call plugin that implemented Only working for AOT with below metadata "http://tizen.org/metadata/prefer_dotnet_aot" Change-Id: I31a13b678ecfff3f430c4fad2656e5f358479cbf
-rwxr-xr-x[-rw-r--r--]NativeLauncher/CMakeLists.txt15
-rwxr-xr-x[-rw-r--r--]NativeLauncher/inc/utils.h1
-rwxr-xr-xNativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc69
-rwxr-xr-x[-rw-r--r--]NativeLauncher/util/utils.cc2
-rwxr-xr-x[-rw-r--r--]packaging/dotnet-launcher.spec4
5 files changed, 88 insertions, 3 deletions
diff --git a/NativeLauncher/CMakeLists.txt b/NativeLauncher/CMakeLists.txt
index 3c35c5f..5398487 100644..100755
--- a/NativeLauncher/CMakeLists.txt
+++ b/NativeLauncher/CMakeLists.txt
@@ -7,7 +7,7 @@ IF(DEFINED NO_TIZEN)
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DNO_TIZEN")
ELSE(DEFINED NO_TIZEN)
INCLUDE(FindPkgConfig)
- PKG_CHECK_MODULES(${PROJECT_NAME} REQUIRED aul pkgmgr-info pkgmgr-installer dlog ecore bundle dlog launchpad elementary)
+ PKG_CHECK_MODULES(${PROJECT_NAME} REQUIRED aul pkgmgr-info pkgmgr-installer dlog ecore bundle dlog launchpad elementary glib-2.0)
ENDIF(DEFINED NO_TIZEN)
FOREACH(flag ${${PROJECT_NAME}_CFLAGS})
@@ -99,10 +99,23 @@ ADD_LIBRARY(${INSTALLER_PLUGIN} SHARED ${${INSTALLER_PLUGIN}_SOURCE_FILES})
SET_TARGET_PROPERTIES(${INSTALLER_PLUGIN} PROPERTIES COMPILE_FLAGS "-fPIC")
TARGET_LINK_LIBRARIES(${INSTALLER_PLUGIN} ${${PROJECT_NAME}_LDFLAGS})
+
+SET(PREFER_DOTNET_AOT_PLUGIN "prefer_dotnet_aot_plugin")
+SET(${PREFER_DOTNET_AOT_PLUGIN}_SOURCE_FILES
+ util/utils.cc
+ installer-plugin/common.cc
+ installer-plugin/prefer_dotnet_aot_plugin.cc
+)
+ADD_LIBRARY(${PREFER_DOTNET_AOT_PLUGIN} SHARED ${${PREFER_DOTNET_AOT_PLUGIN}_SOURCE_FILES})
+SET_TARGET_PROPERTIES(${PREFER_DOTNET_AOT_PLUGIN} PROPERTIES COMPILE_FLAGS "-fPIC")
+TARGET_LINK_LIBRARIES(${PREFER_DOTNET_AOT_PLUGIN} ${${PROJECT_NAME}_LDFLAGS})
+
+
IF(NOT DEFINED NO_TIZEN)
INSTALL(TARGETS ${DOTNET_LAUNCHER} DESTINATION ${BINDIR})
INSTALL(TARGETS ${NITOOL} DESTINATION ${BINDIR})
INSTALL(TARGETS ${INSTALLER_PLUGIN} DESTINATION ${INSTALL_PLUGIN_DIR})
+ INSTALL(TARGETS ${PREFER_DOTNET_AOT_PLUGIN} DESTINATION ${INSTALL_MDPLUGIN_DIR})
INSTALL(FILES dotnet.loader DESTINATION ${LOADERDIR})
INSTALL(FILES dotnet.launcher DESTINATION ${LOADERDIR})
INSTALL(FILES dotnet.debugger DESTINATION ${LOADERDIR})
diff --git a/NativeLauncher/inc/utils.h b/NativeLauncher/inc/utils.h
index 3e56112..b66a708 100644..100755
--- a/NativeLauncher/inc/utils.h
+++ b/NativeLauncher/inc/utils.h
@@ -41,5 +41,4 @@ std::string JoinStrings(const std::vector<std::string>& strings, const char* con
typedef std::function<void (const char*)> FileReader;
void ScanFilesInDir(const char* directory, FileReader reader, unsigned int depth);
-
#endif // __UTILS_H__
diff --git a/NativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc b/NativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc
new file mode 100755
index 0000000..f180739
--- /dev/null
+++ b/NativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common.h"
+#include "log.h"
+#include "utils.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "NETCORE_INSTALLER_PLUGIN"
+
+#include <cstring>
+#include <vector>
+#include <sstream>
+#include <glib.h>
+
+typedef struct Metadata {
+ const char *key;
+ const char *value;
+} Metadata;
+
+const std::string VALUE_TRUE = "true";
+const std::string mdKey = "http://tizen.org/metadata/prefer_dotnet_aot";
+extern "C" int PKGMGR_MDPARSER_PLUGIN_INSTALL (const char *pkgid, const char *appid, GList *list)
+{
+
+ GList *tag = NULL;
+ bool mdValue = false;
+ Metadata *mdInfo = NULL;
+ tag = g_list_first(list);
+ while (tag) {
+ mdInfo = (Metadata*)tag->data;
+ if(mdInfo->key == mdKey && mdInfo->value == VALUE_TRUE) {
+ _DBG("Prefer dotnet application AOT set TRUE");
+ mdValue = true;
+ }
+ tag = g_list_next(tag);
+ }
+
+ if (mdValue) {
+ if (create_ni_under_pkg_root(pkgid) != 0)
+ {
+ _ERR("Failed to get root path from [%s]", pkgid);
+ return -1;
+ } else {
+ _DBG("Complete make application to native image");
+ }
+ }
+ return 0;
+}
+
+extern "C" int PKGMGR_MDPARSER_PLUGIN_UPGRADE (const char *pkgid, const char *appid, GList *list)
+{
+ return PKGMGR_MDPARSER_PLUGIN_INSTALL(pkgid, appid, list);
+}
diff --git a/NativeLauncher/util/utils.cc b/NativeLauncher/util/utils.cc
index 48810d9..212f1d6 100644..100755
--- a/NativeLauncher/util/utils.cc
+++ b/NativeLauncher/util/utils.cc
@@ -349,4 +349,4 @@ void ScanFilesInDir(const char* directory, FileReader reader, unsigned int depth
}
closedir(dir);
-}
+} \ No newline at end of file
diff --git a/packaging/dotnet-launcher.spec b/packaging/dotnet-launcher.spec
index ac73341..7a40c06 100644..100755
--- a/packaging/dotnet-launcher.spec
+++ b/packaging/dotnet-launcher.spec
@@ -16,6 +16,7 @@ BuildRequires: pkgconfig(launchpad)
BuildRequires: pkgconfig(pkgmgr-info)
BuildRequires: pkgconfig(pkgmgr-installer)
BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(glib-2.0)
BuildRequires: aul-devel
BuildRequires: dotnet-build-tools
@@ -33,6 +34,7 @@ Requires(preun): /usr/bin/systemctl
%define _runtime_dir /opt/usr/share/dotnet/shared/Microsoft.NETCore.App/1.0.0
%define _preload_dir /opt/usr/share/dotnet.tizen/preload
%define _install_plugin_dir /usr/etc/package-manager/parserlib
+%define _install_mdplugin_dir /etc/package-manager/parserlib/metadata
ExcludeArch: %{ix86} aarch64
@@ -57,6 +59,7 @@ cmake \
-DCORECLR_LAUNCHER_ASSEMBLY_PATH=%{_bindir}/Tizen.Runtime.Coreclr.dll \
-DMONO_LAUNCHER_ASSEMBLY_PATH=%{_bindir}/Tizen.Runtime.Mono.dll \
-DINSTALL_PLUGIN_DIR=%{_install_plugin_dir} \
+ -DINSTALL_MDPLUGIN_DIR=%{_install_mdplugin_dir} \
-DVERSION=%{version} \
NativeLauncher
@@ -90,5 +93,6 @@ install -p -m 644 Tizen.Runtime/bin/Tizen.Runtime.Mono.dll %{buildroot}%{_bindir
%caps(cap_mac_admin,cap_setgid=ei) %{_bindir}/dotnet-launcher
%caps(cap_mac_admin,cap_setgid=ei) %{_bindir}/nitool
%caps(cap_mac_admin,cap_setgid=ei) %{_install_plugin_dir}/libui-application.so
+%caps(cap_mac_admin,cap_setgid=ei) %{_install_mdplugin_dir}/libprefer_dotnet_aot_plugin.so
%caps(cap_mac_admin,cap_setgid=ei) %{_bindir}/Tizen.Runtime.Coreclr.dll
%caps(cap_mac_admin,cap_setgid=ei) %{_bindir}/Tizen.Runtime.Mono.dll