-
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.28307.136
+# Visual Studio 16
+VisualStudioVersion = 16.0.29306.81
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dotnet.Launcher", "Dotnet.Launcher\Dotnet.Launcher.csproj", "{92F481F9-A099-40D7-9DD7-BE1B64C010D1}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Init", "Tizen.Init\Tizen.Init.csproj", "{E43E299B-DA9A-4FE3-87EC-0E4511EA4679}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Runtime", "Tizen.Runtime\Tizen.Runtime.csproj", "{10904A32-26EB-4135-B012-8F123A63E29D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
{92F481F9-A099-40D7-9DD7-BE1B64C010D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{92F481F9-A099-40D7-9DD7-BE1B64C010D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{92F481F9-A099-40D7-9DD7-BE1B64C010D1}.Release|Any CPU.Build.0 = Release|Any CPU
- {E43E299B-DA9A-4FE3-87EC-0E4511EA4679}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {E43E299B-DA9A-4FE3-87EC-0E4511EA4679}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {E43E299B-DA9A-4FE3-87EC-0E4511EA4679}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {E43E299B-DA9A-4FE3-87EC-0E4511EA4679}.Release|Any CPU.Build.0 = Release|Any CPU
+ {10904A32-26EB-4135-B012-8F123A63E29D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {10904A32-26EB-4135-B012-8F123A63E29D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {10904A32-26EB-4135-B012-8F123A63E29D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {10904A32-26EB-4135-B012-8F123A63E29D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+++ /dev/null
-/*
- * Copyright (c) 2019 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.
- */
-using System;
-using System.Reflection;
-using System.Runtime.Loader;
-using System.Collections.Generic;
-
-namespace Tizen.Init {
-
- class TypeLoader
- {
- // key : assembly name, value : list of types
- static IDictionary<string, List<string>> assem_type = new Dictionary<string, List<string>>
- {
- {"ElmSharp", new List<string>(){
- "ElmSharp.Box",
- "ElmSharp.Button",
- "ElmSharp.Check",
- "ElmSharp.Color",
- "ElmSharp.Conformant",
- "ElmSharp.DateTimeSelector",
- "ElmSharp.DisplayRotation",
- "ElmSharp.EdjeObject",
- "ElmSharp.EdjeObject+SignalData",
- "ElmSharp.EdjeTextPartObject",
- "ElmSharp.Elementary",
- "ElmSharp.Entry",
- "ElmSharp.EvasKeyEventArgs",
- "ElmSharp.EvasMap",
- "ElmSharp.EvasObject",
- "ElmSharp.FocusDirection",
- "ElmSharp.GenList",
- "ElmSharp.GestureLayer+GestureType",
- "ElmSharp.IInvalidatable",
- "ElmSharp.Image",
- "ElmSharp.ItemObject+SignalData",
- "ElmSharp.Label",
- "ElmSharp.Layout",
- "ElmSharp.Naviframe",
- "ElmSharp.NaviItem",
- "ElmSharp.Point3D",
- "ElmSharp.ProgressBar",
- "ElmSharp.Radio",
- "ElmSharp.Rect",
- "ElmSharp.Rectangle",
- "ElmSharp.Scroller",
- "ElmSharp.Size",
- "ElmSharp.Slider",
- "ElmSharp.Spinner",
- "ElmSharp.Widget",
- "ElmSharp.Window",
- "ElmSharp.WrapType",
- "Interop"}},
- {"ElmSharp.Wearable", new List<string>(){
- "ElmSharp.Wearable.CircleDateTimeSelector",
- "ElmSharp.Wearable.CircleGenList",
- "ElmSharp.Wearable.CircleScroller",
- "ElmSharp.Wearable.CircleSpinner",
- "ElmSharp.Wearable.ICircleWidget",
- "ElmSharp.Wearable.IRotaryActionWidget",
- "Interop"}},
- {"System.IO.FileSystem", new List<string>(){
- "Interop",
- "<PrivateImplementationDetails>",
- "System.IO.File"}},
- {"System.Security.Cryptography.Algorithms", new List<string>(){
- "Interop",
- "System.Security.Cryptography.MD5"}},
- {"System.Collections", new List<string>(){
- "<PrivateImplementationDetails>",
- "System.Collections.Generic.HashSet`1",
- "System.Collections.Generic.Queue`1"}},
- {"System.Private.Uri", new List<string>(){
- "<PrivateImplementationDetails>",
- "System.Uri"}},
- {"System.Private.Xml", new List<string>(){
- "<PrivateImplementationDetails>",
- "System.Xml.IXmlLineInfo",
- "System.Xml.IXmlNamespaceResolver"}},
- {"System.Runtime", new List<string>(){
- "System.Collections.Generic.ISet`1",
- "System.Reflection.RuntimeReflectionExtensions"}},
- {"System.ObjectModel", new List<string>(){
- "System.Collections.ObjectModel.ObservableCollection`1",
- "System.Collections.Specialized.INotifyCollectionChanged",
- "System.Collections.Specialized.NotifyCollectionChangedAction",
- "System.Collections.Specialized.NotifyCollectionChangedEventArgs",
- "System.Collections.Specialized.NotifyCollectionChangedEventHandler",
- "System.ComponentModel.INotifyPropertyChanged",
- "System.ComponentModel.PropertyChangedEventArgs",
- "System.ComponentModel.PropertyChangedEventHandler",
- "System.Windows.Input.ICommand"}},
- {"System.ComponentModel", new List<string>(){
- "System.IServiceProvider"}},
- {"System.Linq", new List<string>(){
- "System.Linq.Enumerable",
- "System.Linq.EnumerableSorter`1",
- "System.Linq.IIListProvider`1",
- "System.Linq.IOrderedEnumerable`1",
- "System.Linq.IPartition`1",
- "System.Linq.OrderedEnumerable`1"}},
- {"System.Linq.Expressions", new List<string>(){
- "System.Linq.Expressions.ExpressionVisitor"}},
- {"System.Security.Cryptography.Primitives", new List<string>(){
- "System.Security.Cryptography.HashAlgorithm"}},
- {"Tizen.Applications.Common", new List<string>(){
- "Interop",
- "Tizen.Applications.Application",
- "Tizen.Applications.CoreApplication",
- "Tizen.Applications.CoreBackend.EventType",
- "Tizen.Applications.TizenSynchronizationContext"}},
- {"Tizen.Applications.UI", new List<string>(){
- "Tizen.Applications.CoreUIApplication",
- "Interop"}},
- {"Tizen", new List<string>(){
- "Interop"}},
- {"Tizen.Log", new List<string>(){
- "Interop",
- "Tizen.Log"}},
- {"Tizen.System.Information", new List<string>(){
- "Tizen.System.Information"}}
- };
-
- static void PreloadEnd()
- {
- assem_type = null;
- GC.Collect();
- GC.WaitForPendingFinalizers();
- }
-
- static void PreloadTypes()
- {
- foreach (KeyValuePair<string, List<string>> item in assem_type)
- {
- Assembly asm = LoadAssembly(item.Key);
- if (asm != null) {
- foreach (string t in item.Value)
- {
- LoadType(asm, t);
- }
- }
- }
-
- PreloadLibICU();
- PreloadTizenFX();
-
- PreloadEnd();
- }
-
- static Assembly LoadAssembly(string name)
- {
- var context = AssemblyLoadContext.Default;
- Assembly ret = null;
-
- try
- {
- ret = context.LoadFromAssemblyName(new AssemblyName(name));
- }
- catch (Exception e)
- {
- Console.WriteLine(e.ToString());
- return null;
- }
-
- return ret;
- }
-
- static void LoadType(Assembly assem, string typeName)
- {
- try
- {
- var tp = assem.GetType(typeName);
- }
- catch
- {
- Console.WriteLine("Tizen.Init.TypeLoader.PreloadTypes can't load type " + typeName + " from assembly " + assem.ToString());
- }
- }
-
- static void PreloadLibICU()
- {
- // Simple workaround for preloading libICU.
- if ("A".ToLower() != "a")
- {
- Console.WriteLine("Unreachable.");
- }
- }
-
- static void PreloadTizenFX()
- {
- try
- {
- Assembly assem = LoadAssembly("ElmSharp");
- var type = assem.GetType("ElmSharp.Window");
- type.GetMethod("Preload", BindingFlags.NonPublic | BindingFlags.Static).Invoke(null, null);
-
- assem = LoadAssembly("Tizen.System.Information");
- type = assem.GetType("Tizen.System.Information");
- type.GetMethod("TryGetValue", BindingFlags.Public | BindingFlags.Static).MakeGenericMethod(typeof(int)).Invoke(null, new object[] { "http://tizen.org/feature/screen.width", null });
- }
- catch (Exception e)
- {
- Console.WriteLine(e.ToString());
- Console.WriteLine("Fail to preload TizenFX");
- }
- }
- }
-}
--- /dev/null
+/*
+ * Copyright (c) 2019 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.
+ */
+using System;
+using System.IO;
+using System.Reflection;
+using System.Runtime.Loader;
+
+namespace Tizen.Runtime
+{
+ class Preloader
+ {
+ const string preloadPath = "/usr/share/dotnet.tizen/preload/";
+ public static void Preload()
+ {
+ DirectoryInfo directory = new DirectoryInfo(preloadPath);
+ foreach (FileInfo file in directory.GetFiles())
+ {
+ if (file.Extension.CompareTo(".preload") != 0)
+ continue;
+
+ try
+ {
+ BindingFlags bindingFlag = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
+ foreach (string line in File.ReadLines(file.FullName))
+ {
+ if (line.StartsWith('#') || !line.Contains(".dll") || !line.Contains(' '))
+ continue;
+
+ string[] getWord = line.Split(' ');
+ if (getWord.Length != 2)
+ continue;
+
+ string assemblyStr = getWord[0].Replace(".dll", "");
+ string typenameStr = getWord[1];
+ string methodStr = "";
+ string parenthesis = "()";
+
+ if (line.Contains(parenthesis))
+ {
+ string [] getMethod = typenameStr.Split('.');
+ methodStr = getMethod[getMethod.Length - 1].Replace(parenthesis, "");
+ typenameStr = typenameStr.Replace("." + methodStr + parenthesis, "");
+ }
+
+ try
+ {
+ if (assemblyStr == "")
+ continue;
+
+ Assembly asm = AssemblyLoadContext.Default.LoadFromAssemblyName(new AssemblyName(assemblyStr));
+ if (asm == null || typenameStr == "")
+ continue;
+
+ Type type = asm.GetType(typenameStr);
+ if (type == null || methodStr == "")
+ continue;
+
+ MethodInfo method = type.GetMethod(methodStr, bindingFlag);
+ if (method == null)
+ continue;
+
+ method.Invoke(null, null);
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e.ToString());
+ Console.WriteLine("[ERROR] Failed to '" + line + "' preload");
+ }
+ }
+ }
+ catch (IOException e)
+ {
+ Console.WriteLine(e.ToString());
+ Console.WriteLine("[ERROR] Failed to " + file.FullName + " file open");
+ }
+ finally
+ {
+ Console.WriteLine("Success to preload : " + file.Name);
+ }
+ }
+
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ }
+ }
+}
SET(EXTRA_CFLAGS_COMMON "${EXTRA_CFLAGS_COMMON} -DDOTNET_DIR=${DOTNET_DIR}")
ENDIF(DEFINED DOTNET_DIR)
+IF(DEFINED TIZEN_PRELOAD_DIR)
+ SET(EXTRA_CFLAGS_COMMON "${EXTRA_CFLAGS_COMMON} -DTIZEN_PRELOAD_DIR=${TIZEN_PRELOAD_DIR}")
+ENDIF(DEFINED TIZEN_PRELOAD_DIR)
+
IF(DEFINED USE_DEFAULT_BASE_ADDR)
SET(EXTRA_CFLAGS_COMMON "${EXTRA_CFLAGS_COMMON} -DUSE_DEFAULT_BASE_ADDR")
ENDIF(DEFINED USE_DEFAULT_BASE_ADDR)
INSTALL(FILES ../dotnet-launcher.pc DESTINATION ${LIBDIR}/pkgconfig)
INSTALL(FILES dotnet-launcher.info DESTINATION /usr/share/parser-plugins)
INSTALL(FILES dotnet.preload.list DESTINATION ${LOADERDIR})
+INSTALL(FILES Dotnet.Launcher.preload DESTINATION ${TIZEN_PRELOAD_DIR})
--- /dev/null
+###########################################
+## AssemblyName.dll TypeName ##
+## AssemblyName.dll TypeName.Preload() ##
+## The methods must not have parameters. ##
+###########################################
+System.IO.FileSystem.dll Interop
+System.IO.FileSystem.dll <PrivateImplementationDetails>
+System.IO.FileSystem.dll System.IO.File
+System.Security.Cryptography.Algorithms.dll Interop
+System.Security.Cryptography.Algorithms.dll System.Security.Cryptography.MD5
+System.Collections.dll <PrivateImplementationDetails>
+System.Collections.dll System.Collections.Generic.HashSet`1
+System.Collections.dll System.Collections.Generic.Queue`1
+System.Private.Uri.dll <PrivateImplementationDetails>
+System.Private.Uri.dll System.Uri
+System.Private.Xml.dll <PrivateImplementationDetails>
+System.Private.Xml.dll System.Xml.IXmlLineInfo
+System.Private.Xml.dll System.Xml.IXmlNamespaceResolver
+System.Runtime.dll System.Collections.Generic.ISet`1
+System.Runtime.dll System.Reflection.RuntimeReflectionExtensions
+System.ObjectModel.dll System.Collections.ObjectModel.ObservableCollection`1
+System.ObjectModel.dll System.Collections.Specialized.INotifyCollectionChanged
+System.ObjectModel.dll System.Collections.Specialized.NotifyCollectionChangedAction
+System.ObjectModel.dll System.Collections.Specialized.NotifyCollectionChangedEventArgs
+System.ObjectModel.dll System.Collections.Specialized.NotifyCollectionChangedEventHandler
+System.ObjectModel.dll System.ComponentModel.INotifyPropertyChanged
+System.ObjectModel.dll System.ComponentModel.PropertyChangedEventArgs
+System.ObjectModel.dll System.ComponentModel.PropertyChangedEventHandler
+System.ObjectModel.dll System.Windows.Input.ICommand
+System.ComponentModel.dll System.IServiceProvider
+System.Linq.dll System.Linq.Enumerable
+System.Linq.dll System.Linq.EnumerableSorter`1
+System.Linq.dll System.Linq.IIListProvider`1
+System.Linq.dll System.Linq.IOrderedEnumerable`1
+System.Linq.dll System.Linq.IPartition`1
+System.Linq.dll System.Linq.OrderedEnumerable`1
+System.Linq.Expressions.dll System.Linq.Expressions.ExpressionVisitor
+System.Security.Cryptography.Primitives.dll System.Security.Cryptography.HashAlgorithm
/**
* @brief creates a symbolic link file, the native image of TAC for specific package.
* @param[i] pkgId package ID
+ * @param[i] flags additional flags for the image generator
* @return ni_error_e
*/
ni_error_e createTACPkgRoot(const std::string& pkgId, DWORD flags);
/**
* @brief create a native image for a single dll in a package
* @param[i] pkgId package ID
+ * @param[i] dllPath path to input DLL
* @param[i] flags additional flags for the image generator
* @return ni_error_e
*/
/**
* @brief regenerate native image of TAC for all shared assembly.
+ * @param[i] flags additional flags for the image generator
* @return ni_error_e
*/
ni_error_e regenerateTACNI(DWORD flags);
std::string getTPA();
-#endif /* __DLL_PATH_MANAGER_H__ */
\ No newline at end of file
+#endif /* __DLL_PATH_MANAGER_H__ */
}
if (tacDB.empty()) {
- _INFO("Not exist .deps.json file");
+ _INFO("Not exist data for TAC in %s", pkgId);
return 0;
}
if (updateTacDB(tac_db) < 0) {
return -1;
}
+ _INFO("Not exist data for TAC in %s", pkgId);
+ return 0;
} else {
for (auto& np : tacDB) {
std::string tac_name = np.substr(0, np.find('/'));
__fd_handler = ecore_main_fd_handler_add(fd,
static_cast<Ecore_Fd_Handler_Flags>(ECORE_FD_READ | ECORE_FD_ERROR),
__process_fd_handler, NULL, NULL, NULL);
-
+
if (__fd_handler == NULL) {
_ERR("fd_handler is NULL");
close(fd);
_ERR("Failed to initialized");
} else {
_INFO("Success to initialized");
- }
+ }
}
static int __loader_launch_cb(int argc, char **argv, const char *app_path,
return 0;
}
-
+
static int __loader_terminate_cb(int argc, char **argv, void *user_data)
{
CoreRuntime* runtime = (CoreRuntime*)user_data;
// The launchpad pass the name of exe file to the first argument.
// For the C# spec, we have to skip this first argument.
- if (runtime->launch(__appInfo.appid.c_str(), __appInfo.root.c_str(),
+ if (runtime->launch(__appInfo.appid.c_str(), __appInfo.root.c_str(),
__appInfo.app_path.c_str(), argc - 1, argv + 1)) {
_ERR("Failed to launch");
}
extern "C" int realMain(int argc, char *argv[], const char* mode)
{
_INFO("##### Run in candidate mode #####");
-
+
CoreRuntime* runtime = new CoreRuntime(mode);
// change cmdline from dotnet-hydra-loader to dotnet-loader
.add_fd = __adapter_add_fd,
.remove_fd = __adapter_remove_fd
};
-
+
int ret = launchpad_loader_main(argc, argv, &callbacks, &adapter, runtime);
delete runtime;
free(lang);
}
-void CoreRuntime::preloadTypes()
+void CoreRuntime::preload()
{
- const static std::string initDllPath = concatPath(__FRAMEWORK_DIR, "Tizen.Init.dll");
- if (!isFileExist(initDllPath)) {
- _ERR("Failed to locate Tizen.Init.dll");
+ const static std::string dllPath = concatPath(__FRAMEWORK_DIR, "Tizen.Runtime.dll");
+ if (!isFileExist(dllPath)) {
+ _ERR("Failed to locate Tizen.Runtime.dll");
return;
}
- typedef void (*InitDelegate)();
- InitDelegate initDelegate;
+ typedef void (*PreloadDelegate)();
+ PreloadDelegate preloadDelegate;
int ret = createDelegate(__hostHandle,
__domainId,
- "Tizen.Init",
- "Tizen.Init.TypeLoader",
- "PreloadTypes",
- (void**)&initDelegate);
+ "Tizen.Runtime",
+ "Tizen.Runtime.Preloader",
+ "Preload",
+ (void**)&preloadDelegate);
if (ret < 0) {
- _ERR("Failed to create delegate for PreloadTypes (0x%08x)", ret);
+ _ERR("Failed to create delegate for Tizen.Runtime Preload (0x%08x)", ret);
} else {
- initDelegate();
+ preloadDelegate();
}
}
__initialized = true;
if (launchMode == LaunchMode::loader) {
- preloadTypes(); // Preload common managed code
+ preload(); // Preload common managed code
}
_INFO("CoreRuntime initialize success");
private:
bool initializeCoreClr(const char* appId, const char* assemblyProbePaths, const char* NIProbePaths, const char* pinvokeProbePaths, const char* tpaList);
- void preloadTypes();
+ void preload();
coreclr_initialize_ptr initializeClr;
coreclr_execute_assembly_ptr executeAssembly;
coreclr_shutdown_ptr shutdown;
int __fd;
bool __initialized;
bool __isProfileMode;
-
};
} // dotnetcore
%define _native_lib_dir /usr/share/dotnet.tizen/lib
%define _dotnet_dir /opt/usr/dotnet
%define _system_base_addr_file /opt/usr/dotnet.system.base.addr
+%define _tizen_preload_dir /usr/share/dotnet.tizen/preload
%define _default_base_addr_start 0x3000000
-DCROSSGEN_PATH=%{_runtime_dir}/crossgen \
-DINSTALL_MDPLUGIN_DIR=%{_install_mdplugin_dir} \
-DDOTNET_DIR=%{_dotnet_dir} \
+ -DTIZEN_PRELOAD_DIR=%{_tizen_preload_dir} \
-DVERSION=%{version} \
-DNATIVE_LIB_DIR=%{_native_lib_dir} \
%ifarch %{arm}
rm -rf %{buildroot}
%make_install
mkdir -p %{buildroot}%{_framework_dir}
-mv Managed/Tizen.Init/bin/Release/Tizen.Init.dll %{buildroot}%{_framework_dir}
+mv Managed/Tizen.Runtime/bin/Release/Tizen.Runtime.dll %{buildroot}%{_framework_dir}
mv Managed/Dotnet.Launcher/bin/Release/Dotnet.Launcher.dll %{buildroot}%{_framework_dir}
mkdir -p %{buildroot}%{_dotnet_dir}
mkdir -p %{buildroot}/etc/tmpfiles.d
install -m 0644 %{name}.conf %{buildroot}/etc/tmpfiles.d/%{name}.conf
+mkdir -p %{buildroot}%{_tizen_preload_dir}
+
%post
mkdir -p /opt/etc/skel/.dotnet
chsmack -t -a User::App::Shared /opt/etc/skel/.dotnet
%{_libdir}/libtac_common.so
/etc/tmpfiles.d/%{name}.conf
/usr/share/parser-plugins/dotnet-launcher.info
-%{_framework_dir}/Tizen.Init.dll
%{_framework_dir}/Dotnet.Launcher.dll
+%{_framework_dir}/Tizen.Runtime.dll
%{_dotnet_dir}
+%{_tizen_preload_dir}
%files devel
%manifest dotnet-launcher.manifest