Support for preload of ElmSharp and preload.list file
authorj-h.choi <j-h.choi@samsung.com>
Wed, 1 Apr 2020 01:12:49 +0000 (10:12 +0900)
committer이형주/Common Platform Lab(SR)/Staff Engineer/삼성전자 <leee.lee@samsung.com>
Mon, 27 Apr 2020 05:45:25 +0000 (14:45 +0900)
Change-Id: I1da11acef01294963950d0f2027791c8b70f6063

14 files changed:
Managed/Managed.sln
Managed/Tizen.Init/Tizen.Init.cs [deleted file]
Managed/Tizen.Runtime/Tizen.Runtime.cs [new file with mode: 0644]
Managed/Tizen.Runtime/Tizen.Runtime.csproj [moved from Managed/Tizen.Init/Tizen.Init.csproj with 100% similarity]
NativeLauncher/CMakeLists.txt
NativeLauncher/Dotnet.Launcher.preload [new file with mode: 0644]
NativeLauncher/inc/ni_common.h
NativeLauncher/inc/path_manager.h
NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc
NativeLauncher/launcher/exec/loader.cc
NativeLauncher/launcher/lib/dotnet_launcher.cc
NativeLauncher/launcher/lib/dotnet_launcher.h
NativeLauncher/util/log_manager.cc
packaging/dotnet-launcher.spec

index ee5743e..150e748 100644 (file)
@@ -1,11 +1,10 @@
-
 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
@@ -17,10 +16,10 @@ Global
                {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
diff --git a/Managed/Tizen.Init/Tizen.Init.cs b/Managed/Tizen.Init/Tizen.Init.cs
deleted file mode 100644 (file)
index 904c48f..0000000
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * 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");
-            }
-        }
-    }
-}
diff --git a/Managed/Tizen.Runtime/Tizen.Runtime.cs b/Managed/Tizen.Runtime/Tizen.Runtime.cs
new file mode 100644 (file)
index 0000000..e88aadb
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * 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();
+        }
+    }
+}
index 37d1e3f..73af492 100644 (file)
@@ -51,6 +51,10 @@ IF(DEFINED DOTNET_DIR)
     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)
@@ -255,3 +259,4 @@ INSTALL(FILES inc/tac_common.h DESTINATION ${INCLUDEDIR})
 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})
diff --git a/NativeLauncher/Dotnet.Launcher.preload b/NativeLauncher/Dotnet.Launcher.preload
new file mode 100644 (file)
index 0000000..a7fe2d2
--- /dev/null
@@ -0,0 +1,38 @@
+###########################################
+## 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
index 31a679a..f33ddcc 100644 (file)
@@ -91,6 +91,7 @@ void createNiUnderTAC(const std::string rootPaths[], int count, DWORD flags);
 /**
  * @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);
@@ -114,6 +115,7 @@ ni_error_e createNiUnderPkgRoot(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
  */
@@ -147,6 +149,7 @@ ni_error_e regenerateAppNI(DWORD flags);
 
 /**
  * @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);
index 72dc042..2d6c1b7 100644 (file)
@@ -27,4 +27,4 @@ std::string getExtraDirs();
 
 std::string getTPA();
 
-#endif /* __DLL_PATH_MANAGER_H__ */
\ No newline at end of file
+#endif /* __DLL_PATH_MANAGER_H__ */
index 0d87f66..8ae9e00 100644 (file)
@@ -294,7 +294,7 @@ extern "C" int PKGMGR_MDPARSER_PLUGIN_INSTALL(const char *pkgId, const char *app
        }
 
        if (tacDB.empty()) {
-               _INFO("Not exist .deps.json file");
+               _INFO("Not exist data for TAC in %s", pkgId);
                return 0;
        }
 
@@ -447,6 +447,8 @@ extern "C" int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char *pkgId, const char *app
                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('/'));
index 27602b8..a42eedc 100644 (file)
@@ -91,7 +91,7 @@ static void __adapter_add_fd(void *user_data, int fd,
        __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);
@@ -125,7 +125,7 @@ static void __loader_create_cb(bundle *extra, int type, void *user_data)
                _ERR("Failed to initialized");
        } else {
                _INFO("Success to initialized");
-       }       
+       }
 }
 
 static int __loader_launch_cb(int argc, char **argv, const char *app_path,
@@ -143,7 +143,7 @@ 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;
@@ -152,7 +152,7 @@ static int __loader_terminate_cb(int argc, char **argv, void *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");
        }
@@ -165,7 +165,7 @@ static int __loader_terminate_cb(int argc, char **argv, void *user_data)
 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
@@ -189,7 +189,7 @@ extern "C" int realMain(int argc, char *argv[], const char* mode)
                .add_fd = __adapter_add_fd,
                .remove_fd = __adapter_remove_fd
        };
-       
+
        int ret = launchpad_loader_main(argc, argv, &callbacks, &adapter, runtime);
        delete runtime;
 
index 7ed7f39..80ce717 100644 (file)
@@ -272,28 +272,28 @@ static void setLang()
        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();
        }
 }
 
@@ -480,7 +480,7 @@ int CoreRuntime::initialize(LaunchMode launchMode)
        __initialized = true;
 
        if (launchMode == LaunchMode::loader) {
-               preloadTypes();         // Preload common managed code
+               preload();              // Preload common managed code
        }
 
        _INFO("CoreRuntime initialize success");
index 53c8bfb..ddaabd6 100644 (file)
@@ -43,7 +43,7 @@ class CoreRuntime
 
        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;
@@ -56,7 +56,6 @@ class CoreRuntime
                int __fd;
                bool __initialized;
                bool __isProfileMode;
-
 };
 
 }  // dotnetcore
index 6caedf0..b1c8dd0 100644 (file)
@@ -111,4 +111,3 @@ int redirectFD()
 
        return 0;
 }
-
index de66b4f..3e08edb 100644 (file)
@@ -56,6 +56,7 @@ Requires(preun): /usr/bin/systemctl
 %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
 
@@ -109,6 +110,7 @@ cmake \
        -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}
@@ -127,7 +129,7 @@ make %{?jobs:-j%jobs} VERBOSE=1
 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}
@@ -137,6 +139,8 @@ ln -sf %{_libdir}/libsqlite3.so.0 %{buildroot}%{_native_lib_dir}/libsqlite3.so
 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
@@ -164,9 +168,10 @@ 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