SET_TARGET_PROPERTIES(${NITOOL} PROPERTIES COMPILE_FLAGS "-fPIE")
TARGET_LINK_LIBRARIES(${NITOOL} ${${PROJECT_NAME}_LDFLAGS} "-pie" ${DOTNET_LAUNCHER_UTIL} ${NI_COMMON})
+SET(TPATOOL "tpatool")
+SET(${TPATOOL}_SOURCE_FILES
+ installer-plugin/tpatool.cc
+)
+ADD_EXECUTABLE(${TPATOOL} ${${TPATOOL}_SOURCE_FILES})
+SET_TARGET_PROPERTIES(${TPATOOL} PROPERTIES COMPILE_FLAGS "-fPIE")
+TARGET_LINK_LIBRARIES(${TPATOOL} ${${PROJECT_NAME}_LDFLAGS} "-pie" ${DOTNET_LAUNCHER_UTIL})
+
#SET(INSTALLER_PLUGIN "ui-application")
#SET(${INSTALLER_PLUGIN}_SOURCE_FILES
# util/utils.cc
INSTALL(TARGETS ${DOTNET_LAUNCHER} DESTINATION ${BINDIR})
INSTALL(TARGETS ${NI_COMMON} DESTINATION ${LIBDIR})
INSTALL(TARGETS ${NITOOL} DESTINATION ${BINDIR})
+INSTALL(TARGETS ${TPATOOL} 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})
unsigned int domainId,
coreclr_create_delegate_ptr delegateFunc);
typedef char* (*plugin_get_dll_path_ptr)();
+typedef char* (*plugin_get_tpa_ptr)();
typedef void (*plugin_before_execute_ptr)();
typedef void (*plugin_finalize_ptr)();
plugin_set_app_info_ptr set_app_info;
plugin_set_coreclr_info_ptr set_coreclr_info;
plugin_get_dll_path_ptr get_dll_path;
+ plugin_get_tpa_ptr get_tpa;
plugin_before_execute_ptr before_execute;
plugin_finalize_ptr finalize;
} PluginFunc;
void pluginSetAppInfo(const char* appId, const char* managedAssemblyPath);
void pluginSetCoreclrInfo(void* hostHandle, unsigned int domainId, coreclr_create_delegate_ptr delegateFunc);
char* pluginGetDllPath();
+char* pluginGetTPA();
void pluginBeforeExecute();
void pluginFinalize();
--- /dev/null
+/*
+ * 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 <fstream>
+#include <string>
+#include <iostream>
+
+#include "utils.h"
+
+const char* __RUNTIME_DIR = "/usr/share/dotnet.tizen/netcoreapp";
+const char* __TIZENFX_DIR = "/usr/share/dotnet.tizen/framework";
+const char* __TIZENFX_REF_DIR = "/usr/share/dotnet.tizen/framework/ref";
+const char* __PLATFORM_TPA_CACHE = "/usr/share/dotnet.tizen/lib/platform_tpa_cache";
+
+int main(int argc, char* argv[])
+{
+ std::string tpaList;
+ std::vector<std::string> tpaDir;
+
+ tpaDir.push_back(__RUNTIME_DIR);
+ tpaDir.push_back(__TIZENFX_DIR);
+ tpaDir.push_back(__TIZENFX_REF_DIR);
+
+ assembliesInDirectory(tpaDir, tpaList);
+
+ std::ofstream out(__PLATFORM_TPA_CACHE);
+ out << tpaList;
+ out.close();
+
+ return 0;
+}
+
#include <iterator>
#include <sstream>
#include <vconf.h>
+#include <fstream>
#include "utils.h"
#include "plugin_manager.h"
#include "log.h"
static const char* __TIZEN_API_PATH_KEY = "db/dotnet/tizen_api_path";
+static const char* PLATFORM_TPA_CACHE = "/usr/share/dotnet.tizen/lib/platform_tpa_cache";
#define __XSTR(x) #x
#define __STR(x) __XSTR(x)
return __dllPath->extra_dirs;
}
+static std::string getPlatformTPA()
+{
+ std::string platform_tpa;
+
+ if (isFileExist(PLATFORM_TPA_CACHE)) {
+ _INFO("platform tpa cache found.\n");
+ std::ifstream cacheFile;
+ cacheFile.open(PLATFORM_TPA_CACHE);
+ std::getline(cacheFile, platform_tpa);
+ cacheFile.close();
+ } else {
+ std::vector<std::string> tpaDir;
+ tpaDir.push_back(getRuntimeDir());
+ tpaDir.push_back(getTizenFXDir());
+ tpaDir.push_back(getTizenFXRefDir());
+ assembliesInDirectory(tpaDir, platform_tpa);
+ }
+
+ return platform_tpa;
+}
+
std::string getTPA()
{
if (!__tpa.empty()) {
return __tpa;
}
- std::vector<std::string> tpaDir;
-
if (__dllPath == NULL) {
return std::string("");
}
- tpaDir.push_back(getRuntimeDir());
- tpaDir.push_back(getTizenFXDir());
- tpaDir.push_back(getTizenFXRefDir());
- tpaDir.insert(tpaDir.end(), __dllPath->extra_dirs.begin(), __dllPath->extra_dirs.end());
- assembliesInDirectory(tpaDir, __tpa);
+ __tpa = getPlatformTPA();
+
+ char* pluginTPA = pluginGetTPA();
+ if (pluginTPA) {
+ _INFO("plugin tpa found.\n");
+ __tpa = __tpa + ":" + pluginTPA;
+ }
return __tpa;
}
__pluginFunc->set_app_info = (plugin_set_app_info_ptr)dlsym(__pluginLib, "plugin_set_app_info");
__pluginFunc->set_coreclr_info = (plugin_set_coreclr_info_ptr)dlsym(__pluginLib, "plugin_set_coreclr_info");
__pluginFunc->get_dll_path = (plugin_get_dll_path_ptr)dlsym(__pluginLib, "plugin_get_dll_path");
+ __pluginFunc->get_tpa = (plugin_get_tpa_ptr)dlsym(__pluginLib, "plugin_get_tpa");
__pluginFunc->before_execute = (plugin_before_execute_ptr)dlsym(__pluginLib, "plugin_before_execute");
__pluginFunc->finalize = (plugin_finalize_ptr)dlsym(__pluginLib, "plugin_finalize");
}
}
}
+char* pluginGetTPA()
+{
+ if (__pluginFunc && __pluginFunc->get_tpa) {
+ return __pluginFunc->get_tpa();
+ } else {
+ return NULL;
+ }
+}
+
void pluginBeforeExecute()
{
if (__pluginFunc && __pluginFunc->before_execute) {
%{_loaderdir}/dotnet.debugger
%{_native_lib_dir}/libsqlite3.so
%{_bindir}/nitool
+%{_bindir}/tpatool
%{_install_mdplugin_dir}/libprefer_dotnet_aot_plugin.so
%{_bindir}/dotnet-launcher
%{_libdir}/libdotnet_launcher_util.so