From 3154416e535ab96c0d52bf12e3e472985a1532f4 Mon Sep 17 00:00:00 2001 From: Xanathar Date: Fri, 14 Oct 2016 19:13:28 +0200 Subject: [PATCH] RC for 2.0.0.0 --- .../EndToEnd/UserDataOverloadsTests.cs | 5 +- src/MoonSharp.Interpreter.Tests/TestRunner.cs | 4 +- .../Frameworks/Base/FrameworkClrBase.cs | 39 +++-- .../Base/FrameworkReflectionBase.cs | 4 +- .../Compatibility/Frameworks/FrameworkCLR.cs | 5 + .../Compatibility/Frameworks/FrameworkCore.cs | 106 +------------- .../Compatibility/Frameworks/FrameworkPCL.cs | 5 + .../Compatibility/Frameworks/FrameworkWin8.cs | 44 ++---- .../Modules/ModuleRegister.cs | 1 + .../MoonSharp.Interpreter.net35-client.csproj | 1 + .../Platforms/PlatformAccessorBase.cs | 79 ++++++++++- src/MoonSharp.Interpreter/Script.cs | 14 ++ .../MoonSharp.Interpreter.net40-client.csproj | 6 + .../Frameworks/Base/FrameworkClrBase.cs | 39 +++-- .../Base/FrameworkReflectionBase.cs | 4 +- .../Compatibility/Frameworks/FrameworkCLR.cs | 5 + .../Compatibility/Frameworks/FrameworkCore.cs | 108 +------------- .../Compatibility/Frameworks/FrameworkPCL.cs | 5 + .../Compatibility/Frameworks/FrameworkWin8.cs | 134 ++++++++++++++++++ .../src/Interop/DescriptorHelpers.cs | 14 +- .../src/Interop/PropertyTableAssigner.cs | 2 +- .../EventMemberDescriptor.cs | 10 +- .../PropertyMemberDescriptor.cs | 8 +- .../src/Loaders/FileSystemScriptLoader.cs | 2 +- .../src/Loaders/UnityAssetsScriptLoader.cs | 4 +- .../src/Modules/ModuleRegister.cs | 1 + .../Platforms/DotNetCorePlatformAccessor.cs | 5 +- .../src/Platforms/PlatformAccessorBase.cs | 79 ++++++++++- .../src/Script.cs | 14 ++ .../src/Serialization/ObjectValueConverter.cs | 2 +- .../MoonSharp.Interpreter.portable40.csproj | 6 + src/MoonSharp/Program.cs | 4 +- .../DotNetCoreTestRunner/Program.cs | 35 ++++- .../src/EndToEnd/UserDataOverloadsTests.cs | 5 +- .../DotNetCoreTestRunner/src/TestRunner.cs | 4 +- .../Assembly-CSharp-firstpass.csproj | 20 +-- src/Unity/MoonSharp/Assembly-CSharp.csproj | 2 +- .../Frameworks/Base/FrameworkClrBase.cs | 39 +++-- .../Base/FrameworkReflectionBase.cs | 4 +- .../Compatibility/Frameworks/FrameworkCLR.cs | 5 + .../Compatibility/Frameworks/FrameworkCore.cs | 108 +------------- .../Compatibility/Frameworks/FrameworkPCL.cs | 5 + .../Compatibility/Frameworks/FrameworkWin8.cs | 134 ++++++++++++++++++ .../Interpreter/Interop/DescriptorHelpers.cs | 14 +- .../Interop/PropertyTableAssigner.cs | 2 +- .../EventMemberDescriptor.cs | 10 +- .../PropertyMemberDescriptor.cs | 8 +- .../Loaders/FileSystemScriptLoader.cs | 2 +- .../Loaders/UnityAssetsScriptLoader.cs | 4 +- .../Interpreter/Modules/ModuleRegister.cs | 1 + .../Platforms/DotNetCorePlatformAccessor.cs | 5 +- .../Platforms/PlatformAccessorBase.cs | 79 ++++++++++- .../Plugins/MoonSharp/Interpreter/Script.cs | 14 ++ .../Serialization/ObjectValueConverter.cs | 2 +- .../Tests/EndToEnd/UserDataOverloadsTests.cs | 5 +- .../MoonSharp/Assets/Tests/TestRunner.cs | 4 +- .../MoonSharp/MoonSharp.CSharp.Plugins.csproj | 32 +++-- src/Unity/MoonSharp/MoonSharp.CSharp.csproj | 14 +- src/Unity/MoonSharp/MoonSharp.sln | 29 ++-- src/Unity/MoonSharp/MoonSharp.userprefs | 6 +- .../ProjectSettings/GraphicsSettings.asset | Bin .../ProjectSettings/ProjectSettings.asset | Bin src/moonsharp_netcore/moonsharp_netcore.sln | 34 +++++ src/release_readme.txt | 13 +- src/rsync_projects.sh | 4 + 65 files changed, 861 insertions(+), 541 deletions(-) create mode 100755 src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/FrameworkWin8.cs mode change 100644 => 100755 src/MoonSharp/Program.cs create mode 100755 src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkWin8.cs mode change 100644 => 100755 src/Unity/MoonSharp/ProjectSettings/GraphicsSettings.asset mode change 100644 => 100755 src/Unity/MoonSharp/ProjectSettings/ProjectSettings.asset create mode 100755 src/moonsharp_netcore/moonsharp_netcore.sln diff --git a/src/MoonSharp.Interpreter.Tests/EndToEnd/UserDataOverloadsTests.cs b/src/MoonSharp.Interpreter.Tests/EndToEnd/UserDataOverloadsTests.cs index e37d0b44..d55b5b9e 100755 --- a/src/MoonSharp.Interpreter.Tests/EndToEnd/UserDataOverloadsTests.cs +++ b/src/MoonSharp.Interpreter.Tests/EndToEnd/UserDataOverloadsTests.cs @@ -3,6 +3,7 @@ using System.IO; using System.Linq; using System.Text; +using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Interop; using MoonSharp.Interpreter.Loaders; using NUnit.Framework; @@ -298,8 +299,8 @@ public void OverloadTest_WithoutObjects() var ov = new OverloadedMethodMemberDescriptor("Method1", this.GetType()); // Iterate over the two methods through reflection - foreach(var method in this.GetType().GetMethods(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance) - .Where(mi => mi.Name == "Method1")) + foreach(var method in Framework.Do.GetMethods(this.GetType()) + .Where(mi => mi.Name == "Method1" && mi.IsPrivate && !mi.IsStatic)) { ov.AddOverload(new MethodMemberDescriptor(method)); } diff --git a/src/MoonSharp.Interpreter.Tests/TestRunner.cs b/src/MoonSharp.Interpreter.Tests/TestRunner.cs index 551712a7..82894da6 100755 --- a/src/MoonSharp.Interpreter.Tests/TestRunner.cs +++ b/src/MoonSharp.Interpreter.Tests/TestRunner.cs @@ -74,7 +74,7 @@ public IEnumerable IterateOnTests(string whichTest = null, string[] foreach (Type t in types) { - MethodInfo[] tests = t.GetMethods().Where(m => m.GetCustomAttributes(typeof(TestAttribute), true).Any()).ToArray(); + MethodInfo[] tests = Framework.Do.GetMethods(t).Where(m => m.GetCustomAttributes(typeof(TestAttribute), true).Any()).ToArray(); //Console_WriteLine("Testing {0} - {1} tests found.", t.Name, tests.Length); foreach (MethodInfo mi in tests) @@ -181,7 +181,7 @@ private static TestResult RunTest(Type t, MethodInfo mi) }; } - if (expectedEx != null && expectedEx.ExpectedException.IsInstanceOfType(ex)) + if (expectedEx != null && Framework.Do.IsInstanceOfType(expectedEx.ExpectedException, ex)) { return new TestResult() { diff --git a/src/MoonSharp.Interpreter/Compatibility/Frameworks/Base/FrameworkClrBase.cs b/src/MoonSharp.Interpreter/Compatibility/Frameworks/Base/FrameworkClrBase.cs index 434f9908..1391755b 100755 --- a/src/MoonSharp.Interpreter/Compatibility/Frameworks/Base/FrameworkClrBase.cs +++ b/src/MoonSharp.Interpreter/Compatibility/Frameworks/Base/FrameworkClrBase.cs @@ -1,4 +1,4 @@ -#if !(DOTNET_CORE || NETFX_CORE) +#if !NETFX_CORE || DOTNET_CORE using System; using System.Collections.Generic; @@ -13,11 +13,6 @@ abstract class FrameworkClrBase : FrameworkReflectionBase BindingFlags BINDINGFLAGS_MEMBER = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static; BindingFlags BINDINGFLAGS_INNERCLASS = BindingFlags.Public | BindingFlags.NonPublic; - public override Type GetTypeInfoFromType(Type t) - { - return t; - } - public override MethodInfo GetAddMethod(EventInfo ei) { return ei.GetAddMethod(true); @@ -25,84 +20,84 @@ public override MethodInfo GetAddMethod(EventInfo ei) public override ConstructorInfo[] GetConstructors(Type type) { - return type.GetConstructors(BINDINGFLAGS_MEMBER); + return GetTypeInfoFromType(type).GetConstructors(BINDINGFLAGS_MEMBER); } public override EventInfo[] GetEvents(Type type) { - return type.GetEvents(BINDINGFLAGS_MEMBER); + return GetTypeInfoFromType(type).GetEvents(BINDINGFLAGS_MEMBER); } public override FieldInfo[] GetFields(Type type) { - return type.GetFields(BINDINGFLAGS_MEMBER); + return GetTypeInfoFromType(type).GetFields(BINDINGFLAGS_MEMBER); } public override Type[] GetGenericArguments(Type type) { - return type.GetGenericArguments(); + return GetTypeInfoFromType(type).GetGenericArguments(); } public override MethodInfo GetGetMethod(PropertyInfo pi) { - return pi.GetGetMethod(); + return pi.GetGetMethod(true); } public override Type[] GetInterfaces(Type t) { - return t.GetInterfaces(); + return GetTypeInfoFromType(t).GetInterfaces(); } public override MethodInfo GetMethod(Type type, string name) { - return type.GetMethod(name); + return GetTypeInfoFromType(type).GetMethod(name); } public override MethodInfo[] GetMethods(Type type) { - return type.GetMethods(BINDINGFLAGS_MEMBER); + return GetTypeInfoFromType(type).GetMethods(BINDINGFLAGS_MEMBER); } public override Type[] GetNestedTypes(Type type) { - return type.GetNestedTypes(BINDINGFLAGS_INNERCLASS); + return GetTypeInfoFromType(type).GetNestedTypes(BINDINGFLAGS_INNERCLASS); } public override PropertyInfo[] GetProperties(Type type) { - return type.GetProperties(BINDINGFLAGS_MEMBER); + return GetTypeInfoFromType(type).GetProperties(BINDINGFLAGS_MEMBER); } public override PropertyInfo GetProperty(Type type, string name) { - return type.GetProperty(name); + return GetTypeInfoFromType(type).GetProperty(name); } public override MethodInfo GetRemoveMethod(EventInfo ei) { - return ei.GetRemoveMethod(); + return ei.GetRemoveMethod(true); } public override MethodInfo GetSetMethod(PropertyInfo pi) { - return pi.GetSetMethod(); + return pi.GetSetMethod(true); } public override bool IsAssignableFrom(Type current, Type toCompare) { - return current.IsAssignableFrom(toCompare); + return GetTypeInfoFromType(current).IsAssignableFrom(toCompare); } public override bool IsInstanceOfType(Type t, object o) { - return t.IsInstanceOfType(o); + return GetTypeInfoFromType(t).IsInstanceOfType(o); } public override MethodInfo GetMethod(Type resourcesType, string name, Type[] types) { - return resourcesType.GetMethod(name, types); + return GetTypeInfoFromType(resourcesType).GetMethod(name, types); } public override Type[] GetAssemblyTypes(Assembly asm) diff --git a/src/MoonSharp.Interpreter/Compatibility/Frameworks/Base/FrameworkReflectionBase.cs b/src/MoonSharp.Interpreter/Compatibility/Frameworks/Base/FrameworkReflectionBase.cs index 47849c83..10913658 100755 --- a/src/MoonSharp.Interpreter/Compatibility/Frameworks/Base/FrameworkReflectionBase.cs +++ b/src/MoonSharp.Interpreter/Compatibility/Frameworks/Base/FrameworkReflectionBase.cs @@ -4,7 +4,9 @@ using System.Reflection; using System.Text; -#if DOTNET_CORE || NETFX_CORE +#if DOTNET_CORE + using TTypeInfo = System.Reflection.TypeInfo; +#elif NETFX_CORE using TTypeInfo = System.Reflection.TypeInfo; #else using TTypeInfo = System.Type; diff --git a/src/MoonSharp.Interpreter/Compatibility/Frameworks/FrameworkCLR.cs b/src/MoonSharp.Interpreter/Compatibility/Frameworks/FrameworkCLR.cs index e1bc4f2c..a362eb02 100755 --- a/src/MoonSharp.Interpreter/Compatibility/Frameworks/FrameworkCLR.cs +++ b/src/MoonSharp.Interpreter/Compatibility/Frameworks/FrameworkCLR.cs @@ -10,6 +10,11 @@ namespace MoonSharp.Interpreter.Compatibility.Frameworks { class FrameworkCurrent : FrameworkClrBase { + public override Type GetTypeInfoFromType(Type t) + { + return t; + } + public override bool IsDbNull(object o) { return o != null && Convert.IsDBNull(o); diff --git a/src/MoonSharp.Interpreter/Compatibility/Frameworks/FrameworkCore.cs b/src/MoonSharp.Interpreter/Compatibility/Frameworks/FrameworkCore.cs index 04734a4e..c8c0b39a 100755 --- a/src/MoonSharp.Interpreter/Compatibility/Frameworks/FrameworkCore.cs +++ b/src/MoonSharp.Interpreter/Compatibility/Frameworks/FrameworkCore.cs @@ -8,98 +8,16 @@ namespace MoonSharp.Interpreter.Compatibility.Frameworks { - class FrameworkCurrent : FrameworkReflectionBase + class FrameworkCurrent : FrameworkClrBase { - public override TypeInfo GetTypeInfoFromType(Type t) - { - return t.GetTypeInfo(); - } - - private T[] SafeArray(IEnumerable prop) - { - return prop != null ? prop.ToArray() : new T[0]; - } - - public override MethodInfo GetAddMethod(EventInfo ei) - { - return ei.AddMethod; - } - - public override ConstructorInfo[] GetConstructors(Type type) - { - return SafeArray(GetTypeInfoFromType(type).DeclaredConstructors); - } - - public override EventInfo[] GetEvents(Type type) - { - return SafeArray(GetTypeInfoFromType(type).DeclaredEvents); - } - - public override FieldInfo[] GetFields(Type type) - { - return SafeArray(GetTypeInfoFromType(type).DeclaredFields); - } - - public override Type[] GetGenericArguments(Type type) - { - return type.GetTypeInfo().GetGenericArguments(); - } - - public override MethodInfo GetGetMethod(PropertyInfo pi) - { - return pi.GetGetMethod(); - } - public override Type GetInterface(Type type, string name) { - return GetTypeInfoFromType(type).GetInterface(name); - } - - public override Type[] GetInterfaces(Type t) - { - return GetTypeInfoFromType(t).GetInterfaces(); - } - - - public override MethodInfo GetMethod(Type type, string name) - { - return GetTypeInfoFromType(type).GetMethod(name); - } - - public override MethodInfo[] GetMethods(Type type) - { - return SafeArray(GetTypeInfoFromType(type).DeclaredMethods); - } - - public override Type[] GetNestedTypes(Type type) - { - return SafeArray(GetTypeInfoFromType(type).DeclaredNestedTypes.Select(ti => ti.AsType())); - } - - public override PropertyInfo[] GetProperties(Type type) - { - return SafeArray(GetTypeInfoFromType(type).DeclaredProperties); - } - - public override PropertyInfo GetProperty(Type type, string name) - { - return GetTypeInfoFromType(type).GetProperty(name); - } - - public override MethodInfo GetRemoveMethod(EventInfo ei) - { - return ei.RemoveMethod; + return type.GetTypeInfo().GetInterface(name); } - public override MethodInfo GetSetMethod(PropertyInfo pi) - { - return pi.SetMethod; - } - - - public override bool IsAssignableFrom(Type current, Type toCompare) + public override TypeInfo GetTypeInfoFromType(Type t) { - return current.GetTypeInfo().IsAssignableFrom(toCompare.GetTypeInfo()); + return t.GetTypeInfo(); } public override bool IsDbNull(object o) @@ -107,26 +25,10 @@ public override bool IsDbNull(object o) return o != null && o.GetType().FullName.StartsWith("System.DBNull"); } - public override bool IsInstanceOfType(Type t, object o) - { - return t.GetTypeInfo().IsInstanceOfType(o); - } - public override bool StringContainsChar(string str, char chr) { return str.Contains(chr); } - - public override MethodInfo GetMethod(Type resourcesType, string name, Type[] types) - { - return resourcesType.GetTypeInfo().GetMethod(name, types); - } - - public override Type[] GetAssemblyTypes(Assembly asm) - { - return asm.GetExportedTypes(); - } - } } #endif diff --git a/src/MoonSharp.Interpreter/Compatibility/Frameworks/FrameworkPCL.cs b/src/MoonSharp.Interpreter/Compatibility/Frameworks/FrameworkPCL.cs index 85035012..c3bcc58b 100755 --- a/src/MoonSharp.Interpreter/Compatibility/Frameworks/FrameworkPCL.cs +++ b/src/MoonSharp.Interpreter/Compatibility/Frameworks/FrameworkPCL.cs @@ -9,6 +9,11 @@ namespace MoonSharp.Interpreter.Compatibility.Frameworks { class FrameworkCurrent : FrameworkClrBase { + public override Type GetTypeInfoFromType(Type t) + { + return t; + } + public override bool IsDbNull(object o) { return o != null && o.GetType().FullName.StartsWith("System.DBNull"); diff --git a/src/MoonSharp.Interpreter/Compatibility/Frameworks/FrameworkWin8.cs b/src/MoonSharp.Interpreter/Compatibility/Frameworks/FrameworkWin8.cs index b124f382..7fd903b2 100755 --- a/src/MoonSharp.Interpreter/Compatibility/Frameworks/FrameworkWin8.cs +++ b/src/MoonSharp.Interpreter/Compatibility/Frameworks/FrameworkWin8.cs @@ -1,4 +1,4 @@ -#if NETFX_CORE +#if NETFX_CORE && !DOTNET_CORE using System; using System.Collections.Generic; @@ -32,12 +32,12 @@ public override ConstructorInfo[] GetConstructors(Type type) public override EventInfo[] GetEvents(Type type) { - return SafeArray(GetTypeInfoFromType(type).DeclaredEvents); + return SafeArray(type.GetRuntimeEvents()); } public override FieldInfo[] GetFields(Type type) { - return SafeArray(GetTypeInfoFromType(type).DeclaredFields); + return SafeArray(type.GetRuntimeFields()); } public override Type[] GetGenericArguments(Type type) @@ -60,15 +60,14 @@ public override Type[] GetInterfaces(Type t) return SafeArray(GetTypeInfoFromType(t).ImplementedInterfaces); } - public override MethodInfo GetMethod(Type type, string name) { - return GetTypeInfoFromType(type).GetDeclaredMethod(name); + return type.GetRuntimeMethods().FirstOrDefault(mi => mi.Name == name); } public override MethodInfo[] GetMethods(Type type) { - return SafeArray(GetTypeInfoFromType(type).DeclaredMethods); + return SafeArray(type.GetRuntimeMethods()); } public override Type[] GetNestedTypes(Type type) @@ -78,12 +77,12 @@ public override Type[] GetNestedTypes(Type type) public override PropertyInfo[] GetProperties(Type type) { - return SafeArray(GetTypeInfoFromType(type).DeclaredProperties); + return SafeArray(type.GetRuntimeProperties()); } public override PropertyInfo GetProperty(Type type, string name) { - return GetTypeInfoFromType(type).GetDeclaredProperty(name); + return type.GetRuntimeProperty(name); } public override MethodInfo GetRemoveMethod(EventInfo ei) @@ -120,39 +119,14 @@ public override bool StringContainsChar(string str, char chr) return str.Contains(chr); } - private static MethodInfo GetMethodEx(Type t, string name, Type[] parameters) - { - var ti = t.GetTypeInfo(); - var methods = ti.GetDeclaredMethods(name); - foreach (var m in methods) - { - var plist = m.GetParameters(); - bool match = true; - foreach (var param in plist) - { - bool valid = true; - if (parameters != null) - { - foreach (var ptype in parameters) - valid &= ptype == param.ParameterType; - } - match &= valid; - } - if (match) - return m; - } - return null; - } - - public override MethodInfo GetMethod(Type resourcesType, string name, Type[] types) { - return GetMethodEx(resourcesType, name, types); + return resourcesType.GetRuntimeMethod(name, types); } public override Type[] GetAssemblyTypes(Assembly asm) { - return SafeArray(asm.ExportedTypes); + return SafeArray(asm.DefinedTypes.Select(ti => ti.AsType())); } } diff --git a/src/MoonSharp.Interpreter/Modules/ModuleRegister.cs b/src/MoonSharp.Interpreter/Modules/ModuleRegister.cs index 41857949..f2993260 100755 --- a/src/MoonSharp.Interpreter/Modules/ModuleRegister.cs +++ b/src/MoonSharp.Interpreter/Modules/ModuleRegister.cs @@ -68,6 +68,7 @@ public static Table RegisterConstants(this Table table) m.Set("is_mono", DynValue.NewBoolean(PlatformAutoDetector.IsRunningOnMono)); m.Set("is_clr4", DynValue.NewBoolean(PlatformAutoDetector.IsRunningOnClr4)); m.Set("is_pcl", DynValue.NewBoolean(PlatformAutoDetector.IsPortableFramework)); + m.Set("banner", DynValue.NewString(Script.GetBanner())); return table; } diff --git a/src/MoonSharp.Interpreter/MoonSharp.Interpreter.net35-client.csproj b/src/MoonSharp.Interpreter/MoonSharp.Interpreter.net35-client.csproj index e5fe3e22..67f6046d 100644 --- a/src/MoonSharp.Interpreter/MoonSharp.Interpreter.net35-client.csproj +++ b/src/MoonSharp.Interpreter/MoonSharp.Interpreter.net35-client.csproj @@ -126,6 +126,7 @@ + diff --git a/src/MoonSharp.Interpreter/Platforms/PlatformAccessorBase.cs b/src/MoonSharp.Interpreter/Platforms/PlatformAccessorBase.cs index 68a55423..f09c7cc5 100755 --- a/src/MoonSharp.Interpreter/Platforms/PlatformAccessorBase.cs +++ b/src/MoonSharp.Interpreter/Platforms/PlatformAccessorBase.cs @@ -29,19 +29,14 @@ public string GetPlatformName() { if (PlatformAutoDetector.IsUnityNative) { - if (PlatformAutoDetector.IsUnityIL2CPP) - suffix = "unity5.il2cpp"; - else if (PlatformAutoDetector.IsRunningOnMono) - suffix = "unity5.mono"; - else - suffix = "unity5.webp"; + suffix = "unity." + GetUnityPlatformName().ToLower() + "." + GetUnityRuntimeName(); } else { if (PlatformAutoDetector.IsRunningOnMono) suffix = "unity.dll.mono"; else - suffix = "unity.dll.webp"; + suffix = "unity.dll.unknown"; } } else if (PlatformAutoDetector.IsRunningOnMono) @@ -57,12 +52,82 @@ public string GetPlatformName() else suffix = suffix + ".clr2"; +#if DOTNET_CORE + suffix += ".netcore"; +#endif + if (PlatformAutoDetector.IsRunningOnAOT) suffix = suffix + ".aot"; return GetPlatformNamePrefix() + "." + suffix; } + private string GetUnityRuntimeName() + { +#if ENABLE_MONO + return "mono"; +#elif ENABLE_IL2CPP + return "il2cpp"; +#elif ENABLE_DOTNET + return "dotnet"; +#else + return "unknown"; +#endif + } + + private string GetUnityPlatformName() + { +#if UNITY_STANDALONE_OSX + return "OSX"; +#elif UNITY_STANDALONE_WIN + return "WIN"; +#elif UNITY_STANDALONE_LINUX + return "LINUX"; +#elif UNITY_STANDALONE + return "STANDALONE"; +#elif UNITY_WII + return "WII"; +#elif UNITY_IOS + return "IOS"; +#elif UNITY_IPHONE + return "IPHONE"; +#elif UNITY_ANDROID + return "ANDROID"; +#elif UNITY_PS3 + return "PS3"; +#elif UNITY_PS4 + return "PS4"; +#elif UNITY_SAMSUNGTV + return "SAMSUNGTV"; +#elif UNITY_XBOX360 + return "XBOX360"; +#elif UNITY_XBOXONE + return "XBOXONE"; +#elif UNITY_TIZEN + return "TIZEN"; +#elif UNITY_TVOS + return "TVOS"; +#elif UNITY_WP_8_1 + return "WP_8_1"; +#elif UNITY_WSA_10_0 + return "WSA_10_0"; +#elif UNITY_WSA_8_1 + return "WSA_8_1"; +#elif UNITY_WSA + return "WSA"; +#elif UNITY_WINRT_10_0 + return "WINRT_10_0"; +#elif UNITY_WINRT_8_1 + return "WINRT_8_1"; +#elif UNITY_WINRT + return "WINRT"; +#elif UNITY_WEBGL + return "WEBGL"; +#else + return "UNKNOWNHW"; +#endif + } + /// /// Default handler for 'print' calls. Can be customized in ScriptOptions /// diff --git a/src/MoonSharp.Interpreter/Script.cs b/src/MoonSharp.Interpreter/Script.cs index 49d494cf..6e3bb11a 100755 --- a/src/MoonSharp.Interpreter/Script.cs +++ b/src/MoonSharp.Interpreter/Script.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text; using MoonSharp.Interpreter.CoreLib; using MoonSharp.Interpreter.Debugging; using MoonSharp.Interpreter.Diagnostics; @@ -726,6 +727,19 @@ public Table Registry private set; } + /// + /// Gets a banner string with copyright info, link to website, version, etc. + /// + public static string GetBanner(string subproduct = null) + { + subproduct = (subproduct != null) ? (subproduct + " ") : ""; + + StringBuilder sb = new StringBuilder(); + sb.AppendLine(string.Format("MoonSharp {0}{1} [{2}]", subproduct, Script.VERSION, Script.GlobalOptions.Platform.GetPlatformName())); + sb.AppendLine("Copyright (C) 2014-2016 Marco Mastropaolo"); + sb.AppendLine("http://www.moonsharp.org"); + return sb.ToString(); + } Script IScriptPrivateResource.OwnerScript { diff --git a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.net40-client/MoonSharp.Interpreter.net40-client.csproj b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.net40-client/MoonSharp.Interpreter.net40-client.csproj index 30d582e1..0dc04fd8 100755 --- a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.net40-client/MoonSharp.Interpreter.net40-client.csproj +++ b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.net40-client/MoonSharp.Interpreter.net40-client.csproj @@ -88,6 +88,9 @@ FrameworkPCL.cs + + FrameworkWin8.cs + CoroutineModule.cs @@ -573,6 +576,9 @@ ColonOperatorBehaviour.cs + + DotNetCorePlatformAccessor.cs + ReplHistoryNavigator.cs diff --git a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/Base/FrameworkClrBase.cs b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/Base/FrameworkClrBase.cs index 434f9908..1391755b 100755 --- a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/Base/FrameworkClrBase.cs +++ b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/Base/FrameworkClrBase.cs @@ -1,4 +1,4 @@ -#if !(DOTNET_CORE || NETFX_CORE) +#if !NETFX_CORE || DOTNET_CORE using System; using System.Collections.Generic; @@ -13,11 +13,6 @@ abstract class FrameworkClrBase : FrameworkReflectionBase BindingFlags BINDINGFLAGS_MEMBER = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static; BindingFlags BINDINGFLAGS_INNERCLASS = BindingFlags.Public | BindingFlags.NonPublic; - public override Type GetTypeInfoFromType(Type t) - { - return t; - } - public override MethodInfo GetAddMethod(EventInfo ei) { return ei.GetAddMethod(true); @@ -25,84 +20,84 @@ public override MethodInfo GetAddMethod(EventInfo ei) public override ConstructorInfo[] GetConstructors(Type type) { - return type.GetConstructors(BINDINGFLAGS_MEMBER); + return GetTypeInfoFromType(type).GetConstructors(BINDINGFLAGS_MEMBER); } public override EventInfo[] GetEvents(Type type) { - return type.GetEvents(BINDINGFLAGS_MEMBER); + return GetTypeInfoFromType(type).GetEvents(BINDINGFLAGS_MEMBER); } public override FieldInfo[] GetFields(Type type) { - return type.GetFields(BINDINGFLAGS_MEMBER); + return GetTypeInfoFromType(type).GetFields(BINDINGFLAGS_MEMBER); } public override Type[] GetGenericArguments(Type type) { - return type.GetGenericArguments(); + return GetTypeInfoFromType(type).GetGenericArguments(); } public override MethodInfo GetGetMethod(PropertyInfo pi) { - return pi.GetGetMethod(); + return pi.GetGetMethod(true); } public override Type[] GetInterfaces(Type t) { - return t.GetInterfaces(); + return GetTypeInfoFromType(t).GetInterfaces(); } public override MethodInfo GetMethod(Type type, string name) { - return type.GetMethod(name); + return GetTypeInfoFromType(type).GetMethod(name); } public override MethodInfo[] GetMethods(Type type) { - return type.GetMethods(BINDINGFLAGS_MEMBER); + return GetTypeInfoFromType(type).GetMethods(BINDINGFLAGS_MEMBER); } public override Type[] GetNestedTypes(Type type) { - return type.GetNestedTypes(BINDINGFLAGS_INNERCLASS); + return GetTypeInfoFromType(type).GetNestedTypes(BINDINGFLAGS_INNERCLASS); } public override PropertyInfo[] GetProperties(Type type) { - return type.GetProperties(BINDINGFLAGS_MEMBER); + return GetTypeInfoFromType(type).GetProperties(BINDINGFLAGS_MEMBER); } public override PropertyInfo GetProperty(Type type, string name) { - return type.GetProperty(name); + return GetTypeInfoFromType(type).GetProperty(name); } public override MethodInfo GetRemoveMethod(EventInfo ei) { - return ei.GetRemoveMethod(); + return ei.GetRemoveMethod(true); } public override MethodInfo GetSetMethod(PropertyInfo pi) { - return pi.GetSetMethod(); + return pi.GetSetMethod(true); } public override bool IsAssignableFrom(Type current, Type toCompare) { - return current.IsAssignableFrom(toCompare); + return GetTypeInfoFromType(current).IsAssignableFrom(toCompare); } public override bool IsInstanceOfType(Type t, object o) { - return t.IsInstanceOfType(o); + return GetTypeInfoFromType(t).IsInstanceOfType(o); } public override MethodInfo GetMethod(Type resourcesType, string name, Type[] types) { - return resourcesType.GetMethod(name, types); + return GetTypeInfoFromType(resourcesType).GetMethod(name, types); } public override Type[] GetAssemblyTypes(Assembly asm) diff --git a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/Base/FrameworkReflectionBase.cs b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/Base/FrameworkReflectionBase.cs index 47849c83..10913658 100755 --- a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/Base/FrameworkReflectionBase.cs +++ b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/Base/FrameworkReflectionBase.cs @@ -4,7 +4,9 @@ using System.Reflection; using System.Text; -#if DOTNET_CORE || NETFX_CORE +#if DOTNET_CORE + using TTypeInfo = System.Reflection.TypeInfo; +#elif NETFX_CORE using TTypeInfo = System.Reflection.TypeInfo; #else using TTypeInfo = System.Type; diff --git a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/FrameworkCLR.cs b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/FrameworkCLR.cs index e1bc4f2c..a362eb02 100755 --- a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/FrameworkCLR.cs +++ b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/FrameworkCLR.cs @@ -10,6 +10,11 @@ namespace MoonSharp.Interpreter.Compatibility.Frameworks { class FrameworkCurrent : FrameworkClrBase { + public override Type GetTypeInfoFromType(Type t) + { + return t; + } + public override bool IsDbNull(object o) { return o != null && Convert.IsDBNull(o); diff --git a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/FrameworkCore.cs b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/FrameworkCore.cs index 37f26790..c8c0b39a 100755 --- a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/FrameworkCore.cs +++ b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/FrameworkCore.cs @@ -1,4 +1,4 @@ -#if DOTNET_CORE || NETFX_CORE +#if DOTNET_CORE using System; using System.Collections.Generic; @@ -8,98 +8,16 @@ namespace MoonSharp.Interpreter.Compatibility.Frameworks { - class FrameworkCurrent : FrameworkReflectionBase + class FrameworkCurrent : FrameworkClrBase { - public override TypeInfo GetTypeInfoFromType(Type t) - { - return t.GetTypeInfo(); - } - - private T[] SafeArray(IEnumerable prop) - { - return prop != null ? prop.ToArray() : new T[0]; - } - - public override MethodInfo GetAddMethod(EventInfo ei) - { - return ei.AddMethod; - } - - public override ConstructorInfo[] GetConstructors(Type type) - { - return SafeArray(GetTypeInfoFromType(type).DeclaredConstructors); - } - - public override EventInfo[] GetEvents(Type type) - { - return SafeArray(GetTypeInfoFromType(type).DeclaredEvents); - } - - public override FieldInfo[] GetFields(Type type) - { - return SafeArray(GetTypeInfoFromType(type).DeclaredFields); - } - - public override Type[] GetGenericArguments(Type type) - { - return type.GetTypeInfo().GetGenericArguments(); - } - - public override MethodInfo GetGetMethod(PropertyInfo pi) - { - return pi.GetGetMethod(); - } - public override Type GetInterface(Type type, string name) { - return GetTypeInfoFromType(type).GetInterface(name); - } - - public override Type[] GetInterfaces(Type t) - { - return GetTypeInfoFromType(t).GetInterfaces(); - } - - - public override MethodInfo GetMethod(Type type, string name) - { - return GetTypeInfoFromType(type).GetMethod(name); - } - - public override MethodInfo[] GetMethods(Type type) - { - return SafeArray(GetTypeInfoFromType(type).DeclaredMethods); - } - - public override Type[] GetNestedTypes(Type type) - { - return SafeArray(GetTypeInfoFromType(type).DeclaredNestedTypes.Select(ti => ti.AsType())); - } - - public override PropertyInfo[] GetProperties(Type type) - { - return SafeArray(GetTypeInfoFromType(type).DeclaredProperties); - } - - public override PropertyInfo GetProperty(Type type, string name) - { - return GetTypeInfoFromType(type).GetProperty(name); - } - - public override MethodInfo GetRemoveMethod(EventInfo ei) - { - return ei.RemoveMethod; + return type.GetTypeInfo().GetInterface(name); } - public override MethodInfo GetSetMethod(PropertyInfo pi) - { - return pi.SetMethod; - } - - - public override bool IsAssignableFrom(Type current, Type toCompare) + public override TypeInfo GetTypeInfoFromType(Type t) { - return current.GetTypeInfo().IsAssignableFrom(toCompare.GetTypeInfo()); + return t.GetTypeInfo(); } public override bool IsDbNull(object o) @@ -107,26 +25,10 @@ public override bool IsDbNull(object o) return o != null && o.GetType().FullName.StartsWith("System.DBNull"); } - public override bool IsInstanceOfType(Type t, object o) - { - return t.GetTypeInfo().IsInstanceOfType(o); - } - public override bool StringContainsChar(string str, char chr) { return str.Contains(chr); } - - public override MethodInfo GetMethod(Type resourcesType, string name, Type[] types) - { - return resourcesType.GetTypeInfo().GetMethod(name, types); - } - - public override Type[] GetAssemblyTypes(Assembly asm) - { - return asm.GetExportedTypes(); - } - } } #endif diff --git a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/FrameworkPCL.cs b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/FrameworkPCL.cs index 85035012..c3bcc58b 100755 --- a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/FrameworkPCL.cs +++ b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/FrameworkPCL.cs @@ -9,6 +9,11 @@ namespace MoonSharp.Interpreter.Compatibility.Frameworks { class FrameworkCurrent : FrameworkClrBase { + public override Type GetTypeInfoFromType(Type t) + { + return t; + } + public override bool IsDbNull(object o) { return o != null && o.GetType().FullName.StartsWith("System.DBNull"); diff --git a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/FrameworkWin8.cs b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/FrameworkWin8.cs new file mode 100755 index 00000000..7fd903b2 --- /dev/null +++ b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Compatibility/Frameworks/FrameworkWin8.cs @@ -0,0 +1,134 @@ +#if NETFX_CORE && !DOTNET_CORE + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; + +namespace MoonSharp.Interpreter.Compatibility.Frameworks +{ + class FrameworkCurrent : FrameworkReflectionBase + { + public override TypeInfo GetTypeInfoFromType(Type t) + { + return t.GetTypeInfo(); + } + + private T[] SafeArray(IEnumerable prop) + { + return prop != null ? prop.ToArray() : new T[0]; + } + + public override MethodInfo GetAddMethod(EventInfo ei) + { + return ei.AddMethod; + } + + public override ConstructorInfo[] GetConstructors(Type type) + { + return SafeArray(GetTypeInfoFromType(type).DeclaredConstructors); + } + + public override EventInfo[] GetEvents(Type type) + { + return SafeArray(type.GetRuntimeEvents()); + } + + public override FieldInfo[] GetFields(Type type) + { + return SafeArray(type.GetRuntimeFields()); + } + + public override Type[] GetGenericArguments(Type type) + { + return type.GetTypeInfo().GenericTypeArguments; + } + + public override MethodInfo GetGetMethod(PropertyInfo pi) + { + return pi.GetMethod; + } + + public override Type GetInterface(Type type, string name) + { + return type.GetTypeInfo().ImplementedInterfaces.FirstOrDefault(t => t.Name == name); + } + + public override Type[] GetInterfaces(Type t) + { + return SafeArray(GetTypeInfoFromType(t).ImplementedInterfaces); + } + + public override MethodInfo GetMethod(Type type, string name) + { + return type.GetRuntimeMethods().FirstOrDefault(mi => mi.Name == name); + } + + public override MethodInfo[] GetMethods(Type type) + { + return SafeArray(type.GetRuntimeMethods()); + } + + public override Type[] GetNestedTypes(Type type) + { + return SafeArray(GetTypeInfoFromType(type).DeclaredNestedTypes.Select(ti => ti.AsType())); + } + + public override PropertyInfo[] GetProperties(Type type) + { + return SafeArray(type.GetRuntimeProperties()); + } + + public override PropertyInfo GetProperty(Type type, string name) + { + return type.GetRuntimeProperty(name); + } + + public override MethodInfo GetRemoveMethod(EventInfo ei) + { + return ei.RemoveMethod; + } + + public override MethodInfo GetSetMethod(PropertyInfo pi) + { + return pi.SetMethod; + } + + + public override bool IsAssignableFrom(Type current, Type toCompare) + { + return current.GetTypeInfo().IsAssignableFrom(toCompare.GetTypeInfo()); + } + + public override bool IsDbNull(object o) + { + return o != null && o.GetType().FullName.StartsWith("System.DBNull"); + } + + public override bool IsInstanceOfType(Type t, object o) + { + if (o == null) + return false; + + return t.GetTypeInfo().IsAssignableFrom(o.GetType().GetTypeInfo()); + } + + public override bool StringContainsChar(string str, char chr) + { + return str.Contains(chr); + } + + public override MethodInfo GetMethod(Type resourcesType, string name, Type[] types) + { + return resourcesType.GetRuntimeMethod(name, types); + } + + public override Type[] GetAssemblyTypes(Assembly asm) + { + return SafeArray(asm.DefinedTypes.Select(ti => ti.AsType())); + } + + } +} +#endif diff --git a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Interop/DescriptorHelpers.cs b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Interop/DescriptorHelpers.cs index a9541c62..9bf7c402 100755 --- a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Interop/DescriptorHelpers.cs +++ b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Interop/DescriptorHelpers.cs @@ -94,8 +94,8 @@ public static string GetClrVisibility(this FieldInfo info) /// public static string GetClrVisibility(this PropertyInfo info) { - MethodInfo gm = info.GetGetMethod(true); - MethodInfo sm = info.GetSetMethod(true); + MethodInfo gm = Framework.Do.GetGetMethod(info); + MethodInfo sm = Framework.Do.GetSetMethod(info); string gv = (gm != null) ? GetClrVisibility(gm) : "private"; string sv = (sm != null) ? GetClrVisibility(sm) : "private"; @@ -137,8 +137,8 @@ public static string GetClrVisibility(this MethodBase info) /// public static bool IsPropertyInfoPublic(this PropertyInfo pi) { - MethodInfo getter = pi.GetGetMethod(); - MethodInfo setter = pi.GetSetMethod(); + MethodInfo getter = Framework.Do.GetGetMethod(pi); + MethodInfo setter = Framework.Do.GetSetMethod(pi); return (getter != null && getter.IsPublic) || (setter != null && setter.IsPublic); } @@ -166,11 +166,7 @@ public static Type[] SafeGetTypes(this Assembly asm) { try { -#if NETFX_CORE - return asm.GetExportedTypes(); -#else - return asm.GetTypes(); -#endif + return Framework.Do.GetAssemblyTypes(asm); } catch (ReflectionTypeLoadException) { diff --git a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Interop/PropertyTableAssigner.cs b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Interop/PropertyTableAssigner.cs index 2fa0ea35..a6aed2fd 100644 --- a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Interop/PropertyTableAssigner.cs +++ b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Interop/PropertyTableAssigner.cs @@ -170,7 +170,7 @@ private bool TryAssignProperty(object obj, string name, DynValue value) pi.PropertyType, null, false); } - pi.GetSetMethod(true).Invoke(obj, new object[] { o }); + Framework.Do.GetSetMethod(pi).Invoke(obj, new object[] { o }); } return true; diff --git a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Interop/StandardDescriptors/ReflectionMemberDescriptors/EventMemberDescriptor.cs b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Interop/StandardDescriptors/ReflectionMemberDescriptors/EventMemberDescriptor.cs index 3a709640..3a19cbe5 100755 --- a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Interop/StandardDescriptors/ReflectionMemberDescriptors/EventMemberDescriptor.cs +++ b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Interop/StandardDescriptors/ReflectionMemberDescriptors/EventMemberDescriptor.cs @@ -37,8 +37,8 @@ public static EventMemberDescriptor TryCreateIfVisible(EventInfo ei, InteropAcce if (!CheckEventIsCompatible(ei, false)) return null; - MethodInfo addm = ei.GetAddMethod(); - MethodInfo remm = ei.GetRemoveMethod(); + MethodInfo addm = Framework.Do.GetAddMethod(ei); + MethodInfo remm = Framework.Do.GetRemoveMethod(ei); if (ei.GetVisibilityFromAttributes() ?? ((remm != null && remm.IsPublic) && (addm != null && addm.IsPublic))) return new EventMemberDescriptor(ei, accessMode); @@ -77,7 +77,7 @@ public static bool CheckEventIsCompatible(EventInfo ei, bool throwException) return false; } - if ((ei.GetAddMethod(true) == null) || (ei.GetRemoveMethod(true) == null)) + if ((Framework.Do.GetAddMethod(ei) == null) || (Framework.Do.GetRemoveMethod(ei) == null)) { if (throwException) throw new ArgumentException("Event must have add and remove methods"); return false; @@ -135,8 +135,8 @@ public EventMemberDescriptor(EventInfo ei, InteropAccessMode accessMode = Intero { CheckEventIsCompatible(ei, true); EventInfo = ei; - m_Add = ei.GetAddMethod(true); - m_Remove = ei.GetRemoveMethod(true); + m_Add = Framework.Do.GetAddMethod(ei); + m_Remove = Framework.Do.GetRemoveMethod(ei); IsStatic = m_Add.IsStatic; } diff --git a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Interop/StandardDescriptors/ReflectionMemberDescriptors/PropertyMemberDescriptor.cs b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Interop/StandardDescriptors/ReflectionMemberDescriptors/PropertyMemberDescriptor.cs index 03c5e05e..618ee3cc 100644 --- a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Interop/StandardDescriptors/ReflectionMemberDescriptors/PropertyMemberDescriptor.cs +++ b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Interop/StandardDescriptors/ReflectionMemberDescriptors/PropertyMemberDescriptor.cs @@ -61,8 +61,8 @@ public class PropertyMemberDescriptor : IMemberDescriptor, IOptimizableDescripto /// A new StandardUserDataPropertyDescriptor or null. public static PropertyMemberDescriptor TryCreateIfVisible(PropertyInfo pi, InteropAccessMode accessMode) { - MethodInfo getter = pi.GetGetMethod(true); - MethodInfo setter = pi.GetSetMethod(true); + MethodInfo getter = Framework.Do.GetGetMethod(pi); + MethodInfo setter = Framework.Do.GetSetMethod(pi); bool? pvisible = pi.GetVisibilityFromAttributes(); bool? gvisible = getter.GetVisibilityFromAttributes(); @@ -99,7 +99,7 @@ private static PropertyMemberDescriptor TryCreate(PropertyInfo pi, InteropAccess /// The pi. /// The access mode. public PropertyMemberDescriptor(PropertyInfo pi, InteropAccessMode accessMode) - : this(pi, accessMode, pi.GetGetMethod(), pi.GetSetMethod()) + : this(pi, accessMode, Framework.Do.GetGetMethod(pi), Framework.Do.GetSetMethod(pi)) { } @@ -194,7 +194,7 @@ internal void OptimizeSetter() { if (m_Setter != null && !(Framework.Do.IsValueType(PropertyInfo.DeclaringType))) { - MethodInfo setterMethod = PropertyInfo.GetSetMethod(true); + MethodInfo setterMethod = Framework.Do.GetSetMethod(PropertyInfo); if (IsStatic) { diff --git a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Loaders/FileSystemScriptLoader.cs b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Loaders/FileSystemScriptLoader.cs index c0e228e1..77e69eea 100755 --- a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Loaders/FileSystemScriptLoader.cs +++ b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Loaders/FileSystemScriptLoader.cs @@ -1,4 +1,4 @@ -#if DOTNET_CORE || (!(PCL || ENABLE_DOTNET)) +#if DOTNET_CORE || (!(PCL || ENABLE_DOTNET || NETFX_CORE)) using System.IO; namespace MoonSharp.Interpreter.Loaders diff --git a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Loaders/UnityAssetsScriptLoader.cs b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Loaders/UnityAssetsScriptLoader.cs index 945bdf36..7db23081 100755 --- a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Loaders/UnityAssetsScriptLoader.cs +++ b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Loaders/UnityAssetsScriptLoader.cs @@ -80,8 +80,8 @@ void LoadResourcesWithReflection(string assetsPath) Type resourcesType = Type.GetType("UnityEngine.Resources, UnityEngine"); Type textAssetType = Type.GetType("UnityEngine.TextAsset, UnityEngine"); - MethodInfo textAssetNameGet = Framework.Do.GetProperty(textAssetType, "name").GetGetMethod(); - MethodInfo textAssetTextGet = Framework.Do.GetProperty(textAssetType, "text").GetGetMethod(); + MethodInfo textAssetNameGet = Framework.Do.GetGetMethod(Framework.Do.GetProperty(textAssetType, "name")); + MethodInfo textAssetTextGet = Framework.Do.GetGetMethod(Framework.Do.GetProperty(textAssetType, "text")); MethodInfo loadAll = Framework.Do.GetMethod(resourcesType, "LoadAll", new Type[] { typeof(string), typeof(Type) }); diff --git a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Modules/ModuleRegister.cs b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Modules/ModuleRegister.cs index 41857949..f2993260 100755 --- a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Modules/ModuleRegister.cs +++ b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Modules/ModuleRegister.cs @@ -68,6 +68,7 @@ public static Table RegisterConstants(this Table table) m.Set("is_mono", DynValue.NewBoolean(PlatformAutoDetector.IsRunningOnMono)); m.Set("is_clr4", DynValue.NewBoolean(PlatformAutoDetector.IsRunningOnClr4)); m.Set("is_pcl", DynValue.NewBoolean(PlatformAutoDetector.IsPortableFramework)); + m.Set("banner", DynValue.NewString(Script.GetBanner())); return table; } diff --git a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Platforms/DotNetCorePlatformAccessor.cs b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Platforms/DotNetCorePlatformAccessor.cs index e4e2dc08..2671fac8 100755 --- a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Platforms/DotNetCorePlatformAccessor.cs +++ b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Platforms/DotNetCorePlatformAccessor.cs @@ -1,4 +1,5 @@ -using System; +#if DOTNET_CORE +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -213,3 +214,5 @@ public override string GetPlatformNamePrefix() } } } + +#endif diff --git a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Platforms/PlatformAccessorBase.cs b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Platforms/PlatformAccessorBase.cs index 68a55423..f09c7cc5 100755 --- a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Platforms/PlatformAccessorBase.cs +++ b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Platforms/PlatformAccessorBase.cs @@ -29,19 +29,14 @@ public string GetPlatformName() { if (PlatformAutoDetector.IsUnityNative) { - if (PlatformAutoDetector.IsUnityIL2CPP) - suffix = "unity5.il2cpp"; - else if (PlatformAutoDetector.IsRunningOnMono) - suffix = "unity5.mono"; - else - suffix = "unity5.webp"; + suffix = "unity." + GetUnityPlatformName().ToLower() + "." + GetUnityRuntimeName(); } else { if (PlatformAutoDetector.IsRunningOnMono) suffix = "unity.dll.mono"; else - suffix = "unity.dll.webp"; + suffix = "unity.dll.unknown"; } } else if (PlatformAutoDetector.IsRunningOnMono) @@ -57,12 +52,82 @@ public string GetPlatformName() else suffix = suffix + ".clr2"; +#if DOTNET_CORE + suffix += ".netcore"; +#endif + if (PlatformAutoDetector.IsRunningOnAOT) suffix = suffix + ".aot"; return GetPlatformNamePrefix() + "." + suffix; } + private string GetUnityRuntimeName() + { +#if ENABLE_MONO + return "mono"; +#elif ENABLE_IL2CPP + return "il2cpp"; +#elif ENABLE_DOTNET + return "dotnet"; +#else + return "unknown"; +#endif + } + + private string GetUnityPlatformName() + { +#if UNITY_STANDALONE_OSX + return "OSX"; +#elif UNITY_STANDALONE_WIN + return "WIN"; +#elif UNITY_STANDALONE_LINUX + return "LINUX"; +#elif UNITY_STANDALONE + return "STANDALONE"; +#elif UNITY_WII + return "WII"; +#elif UNITY_IOS + return "IOS"; +#elif UNITY_IPHONE + return "IPHONE"; +#elif UNITY_ANDROID + return "ANDROID"; +#elif UNITY_PS3 + return "PS3"; +#elif UNITY_PS4 + return "PS4"; +#elif UNITY_SAMSUNGTV + return "SAMSUNGTV"; +#elif UNITY_XBOX360 + return "XBOX360"; +#elif UNITY_XBOXONE + return "XBOXONE"; +#elif UNITY_TIZEN + return "TIZEN"; +#elif UNITY_TVOS + return "TVOS"; +#elif UNITY_WP_8_1 + return "WP_8_1"; +#elif UNITY_WSA_10_0 + return "WSA_10_0"; +#elif UNITY_WSA_8_1 + return "WSA_8_1"; +#elif UNITY_WSA + return "WSA"; +#elif UNITY_WINRT_10_0 + return "WINRT_10_0"; +#elif UNITY_WINRT_8_1 + return "WINRT_8_1"; +#elif UNITY_WINRT + return "WINRT"; +#elif UNITY_WEBGL + return "WEBGL"; +#else + return "UNKNOWNHW"; +#endif + } + /// /// Default handler for 'print' calls. Can be customized in ScriptOptions /// diff --git a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Script.cs b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Script.cs index 49d494cf..6e3bb11a 100755 --- a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Script.cs +++ b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Script.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text; using MoonSharp.Interpreter.CoreLib; using MoonSharp.Interpreter.Debugging; using MoonSharp.Interpreter.Diagnostics; @@ -726,6 +727,19 @@ public Table Registry private set; } + /// + /// Gets a banner string with copyright info, link to website, version, etc. + /// + public static string GetBanner(string subproduct = null) + { + subproduct = (subproduct != null) ? (subproduct + " ") : ""; + + StringBuilder sb = new StringBuilder(); + sb.AppendLine(string.Format("MoonSharp {0}{1} [{2}]", subproduct, Script.VERSION, Script.GlobalOptions.Platform.GetPlatformName())); + sb.AppendLine("Copyright (C) 2014-2016 Marco Mastropaolo"); + sb.AppendLine("http://www.moonsharp.org"); + return sb.ToString(); + } Script IScriptPrivateResource.OwnerScript { diff --git a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Serialization/ObjectValueConverter.cs b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Serialization/ObjectValueConverter.cs index 535fd703..62263403 100755 --- a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Serialization/ObjectValueConverter.cs +++ b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/Serialization/ObjectValueConverter.cs @@ -40,7 +40,7 @@ public static DynValue SerializeObjectToDynValue(Script script, object o, DynVal foreach (PropertyInfo pi in Framework.Do.GetProperties(type)) { - var getter = pi.GetGetMethod(); + var getter = Framework.Do.GetGetMethod(pi); var isStatic = getter.IsStatic; var obj = getter.Invoke(isStatic ? null : o, null); // convoluted workaround for --full-aot Mono execution diff --git a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.portable40/MoonSharp.Interpreter.portable40.csproj b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.portable40/MoonSharp.Interpreter.portable40.csproj index 9711305c..7b90244d 100644 --- a/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.portable40/MoonSharp.Interpreter.portable40.csproj +++ b/src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.portable40/MoonSharp.Interpreter.portable40.csproj @@ -85,6 +85,9 @@ FrameworkPCL.cs + + FrameworkWin8.cs + CoroutineModule.cs @@ -570,6 +573,9 @@ ColonOperatorBehaviour.cs + + DotNetCorePlatformAccessor.cs + ReplHistoryNavigator.cs diff --git a/src/MoonSharp/Program.cs b/src/MoonSharp/Program.cs old mode 100644 new mode 100755 index 3b3d9e35..24d52ffd --- a/src/MoonSharp/Program.cs +++ b/src/MoonSharp/Program.cs @@ -90,9 +90,7 @@ private static void InterpreterLoop(ReplInterpreter interpreter, ShellContext sh private static void Banner() { - Console.WriteLine("MoonSharp Console {0} [{1}]", Script.VERSION, Script.GlobalOptions.Platform.GetPlatformName()); - Console.WriteLine("Copyright (C) 2014-2016 Marco Mastropaolo"); - Console.WriteLine("http://www.moonsharp.org"); + Console.WriteLine(Script.GetBanner("Console")); Console.WriteLine(); Console.WriteLine("Type Lua code to execute it or type !help to see help on commands.\n"); Console.WriteLine("Welcome.\n"); diff --git a/src/TestRunners/DotNetCoreTestRunner/Program.cs b/src/TestRunners/DotNetCoreTestRunner/Program.cs index 68844068..168f4164 100755 --- a/src/TestRunners/DotNetCoreTestRunner/Program.cs +++ b/src/TestRunners/DotNetCoreTestRunner/Program.cs @@ -13,6 +13,7 @@ using System.IO; using MoonSharp.Interpreter; using MoonSharp.Interpreter.Serialization; +using MoonSharp.VsCodeDebugger; namespace DotNetCoreTestRunner { @@ -99,9 +100,41 @@ class Program //"VInterop_ConstructorAndConcatMethodSemicolon_Precomputed", }; + static int Main(string[] args) + { + Console.WriteLine("1 - Unit tests"); + Console.WriteLine("2 - Debugger"); + + while (true) + { + Console.Write(" ? "); + var key = Console.ReadKey(); + if (key.Key == ConsoleKey.D1) + TestMain(args); + else if (key.Key == ConsoleKey.D2) + DebuggerMain(args); + } + } + private static void DebuggerMain(string[] args) + { + MoonSharpVsCodeDebugServer server = new MoonSharpVsCodeDebugServer().Start(); + Script s = new Script(); - static int Main(string[] args) + server.AttachToScript(s, "xxx"); + + DynValue func = s.DoString("return function()\nprint 'x';\nend;"); + + while (!Console.KeyAvailable) + { + func.Function.Call(); + System.Threading.Tasks.Task.Delay(100).Wait(); + } + + Console.ReadKey(); + } + + static int TestMain(string[] args) { Console.ForegroundColor = ConsoleColor.Magenta; diff --git a/src/TestRunners/DotNetCoreTestRunner/src/EndToEnd/UserDataOverloadsTests.cs b/src/TestRunners/DotNetCoreTestRunner/src/EndToEnd/UserDataOverloadsTests.cs index e37d0b44..d55b5b9e 100755 --- a/src/TestRunners/DotNetCoreTestRunner/src/EndToEnd/UserDataOverloadsTests.cs +++ b/src/TestRunners/DotNetCoreTestRunner/src/EndToEnd/UserDataOverloadsTests.cs @@ -3,6 +3,7 @@ using System.IO; using System.Linq; using System.Text; +using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Interop; using MoonSharp.Interpreter.Loaders; using NUnit.Framework; @@ -298,8 +299,8 @@ public void OverloadTest_WithoutObjects() var ov = new OverloadedMethodMemberDescriptor("Method1", this.GetType()); // Iterate over the two methods through reflection - foreach(var method in this.GetType().GetMethods(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance) - .Where(mi => mi.Name == "Method1")) + foreach(var method in Framework.Do.GetMethods(this.GetType()) + .Where(mi => mi.Name == "Method1" && mi.IsPrivate && !mi.IsStatic)) { ov.AddOverload(new MethodMemberDescriptor(method)); } diff --git a/src/TestRunners/DotNetCoreTestRunner/src/TestRunner.cs b/src/TestRunners/DotNetCoreTestRunner/src/TestRunner.cs index 551712a7..82894da6 100755 --- a/src/TestRunners/DotNetCoreTestRunner/src/TestRunner.cs +++ b/src/TestRunners/DotNetCoreTestRunner/src/TestRunner.cs @@ -74,7 +74,7 @@ public IEnumerable IterateOnTests(string whichTest = null, string[] foreach (Type t in types) { - MethodInfo[] tests = t.GetMethods().Where(m => m.GetCustomAttributes(typeof(TestAttribute), true).Any()).ToArray(); + MethodInfo[] tests = Framework.Do.GetMethods(t).Where(m => m.GetCustomAttributes(typeof(TestAttribute), true).Any()).ToArray(); //Console_WriteLine("Testing {0} - {1} tests found.", t.Name, tests.Length); foreach (MethodInfo mi in tests) @@ -181,7 +181,7 @@ private static TestResult RunTest(Type t, MethodInfo mi) }; } - if (expectedEx != null && expectedEx.ExpectedException.IsInstanceOfType(ex)) + if (expectedEx != null && Framework.Do.IsInstanceOfType(expectedEx.ExpectedException, ex)) { return new TestResult() { diff --git a/src/Unity/MoonSharp/Assembly-CSharp-firstpass.csproj b/src/Unity/MoonSharp/Assembly-CSharp-firstpass.csproj index 00201fd1..be0f4a14 100644 --- a/src/Unity/MoonSharp/Assembly-CSharp-firstpass.csproj +++ b/src/Unity/MoonSharp/Assembly-CSharp-firstpass.csproj @@ -19,7 +19,7 @@ full false Temp\bin\Debug\ - DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_3_4;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;ENABLE_RUNTIME_GI;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_NETWORK;ENABLE_LOG_MIXED_STACKTRACE;ENABLE_UNITYWEBREQUEST;ENABLE_TEXTUREID_MAP;PLAYERCONNECTION_LISTENS_FIXED_PORT;DEBUGGER_LISTENS_FIXED_PORT;PLATFORM_SUPPORTS_ADS_ID;SUPPORT_ENVIRONMENT_VARIABLES;PLATFORM_SUPPORTS_PROFILER;PLATFORM_HAS_NO_SUPPORT_FOR_BUCKET_ALLOCATOR;STRICTCPP_NEW_DELETE_SIGNATURES;WWW_USE_CURL;HAS_NEON_SKINNIG;UNITY_INPUT_SIMULATE_EVENTS;PLATFORM_ALWAYS_USES_STDOUT_FOR_LOG;ENABLE_UNITYADS_RUNTIME;UNITY_UNITYADS_API;UNITY_IOS;UNITY_IPHONE;UNITY_IPHONE_API;SUPPORT_MULTIPLE_DISPLAYS;ENABLE_IL2CPP;DEVELOPMENT_BUILD;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX;UNITY_TEAM_LICENSE;UNITY_PRO_LICENSE;ENABLE_IOS_ON_DEMAND_RESOURCES;ENABLE_IOS_APP_SLICING + DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_3_4;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_LOG_MIXED_STACKTRACE;ENABLE_UNITYWEBREQUEST;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;DEVELOPMENT_BUILD;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX;UNITY_TEAM_LICENSE;UNITY_PRO_LICENSE prompt 4 0169 @@ -56,6 +56,16 @@ + + + + + + + + + + @@ -207,7 +217,6 @@ - @@ -222,7 +231,6 @@ - @@ -240,15 +248,11 @@ + - - - - - diff --git a/src/Unity/MoonSharp/Assembly-CSharp.csproj b/src/Unity/MoonSharp/Assembly-CSharp.csproj index c96ba0e4..42a4bdf5 100644 --- a/src/Unity/MoonSharp/Assembly-CSharp.csproj +++ b/src/Unity/MoonSharp/Assembly-CSharp.csproj @@ -19,7 +19,7 @@ full false Temp\bin\Debug\ - DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_3_4;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;ENABLE_RUNTIME_GI;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_NETWORK;ENABLE_LOG_MIXED_STACKTRACE;ENABLE_UNITYWEBREQUEST;ENABLE_TEXTUREID_MAP;PLAYERCONNECTION_LISTENS_FIXED_PORT;DEBUGGER_LISTENS_FIXED_PORT;PLATFORM_SUPPORTS_ADS_ID;SUPPORT_ENVIRONMENT_VARIABLES;PLATFORM_SUPPORTS_PROFILER;PLATFORM_HAS_NO_SUPPORT_FOR_BUCKET_ALLOCATOR;STRICTCPP_NEW_DELETE_SIGNATURES;WWW_USE_CURL;HAS_NEON_SKINNIG;UNITY_INPUT_SIMULATE_EVENTS;PLATFORM_ALWAYS_USES_STDOUT_FOR_LOG;ENABLE_UNITYADS_RUNTIME;UNITY_UNITYADS_API;UNITY_IOS;UNITY_IPHONE;UNITY_IPHONE_API;SUPPORT_MULTIPLE_DISPLAYS;ENABLE_IL2CPP;DEVELOPMENT_BUILD;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX;UNITY_TEAM_LICENSE;UNITY_PRO_LICENSE;ENABLE_IOS_ON_DEMAND_RESOURCES;ENABLE_IOS_APP_SLICING + DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_3_4;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_LOG_MIXED_STACKTRACE;ENABLE_UNITYWEBREQUEST;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;DEVELOPMENT_BUILD;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX;UNITY_TEAM_LICENSE;UNITY_PRO_LICENSE prompt 4 0169 diff --git a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/Base/FrameworkClrBase.cs b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/Base/FrameworkClrBase.cs index 434f9908..1391755b 100755 --- a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/Base/FrameworkClrBase.cs +++ b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/Base/FrameworkClrBase.cs @@ -1,4 +1,4 @@ -#if !(DOTNET_CORE || NETFX_CORE) +#if !NETFX_CORE || DOTNET_CORE using System; using System.Collections.Generic; @@ -13,11 +13,6 @@ abstract class FrameworkClrBase : FrameworkReflectionBase BindingFlags BINDINGFLAGS_MEMBER = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static; BindingFlags BINDINGFLAGS_INNERCLASS = BindingFlags.Public | BindingFlags.NonPublic; - public override Type GetTypeInfoFromType(Type t) - { - return t; - } - public override MethodInfo GetAddMethod(EventInfo ei) { return ei.GetAddMethod(true); @@ -25,84 +20,84 @@ public override MethodInfo GetAddMethod(EventInfo ei) public override ConstructorInfo[] GetConstructors(Type type) { - return type.GetConstructors(BINDINGFLAGS_MEMBER); + return GetTypeInfoFromType(type).GetConstructors(BINDINGFLAGS_MEMBER); } public override EventInfo[] GetEvents(Type type) { - return type.GetEvents(BINDINGFLAGS_MEMBER); + return GetTypeInfoFromType(type).GetEvents(BINDINGFLAGS_MEMBER); } public override FieldInfo[] GetFields(Type type) { - return type.GetFields(BINDINGFLAGS_MEMBER); + return GetTypeInfoFromType(type).GetFields(BINDINGFLAGS_MEMBER); } public override Type[] GetGenericArguments(Type type) { - return type.GetGenericArguments(); + return GetTypeInfoFromType(type).GetGenericArguments(); } public override MethodInfo GetGetMethod(PropertyInfo pi) { - return pi.GetGetMethod(); + return pi.GetGetMethod(true); } public override Type[] GetInterfaces(Type t) { - return t.GetInterfaces(); + return GetTypeInfoFromType(t).GetInterfaces(); } public override MethodInfo GetMethod(Type type, string name) { - return type.GetMethod(name); + return GetTypeInfoFromType(type).GetMethod(name); } public override MethodInfo[] GetMethods(Type type) { - return type.GetMethods(BINDINGFLAGS_MEMBER); + return GetTypeInfoFromType(type).GetMethods(BINDINGFLAGS_MEMBER); } public override Type[] GetNestedTypes(Type type) { - return type.GetNestedTypes(BINDINGFLAGS_INNERCLASS); + return GetTypeInfoFromType(type).GetNestedTypes(BINDINGFLAGS_INNERCLASS); } public override PropertyInfo[] GetProperties(Type type) { - return type.GetProperties(BINDINGFLAGS_MEMBER); + return GetTypeInfoFromType(type).GetProperties(BINDINGFLAGS_MEMBER); } public override PropertyInfo GetProperty(Type type, string name) { - return type.GetProperty(name); + return GetTypeInfoFromType(type).GetProperty(name); } public override MethodInfo GetRemoveMethod(EventInfo ei) { - return ei.GetRemoveMethod(); + return ei.GetRemoveMethod(true); } public override MethodInfo GetSetMethod(PropertyInfo pi) { - return pi.GetSetMethod(); + return pi.GetSetMethod(true); } public override bool IsAssignableFrom(Type current, Type toCompare) { - return current.IsAssignableFrom(toCompare); + return GetTypeInfoFromType(current).IsAssignableFrom(toCompare); } public override bool IsInstanceOfType(Type t, object o) { - return t.IsInstanceOfType(o); + return GetTypeInfoFromType(t).IsInstanceOfType(o); } public override MethodInfo GetMethod(Type resourcesType, string name, Type[] types) { - return resourcesType.GetMethod(name, types); + return GetTypeInfoFromType(resourcesType).GetMethod(name, types); } public override Type[] GetAssemblyTypes(Assembly asm) diff --git a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/Base/FrameworkReflectionBase.cs b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/Base/FrameworkReflectionBase.cs index 47849c83..10913658 100755 --- a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/Base/FrameworkReflectionBase.cs +++ b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/Base/FrameworkReflectionBase.cs @@ -4,7 +4,9 @@ using System.Reflection; using System.Text; -#if DOTNET_CORE || NETFX_CORE +#if DOTNET_CORE + using TTypeInfo = System.Reflection.TypeInfo; +#elif NETFX_CORE using TTypeInfo = System.Reflection.TypeInfo; #else using TTypeInfo = System.Type; diff --git a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkCLR.cs b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkCLR.cs index e1bc4f2c..a362eb02 100755 --- a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkCLR.cs +++ b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkCLR.cs @@ -10,6 +10,11 @@ namespace MoonSharp.Interpreter.Compatibility.Frameworks { class FrameworkCurrent : FrameworkClrBase { + public override Type GetTypeInfoFromType(Type t) + { + return t; + } + public override bool IsDbNull(object o) { return o != null && Convert.IsDBNull(o); diff --git a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkCore.cs b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkCore.cs index 37f26790..c8c0b39a 100755 --- a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkCore.cs +++ b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkCore.cs @@ -1,4 +1,4 @@ -#if DOTNET_CORE || NETFX_CORE +#if DOTNET_CORE using System; using System.Collections.Generic; @@ -8,98 +8,16 @@ namespace MoonSharp.Interpreter.Compatibility.Frameworks { - class FrameworkCurrent : FrameworkReflectionBase + class FrameworkCurrent : FrameworkClrBase { - public override TypeInfo GetTypeInfoFromType(Type t) - { - return t.GetTypeInfo(); - } - - private T[] SafeArray(IEnumerable prop) - { - return prop != null ? prop.ToArray() : new T[0]; - } - - public override MethodInfo GetAddMethod(EventInfo ei) - { - return ei.AddMethod; - } - - public override ConstructorInfo[] GetConstructors(Type type) - { - return SafeArray(GetTypeInfoFromType(type).DeclaredConstructors); - } - - public override EventInfo[] GetEvents(Type type) - { - return SafeArray(GetTypeInfoFromType(type).DeclaredEvents); - } - - public override FieldInfo[] GetFields(Type type) - { - return SafeArray(GetTypeInfoFromType(type).DeclaredFields); - } - - public override Type[] GetGenericArguments(Type type) - { - return type.GetTypeInfo().GetGenericArguments(); - } - - public override MethodInfo GetGetMethod(PropertyInfo pi) - { - return pi.GetGetMethod(); - } - public override Type GetInterface(Type type, string name) { - return GetTypeInfoFromType(type).GetInterface(name); - } - - public override Type[] GetInterfaces(Type t) - { - return GetTypeInfoFromType(t).GetInterfaces(); - } - - - public override MethodInfo GetMethod(Type type, string name) - { - return GetTypeInfoFromType(type).GetMethod(name); - } - - public override MethodInfo[] GetMethods(Type type) - { - return SafeArray(GetTypeInfoFromType(type).DeclaredMethods); - } - - public override Type[] GetNestedTypes(Type type) - { - return SafeArray(GetTypeInfoFromType(type).DeclaredNestedTypes.Select(ti => ti.AsType())); - } - - public override PropertyInfo[] GetProperties(Type type) - { - return SafeArray(GetTypeInfoFromType(type).DeclaredProperties); - } - - public override PropertyInfo GetProperty(Type type, string name) - { - return GetTypeInfoFromType(type).GetProperty(name); - } - - public override MethodInfo GetRemoveMethod(EventInfo ei) - { - return ei.RemoveMethod; + return type.GetTypeInfo().GetInterface(name); } - public override MethodInfo GetSetMethod(PropertyInfo pi) - { - return pi.SetMethod; - } - - - public override bool IsAssignableFrom(Type current, Type toCompare) + public override TypeInfo GetTypeInfoFromType(Type t) { - return current.GetTypeInfo().IsAssignableFrom(toCompare.GetTypeInfo()); + return t.GetTypeInfo(); } public override bool IsDbNull(object o) @@ -107,26 +25,10 @@ public override bool IsDbNull(object o) return o != null && o.GetType().FullName.StartsWith("System.DBNull"); } - public override bool IsInstanceOfType(Type t, object o) - { - return t.GetTypeInfo().IsInstanceOfType(o); - } - public override bool StringContainsChar(string str, char chr) { return str.Contains(chr); } - - public override MethodInfo GetMethod(Type resourcesType, string name, Type[] types) - { - return resourcesType.GetTypeInfo().GetMethod(name, types); - } - - public override Type[] GetAssemblyTypes(Assembly asm) - { - return asm.GetExportedTypes(); - } - } } #endif diff --git a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkPCL.cs b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkPCL.cs index 85035012..c3bcc58b 100755 --- a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkPCL.cs +++ b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkPCL.cs @@ -9,6 +9,11 @@ namespace MoonSharp.Interpreter.Compatibility.Frameworks { class FrameworkCurrent : FrameworkClrBase { + public override Type GetTypeInfoFromType(Type t) + { + return t; + } + public override bool IsDbNull(object o) { return o != null && o.GetType().FullName.StartsWith("System.DBNull"); diff --git a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkWin8.cs b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkWin8.cs new file mode 100755 index 00000000..7fd903b2 --- /dev/null +++ b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Compatibility/Frameworks/FrameworkWin8.cs @@ -0,0 +1,134 @@ +#if NETFX_CORE && !DOTNET_CORE + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; + +namespace MoonSharp.Interpreter.Compatibility.Frameworks +{ + class FrameworkCurrent : FrameworkReflectionBase + { + public override TypeInfo GetTypeInfoFromType(Type t) + { + return t.GetTypeInfo(); + } + + private T[] SafeArray(IEnumerable prop) + { + return prop != null ? prop.ToArray() : new T[0]; + } + + public override MethodInfo GetAddMethod(EventInfo ei) + { + return ei.AddMethod; + } + + public override ConstructorInfo[] GetConstructors(Type type) + { + return SafeArray(GetTypeInfoFromType(type).DeclaredConstructors); + } + + public override EventInfo[] GetEvents(Type type) + { + return SafeArray(type.GetRuntimeEvents()); + } + + public override FieldInfo[] GetFields(Type type) + { + return SafeArray(type.GetRuntimeFields()); + } + + public override Type[] GetGenericArguments(Type type) + { + return type.GetTypeInfo().GenericTypeArguments; + } + + public override MethodInfo GetGetMethod(PropertyInfo pi) + { + return pi.GetMethod; + } + + public override Type GetInterface(Type type, string name) + { + return type.GetTypeInfo().ImplementedInterfaces.FirstOrDefault(t => t.Name == name); + } + + public override Type[] GetInterfaces(Type t) + { + return SafeArray(GetTypeInfoFromType(t).ImplementedInterfaces); + } + + public override MethodInfo GetMethod(Type type, string name) + { + return type.GetRuntimeMethods().FirstOrDefault(mi => mi.Name == name); + } + + public override MethodInfo[] GetMethods(Type type) + { + return SafeArray(type.GetRuntimeMethods()); + } + + public override Type[] GetNestedTypes(Type type) + { + return SafeArray(GetTypeInfoFromType(type).DeclaredNestedTypes.Select(ti => ti.AsType())); + } + + public override PropertyInfo[] GetProperties(Type type) + { + return SafeArray(type.GetRuntimeProperties()); + } + + public override PropertyInfo GetProperty(Type type, string name) + { + return type.GetRuntimeProperty(name); + } + + public override MethodInfo GetRemoveMethod(EventInfo ei) + { + return ei.RemoveMethod; + } + + public override MethodInfo GetSetMethod(PropertyInfo pi) + { + return pi.SetMethod; + } + + + public override bool IsAssignableFrom(Type current, Type toCompare) + { + return current.GetTypeInfo().IsAssignableFrom(toCompare.GetTypeInfo()); + } + + public override bool IsDbNull(object o) + { + return o != null && o.GetType().FullName.StartsWith("System.DBNull"); + } + + public override bool IsInstanceOfType(Type t, object o) + { + if (o == null) + return false; + + return t.GetTypeInfo().IsAssignableFrom(o.GetType().GetTypeInfo()); + } + + public override bool StringContainsChar(string str, char chr) + { + return str.Contains(chr); + } + + public override MethodInfo GetMethod(Type resourcesType, string name, Type[] types) + { + return resourcesType.GetRuntimeMethod(name, types); + } + + public override Type[] GetAssemblyTypes(Assembly asm) + { + return SafeArray(asm.DefinedTypes.Select(ti => ti.AsType())); + } + + } +} +#endif diff --git a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Interop/DescriptorHelpers.cs b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Interop/DescriptorHelpers.cs index a9541c62..9bf7c402 100755 --- a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Interop/DescriptorHelpers.cs +++ b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Interop/DescriptorHelpers.cs @@ -94,8 +94,8 @@ public static string GetClrVisibility(this FieldInfo info) /// public static string GetClrVisibility(this PropertyInfo info) { - MethodInfo gm = info.GetGetMethod(true); - MethodInfo sm = info.GetSetMethod(true); + MethodInfo gm = Framework.Do.GetGetMethod(info); + MethodInfo sm = Framework.Do.GetSetMethod(info); string gv = (gm != null) ? GetClrVisibility(gm) : "private"; string sv = (sm != null) ? GetClrVisibility(sm) : "private"; @@ -137,8 +137,8 @@ public static string GetClrVisibility(this MethodBase info) /// public static bool IsPropertyInfoPublic(this PropertyInfo pi) { - MethodInfo getter = pi.GetGetMethod(); - MethodInfo setter = pi.GetSetMethod(); + MethodInfo getter = Framework.Do.GetGetMethod(pi); + MethodInfo setter = Framework.Do.GetSetMethod(pi); return (getter != null && getter.IsPublic) || (setter != null && setter.IsPublic); } @@ -166,11 +166,7 @@ public static Type[] SafeGetTypes(this Assembly asm) { try { -#if NETFX_CORE - return asm.GetExportedTypes(); -#else - return asm.GetTypes(); -#endif + return Framework.Do.GetAssemblyTypes(asm); } catch (ReflectionTypeLoadException) { diff --git a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Interop/PropertyTableAssigner.cs b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Interop/PropertyTableAssigner.cs index 2fa0ea35..a6aed2fd 100644 --- a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Interop/PropertyTableAssigner.cs +++ b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Interop/PropertyTableAssigner.cs @@ -170,7 +170,7 @@ private bool TryAssignProperty(object obj, string name, DynValue value) pi.PropertyType, null, false); } - pi.GetSetMethod(true).Invoke(obj, new object[] { o }); + Framework.Do.GetSetMethod(pi).Invoke(obj, new object[] { o }); } return true; diff --git a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/EventMemberDescriptor.cs b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/EventMemberDescriptor.cs index 3a709640..3a19cbe5 100755 --- a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/EventMemberDescriptor.cs +++ b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/EventMemberDescriptor.cs @@ -37,8 +37,8 @@ public static EventMemberDescriptor TryCreateIfVisible(EventInfo ei, InteropAcce if (!CheckEventIsCompatible(ei, false)) return null; - MethodInfo addm = ei.GetAddMethod(); - MethodInfo remm = ei.GetRemoveMethod(); + MethodInfo addm = Framework.Do.GetAddMethod(ei); + MethodInfo remm = Framework.Do.GetRemoveMethod(ei); if (ei.GetVisibilityFromAttributes() ?? ((remm != null && remm.IsPublic) && (addm != null && addm.IsPublic))) return new EventMemberDescriptor(ei, accessMode); @@ -77,7 +77,7 @@ public static bool CheckEventIsCompatible(EventInfo ei, bool throwException) return false; } - if ((ei.GetAddMethod(true) == null) || (ei.GetRemoveMethod(true) == null)) + if ((Framework.Do.GetAddMethod(ei) == null) || (Framework.Do.GetRemoveMethod(ei) == null)) { if (throwException) throw new ArgumentException("Event must have add and remove methods"); return false; @@ -135,8 +135,8 @@ public EventMemberDescriptor(EventInfo ei, InteropAccessMode accessMode = Intero { CheckEventIsCompatible(ei, true); EventInfo = ei; - m_Add = ei.GetAddMethod(true); - m_Remove = ei.GetRemoveMethod(true); + m_Add = Framework.Do.GetAddMethod(ei); + m_Remove = Framework.Do.GetRemoveMethod(ei); IsStatic = m_Add.IsStatic; } diff --git a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/PropertyMemberDescriptor.cs b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/PropertyMemberDescriptor.cs index 03c5e05e..618ee3cc 100644 --- a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/PropertyMemberDescriptor.cs +++ b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/PropertyMemberDescriptor.cs @@ -61,8 +61,8 @@ public class PropertyMemberDescriptor : IMemberDescriptor, IOptimizableDescripto /// A new StandardUserDataPropertyDescriptor or null. public static PropertyMemberDescriptor TryCreateIfVisible(PropertyInfo pi, InteropAccessMode accessMode) { - MethodInfo getter = pi.GetGetMethod(true); - MethodInfo setter = pi.GetSetMethod(true); + MethodInfo getter = Framework.Do.GetGetMethod(pi); + MethodInfo setter = Framework.Do.GetSetMethod(pi); bool? pvisible = pi.GetVisibilityFromAttributes(); bool? gvisible = getter.GetVisibilityFromAttributes(); @@ -99,7 +99,7 @@ private static PropertyMemberDescriptor TryCreate(PropertyInfo pi, InteropAccess /// The pi. /// The access mode. public PropertyMemberDescriptor(PropertyInfo pi, InteropAccessMode accessMode) - : this(pi, accessMode, pi.GetGetMethod(), pi.GetSetMethod()) + : this(pi, accessMode, Framework.Do.GetGetMethod(pi), Framework.Do.GetSetMethod(pi)) { } @@ -194,7 +194,7 @@ internal void OptimizeSetter() { if (m_Setter != null && !(Framework.Do.IsValueType(PropertyInfo.DeclaringType))) { - MethodInfo setterMethod = PropertyInfo.GetSetMethod(true); + MethodInfo setterMethod = Framework.Do.GetSetMethod(PropertyInfo); if (IsStatic) { diff --git a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Loaders/FileSystemScriptLoader.cs b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Loaders/FileSystemScriptLoader.cs index 4d8fa7f8..77e69eea 100755 --- a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Loaders/FileSystemScriptLoader.cs +++ b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Loaders/FileSystemScriptLoader.cs @@ -1,4 +1,4 @@ -#if (!(PCL || ENABLE_DOTNET) && !DOTNET_CORE) +#if DOTNET_CORE || (!(PCL || ENABLE_DOTNET || NETFX_CORE)) using System.IO; namespace MoonSharp.Interpreter.Loaders diff --git a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Loaders/UnityAssetsScriptLoader.cs b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Loaders/UnityAssetsScriptLoader.cs index 945bdf36..7db23081 100755 --- a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Loaders/UnityAssetsScriptLoader.cs +++ b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Loaders/UnityAssetsScriptLoader.cs @@ -80,8 +80,8 @@ void LoadResourcesWithReflection(string assetsPath) Type resourcesType = Type.GetType("UnityEngine.Resources, UnityEngine"); Type textAssetType = Type.GetType("UnityEngine.TextAsset, UnityEngine"); - MethodInfo textAssetNameGet = Framework.Do.GetProperty(textAssetType, "name").GetGetMethod(); - MethodInfo textAssetTextGet = Framework.Do.GetProperty(textAssetType, "text").GetGetMethod(); + MethodInfo textAssetNameGet = Framework.Do.GetGetMethod(Framework.Do.GetProperty(textAssetType, "name")); + MethodInfo textAssetTextGet = Framework.Do.GetGetMethod(Framework.Do.GetProperty(textAssetType, "text")); MethodInfo loadAll = Framework.Do.GetMethod(resourcesType, "LoadAll", new Type[] { typeof(string), typeof(Type) }); diff --git a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Modules/ModuleRegister.cs b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Modules/ModuleRegister.cs index 41857949..f2993260 100755 --- a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Modules/ModuleRegister.cs +++ b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Modules/ModuleRegister.cs @@ -68,6 +68,7 @@ public static Table RegisterConstants(this Table table) m.Set("is_mono", DynValue.NewBoolean(PlatformAutoDetector.IsRunningOnMono)); m.Set("is_clr4", DynValue.NewBoolean(PlatformAutoDetector.IsRunningOnClr4)); m.Set("is_pcl", DynValue.NewBoolean(PlatformAutoDetector.IsPortableFramework)); + m.Set("banner", DynValue.NewString(Script.GetBanner())); return table; } diff --git a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Platforms/DotNetCorePlatformAccessor.cs b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Platforms/DotNetCorePlatformAccessor.cs index e4e2dc08..2671fac8 100755 --- a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Platforms/DotNetCorePlatformAccessor.cs +++ b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Platforms/DotNetCorePlatformAccessor.cs @@ -1,4 +1,5 @@ -using System; +#if DOTNET_CORE +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -213,3 +214,5 @@ public override string GetPlatformNamePrefix() } } } + +#endif diff --git a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Platforms/PlatformAccessorBase.cs b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Platforms/PlatformAccessorBase.cs index 68a55423..f09c7cc5 100755 --- a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Platforms/PlatformAccessorBase.cs +++ b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Platforms/PlatformAccessorBase.cs @@ -29,19 +29,14 @@ public string GetPlatformName() { if (PlatformAutoDetector.IsUnityNative) { - if (PlatformAutoDetector.IsUnityIL2CPP) - suffix = "unity5.il2cpp"; - else if (PlatformAutoDetector.IsRunningOnMono) - suffix = "unity5.mono"; - else - suffix = "unity5.webp"; + suffix = "unity." + GetUnityPlatformName().ToLower() + "." + GetUnityRuntimeName(); } else { if (PlatformAutoDetector.IsRunningOnMono) suffix = "unity.dll.mono"; else - suffix = "unity.dll.webp"; + suffix = "unity.dll.unknown"; } } else if (PlatformAutoDetector.IsRunningOnMono) @@ -57,12 +52,82 @@ public string GetPlatformName() else suffix = suffix + ".clr2"; +#if DOTNET_CORE + suffix += ".netcore"; +#endif + if (PlatformAutoDetector.IsRunningOnAOT) suffix = suffix + ".aot"; return GetPlatformNamePrefix() + "." + suffix; } + private string GetUnityRuntimeName() + { +#if ENABLE_MONO + return "mono"; +#elif ENABLE_IL2CPP + return "il2cpp"; +#elif ENABLE_DOTNET + return "dotnet"; +#else + return "unknown"; +#endif + } + + private string GetUnityPlatformName() + { +#if UNITY_STANDALONE_OSX + return "OSX"; +#elif UNITY_STANDALONE_WIN + return "WIN"; +#elif UNITY_STANDALONE_LINUX + return "LINUX"; +#elif UNITY_STANDALONE + return "STANDALONE"; +#elif UNITY_WII + return "WII"; +#elif UNITY_IOS + return "IOS"; +#elif UNITY_IPHONE + return "IPHONE"; +#elif UNITY_ANDROID + return "ANDROID"; +#elif UNITY_PS3 + return "PS3"; +#elif UNITY_PS4 + return "PS4"; +#elif UNITY_SAMSUNGTV + return "SAMSUNGTV"; +#elif UNITY_XBOX360 + return "XBOX360"; +#elif UNITY_XBOXONE + return "XBOXONE"; +#elif UNITY_TIZEN + return "TIZEN"; +#elif UNITY_TVOS + return "TVOS"; +#elif UNITY_WP_8_1 + return "WP_8_1"; +#elif UNITY_WSA_10_0 + return "WSA_10_0"; +#elif UNITY_WSA_8_1 + return "WSA_8_1"; +#elif UNITY_WSA + return "WSA"; +#elif UNITY_WINRT_10_0 + return "WINRT_10_0"; +#elif UNITY_WINRT_8_1 + return "WINRT_8_1"; +#elif UNITY_WINRT + return "WINRT"; +#elif UNITY_WEBGL + return "WEBGL"; +#else + return "UNKNOWNHW"; +#endif + } + /// /// Default handler for 'print' calls. Can be customized in ScriptOptions /// diff --git a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Script.cs b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Script.cs index 49d494cf..6e3bb11a 100755 --- a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Script.cs +++ b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Script.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text; using MoonSharp.Interpreter.CoreLib; using MoonSharp.Interpreter.Debugging; using MoonSharp.Interpreter.Diagnostics; @@ -726,6 +727,19 @@ public Table Registry private set; } + /// + /// Gets a banner string with copyright info, link to website, version, etc. + /// + public static string GetBanner(string subproduct = null) + { + subproduct = (subproduct != null) ? (subproduct + " ") : ""; + + StringBuilder sb = new StringBuilder(); + sb.AppendLine(string.Format("MoonSharp {0}{1} [{2}]", subproduct, Script.VERSION, Script.GlobalOptions.Platform.GetPlatformName())); + sb.AppendLine("Copyright (C) 2014-2016 Marco Mastropaolo"); + sb.AppendLine("http://www.moonsharp.org"); + return sb.ToString(); + } Script IScriptPrivateResource.OwnerScript { diff --git a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Serialization/ObjectValueConverter.cs b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Serialization/ObjectValueConverter.cs index 535fd703..62263403 100755 --- a/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Serialization/ObjectValueConverter.cs +++ b/src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Serialization/ObjectValueConverter.cs @@ -40,7 +40,7 @@ public static DynValue SerializeObjectToDynValue(Script script, object o, DynVal foreach (PropertyInfo pi in Framework.Do.GetProperties(type)) { - var getter = pi.GetGetMethod(); + var getter = Framework.Do.GetGetMethod(pi); var isStatic = getter.IsStatic; var obj = getter.Invoke(isStatic ? null : o, null); // convoluted workaround for --full-aot Mono execution diff --git a/src/Unity/MoonSharp/Assets/Tests/EndToEnd/UserDataOverloadsTests.cs b/src/Unity/MoonSharp/Assets/Tests/EndToEnd/UserDataOverloadsTests.cs index e37d0b44..d55b5b9e 100755 --- a/src/Unity/MoonSharp/Assets/Tests/EndToEnd/UserDataOverloadsTests.cs +++ b/src/Unity/MoonSharp/Assets/Tests/EndToEnd/UserDataOverloadsTests.cs @@ -3,6 +3,7 @@ using System.IO; using System.Linq; using System.Text; +using MoonSharp.Interpreter.Compatibility; using MoonSharp.Interpreter.Interop; using MoonSharp.Interpreter.Loaders; using NUnit.Framework; @@ -298,8 +299,8 @@ public void OverloadTest_WithoutObjects() var ov = new OverloadedMethodMemberDescriptor("Method1", this.GetType()); // Iterate over the two methods through reflection - foreach(var method in this.GetType().GetMethods(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance) - .Where(mi => mi.Name == "Method1")) + foreach(var method in Framework.Do.GetMethods(this.GetType()) + .Where(mi => mi.Name == "Method1" && mi.IsPrivate && !mi.IsStatic)) { ov.AddOverload(new MethodMemberDescriptor(method)); } diff --git a/src/Unity/MoonSharp/Assets/Tests/TestRunner.cs b/src/Unity/MoonSharp/Assets/Tests/TestRunner.cs index 551712a7..82894da6 100755 --- a/src/Unity/MoonSharp/Assets/Tests/TestRunner.cs +++ b/src/Unity/MoonSharp/Assets/Tests/TestRunner.cs @@ -74,7 +74,7 @@ public IEnumerable IterateOnTests(string whichTest = null, string[] foreach (Type t in types) { - MethodInfo[] tests = t.GetMethods().Where(m => m.GetCustomAttributes(typeof(TestAttribute), true).Any()).ToArray(); + MethodInfo[] tests = Framework.Do.GetMethods(t).Where(m => m.GetCustomAttributes(typeof(TestAttribute), true).Any()).ToArray(); //Console_WriteLine("Testing {0} - {1} tests found.", t.Name, tests.Length); foreach (MethodInfo mi in tests) @@ -181,7 +181,7 @@ private static TestResult RunTest(Type t, MethodInfo mi) }; } - if (expectedEx != null && expectedEx.ExpectedException.IsInstanceOfType(ex)) + if (expectedEx != null && Framework.Do.IsInstanceOfType(expectedEx.ExpectedException, ex)) { return new TestResult() { diff --git a/src/Unity/MoonSharp/MoonSharp.CSharp.Plugins.csproj b/src/Unity/MoonSharp/MoonSharp.CSharp.Plugins.csproj index 6e8767dd..34b6eab1 100755 --- a/src/Unity/MoonSharp/MoonSharp.CSharp.Plugins.csproj +++ b/src/Unity/MoonSharp/MoonSharp.CSharp.Plugins.csproj @@ -12,10 +12,10 @@ {E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} .NETFramework v3.5 - Unity Full v3.5 + Unity Subset v3.5 GamePlugins:3 - StandaloneWindows:5 + WSAPlayer:21 5.3.4f1 4 @@ -27,7 +27,7 @@ Temp\UnityVS_obj\Debug\ prompt 4 - DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_3_4;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_LOG_MIXED_STACKTRACE;ENABLE_UNITYWEBREQUEST;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;DEVELOPMENT_BUILD;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE + DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_3_4;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;RENDER_SOFTWARE_CURSOR;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;UNITY_METRO;UNITY_METRO_API;UNITY_WINRT;ENABLE_WINRT_PINVOKE;ENABLE_TEXTUREID_MAP;ENABLE_LAZY_METHOD_CACHING;ENABLE_MOVIES;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_EVENT_QUEUE;ENABLE_NETWORK;ENABLE_EVENT_QUEUE;UNITY_PLATFORM_THREAD_TO_CORE_MAPPING;PLATFORM_SUPPORTS_ADS_ID;UNITY_WSA;ENABLE_DOTNET;DEVELOPMENT_BUILD;ENABLE_PROFILER;UNITY_METRO_8_1;UNITY_WSA_8_1;UNITY_WINRT_8_1;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE false @@ -37,7 +37,7 @@ Temp\UnityVS_obj\Release\ prompt 4 - TRACE;UNITY_5_3_OR_NEWER;UNITY_5_3_4;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_LOG_MIXED_STACKTRACE;ENABLE_UNITYWEBREQUEST;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;DEVELOPMENT_BUILD;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE + TRACE;UNITY_5_3_OR_NEWER;UNITY_5_3_4;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;RENDER_SOFTWARE_CURSOR;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;UNITY_METRO;UNITY_METRO_API;UNITY_WINRT;ENABLE_WINRT_PINVOKE;ENABLE_TEXTUREID_MAP;ENABLE_LAZY_METHOD_CACHING;ENABLE_MOVIES;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_EVENT_QUEUE;ENABLE_NETWORK;ENABLE_EVENT_QUEUE;UNITY_PLATFORM_THREAD_TO_CORE_MAPPING;PLATFORM_SUPPORTS_ADS_ID;UNITY_WSA;ENABLE_DOTNET;DEVELOPMENT_BUILD;ENABLE_PROFILER;UNITY_METRO_8_1;UNITY_WSA_8_1;UNITY_WINRT_8_1;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE false @@ -58,6 +58,12 @@ Library\UnityAssemblies\UnityEngine.Networking.dll + + Library\UnityAssemblies\UnityEngine.Networking.dll + + + Library\UnityAssemblies\UnityEngine.UI.dll + Library\UnityAssemblies\UnityEditor.dll @@ -77,6 +83,16 @@ + + + + + + + + + + @@ -228,7 +244,6 @@ - @@ -243,7 +258,6 @@ - @@ -261,15 +275,11 @@ + - - - - - diff --git a/src/Unity/MoonSharp/MoonSharp.CSharp.csproj b/src/Unity/MoonSharp/MoonSharp.CSharp.csproj index 16eb2aa7..c7ef16ef 100755 --- a/src/Unity/MoonSharp/MoonSharp.CSharp.csproj +++ b/src/Unity/MoonSharp/MoonSharp.CSharp.csproj @@ -12,10 +12,10 @@ {E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} .NETFramework v3.5 - Unity Full v3.5 + Unity Subset v3.5 Game:1 - StandaloneWindows:5 + WSAPlayer:21 5.3.4f1 4 @@ -27,7 +27,7 @@ Temp\UnityVS_obj\Debug\ prompt 4 - DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_3_4;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_LOG_MIXED_STACKTRACE;ENABLE_UNITYWEBREQUEST;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;DEVELOPMENT_BUILD;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE + DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_3_4;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;RENDER_SOFTWARE_CURSOR;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;UNITY_METRO;UNITY_METRO_API;UNITY_WINRT;ENABLE_WINRT_PINVOKE;ENABLE_TEXTUREID_MAP;ENABLE_LAZY_METHOD_CACHING;ENABLE_MOVIES;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_EVENT_QUEUE;ENABLE_NETWORK;ENABLE_EVENT_QUEUE;UNITY_PLATFORM_THREAD_TO_CORE_MAPPING;PLATFORM_SUPPORTS_ADS_ID;UNITY_WSA;ENABLE_DOTNET;DEVELOPMENT_BUILD;ENABLE_PROFILER;UNITY_METRO_8_1;UNITY_WSA_8_1;UNITY_WINRT_8_1;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE false @@ -37,7 +37,7 @@ Temp\UnityVS_obj\Release\ prompt 4 - TRACE;UNITY_5_3_OR_NEWER;UNITY_5_3_4;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_LOG_MIXED_STACKTRACE;ENABLE_UNITYWEBREQUEST;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;DEVELOPMENT_BUILD;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE + TRACE;UNITY_5_3_OR_NEWER;UNITY_5_3_4;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;RENDER_SOFTWARE_CURSOR;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;UNITY_METRO;UNITY_METRO_API;UNITY_WINRT;ENABLE_WINRT_PINVOKE;ENABLE_TEXTUREID_MAP;ENABLE_LAZY_METHOD_CACHING;ENABLE_MOVIES;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_EVENT_QUEUE;ENABLE_NETWORK;ENABLE_EVENT_QUEUE;UNITY_PLATFORM_THREAD_TO_CORE_MAPPING;PLATFORM_SUPPORTS_ADS_ID;UNITY_WSA;ENABLE_DOTNET;DEVELOPMENT_BUILD;ENABLE_PROFILER;UNITY_METRO_8_1;UNITY_WSA_8_1;UNITY_WINRT_8_1;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE false @@ -58,6 +58,12 @@ Library\UnityAssemblies\UnityEngine.Networking.dll + + Library\UnityAssemblies\UnityEngine.Networking.dll + + + Library\UnityAssemblies\UnityEngine.UI.dll + Library\UnityAssemblies\UnityEditor.dll diff --git a/src/Unity/MoonSharp/MoonSharp.sln b/src/Unity/MoonSharp/MoonSharp.sln index be32ac7d..db709b43 100644 --- a/src/Unity/MoonSharp/MoonSharp.sln +++ b/src/Unity/MoonSharp/MoonSharp.sln @@ -1,9 +1,9 @@ -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2008 - -Project("{1ACCC170-E783-8189-E4FA-8193200E43CA}") = "MoonSharp", "Assembly-CSharp-firstpass.csproj", "{B06B9CAB-A8C5-2C10-8C77-B62441346B3F}" + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2015 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoonSharp.CSharp.Plugins", "MoonSharp.CSharp.Plugins.csproj", "{1C2B73F2-A0FC-7E19-2CE4-185F6EA021D2}" EndProject -Project("{1ACCC170-E783-8189-E4FA-8193200E43CA}") = "MoonSharp", "Assembly-CSharp.csproj", "{974D1D9B-6B5C-C2E6-EFAB-24E61B3F506C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoonSharp.CSharp", "MoonSharp.CSharp.csproj", "{6912559D-66D3-2D2A-AA98-9B4EBAAAD9EB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,19 +11,16 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B06B9CAB-A8C5-2C10-8C77-B62441346B3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B06B9CAB-A8C5-2C10-8C77-B62441346B3F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B06B9CAB-A8C5-2C10-8C77-B62441346B3F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B06B9CAB-A8C5-2C10-8C77-B62441346B3F}.Release|Any CPU.Build.0 = Release|Any CPU - {974D1D9B-6B5C-C2E6-EFAB-24E61B3F506C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {974D1D9B-6B5C-C2E6-EFAB-24E61B3F506C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {974D1D9B-6B5C-C2E6-EFAB-24E61B3F506C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {974D1D9B-6B5C-C2E6-EFAB-24E61B3F506C}.Release|Any CPU.Build.0 = Release|Any CPU + {1C2B73F2-A0FC-7E19-2CE4-185F6EA021D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1C2B73F2-A0FC-7E19-2CE4-185F6EA021D2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1C2B73F2-A0FC-7E19-2CE4-185F6EA021D2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1C2B73F2-A0FC-7E19-2CE4-185F6EA021D2}.Release|Any CPU.Build.0 = Release|Any CPU + {6912559D-66D3-2D2A-AA98-9B4EBAAAD9EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6912559D-66D3-2D2A-AA98-9B4EBAAAD9EB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6912559D-66D3-2D2A-AA98-9B4EBAAAD9EB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6912559D-66D3-2D2A-AA98-9B4EBAAAD9EB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = Assembly-CSharp.csproj - EndGlobalSection EndGlobal diff --git a/src/Unity/MoonSharp/MoonSharp.userprefs b/src/Unity/MoonSharp/MoonSharp.userprefs index 290c2316..f648a9d1 100644 --- a/src/Unity/MoonSharp/MoonSharp.userprefs +++ b/src/Unity/MoonSharp/MoonSharp.userprefs @@ -1,10 +1,10 @@  - + - - + + diff --git a/src/Unity/MoonSharp/ProjectSettings/GraphicsSettings.asset b/src/Unity/MoonSharp/ProjectSettings/GraphicsSettings.asset old mode 100644 new mode 100755 diff --git a/src/Unity/MoonSharp/ProjectSettings/ProjectSettings.asset b/src/Unity/MoonSharp/ProjectSettings/ProjectSettings.asset old mode 100644 new mode 100755 diff --git a/src/moonsharp_netcore/moonsharp_netcore.sln b/src/moonsharp_netcore/moonsharp_netcore.sln new file mode 100755 index 00000000..03744141 --- /dev/null +++ b/src/moonsharp_netcore/moonsharp_netcore.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "MoonSharp.Interpreter.netcore", "..\MoonSharp.Interpreter\_Projects\MoonSharp.Interpreter.netcore\MoonSharp.Interpreter.netcore.xproj", "{CB2CB168-36C8-4D55-809C-7061CF4F6854}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "MoonSharp.VsCodeDebugger.netcore", "..\MoonSharp.VsCodeDebugger\_Projects\MoonSharp.VsCodeDebugger.netcore\MoonSharp.VsCodeDebugger.netcore.xproj", "{ACA22B1F-7187-4E71-9D27-7196C1374086}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "DotNetCoreTestRunner", "..\TestRunners\DotNetCoreTestRunner\DotNetCoreTestRunner.xproj", "{541C9DCC-3656-459D-AD99-A0CD03D264D6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CB2CB168-36C8-4D55-809C-7061CF4F6854}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CB2CB168-36C8-4D55-809C-7061CF4F6854}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CB2CB168-36C8-4D55-809C-7061CF4F6854}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CB2CB168-36C8-4D55-809C-7061CF4F6854}.Release|Any CPU.Build.0 = Release|Any CPU + {ACA22B1F-7187-4E71-9D27-7196C1374086}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ACA22B1F-7187-4E71-9D27-7196C1374086}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ACA22B1F-7187-4E71-9D27-7196C1374086}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ACA22B1F-7187-4E71-9D27-7196C1374086}.Release|Any CPU.Build.0 = Release|Any CPU + {541C9DCC-3656-459D-AD99-A0CD03D264D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {541C9DCC-3656-459D-AD99-A0CD03D264D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {541C9DCC-3656-459D-AD99-A0CD03D264D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {541C9DCC-3656-459D-AD99-A0CD03D264D6}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/release_readme.txt b/src/release_readme.txt index 06f1807d..4de4bfa1 100644 --- a/src/release_readme.txt +++ b/src/release_readme.txt @@ -15,7 +15,10 @@ Contents: Use this if you want to embed the intepreter in your application with remote debugging enabled. - /repl -> The REPL interpreter. It's not really meant for production as much as to quickly test scripts, - or to compile bytecode. + or to compile bytecode, or for hardwiring. + + - /unity -> This contains a unity package you can use in your project. It includes interpreter and vscodedebugger. + Each directory contains, where applyable, subdirectories for different .NET framework targets: @@ -34,6 +37,14 @@ Use this if you target these platforms. Note that some functionality (involving in this build due to limitations of PCLs. You also have to use this library if you target WSA/WP8 apps in Unity3D. Refer to this guide: http://docs.unity3d.com/Manual/windowsstore-plugins.html +- netcore : +This is a build targeting .NET Core. + +- sources +This contains just the C# sources, with no project files. Import this in any project and you are ready to go. +Stripped sources are available only for the interpreter and vscode debugger. For the other parts, see on github. +Symbols might need to be defined to have it build correctly. Check the sources (you're on your own on this, sorry). + diff --git a/src/rsync_projects.sh b/src/rsync_projects.sh index a9b640ba..1395bd3c 100755 --- a/src/rsync_projects.sh +++ b/src/rsync_projects.sh @@ -32,6 +32,10 @@ rsync -a --prune-empty-dirs --exclude 'AssemblyInfo.cs' --include '*/' --include echo ... Unity - unit tests... rsync -a --prune-empty-dirs --exclude 'AssemblyInfo.cs' --include '*/' --include '*.cs' --exclude '*' /git/my/moonsharp/src/MoonSharp.Interpreter.Tests/ ./Unity/MoonSharp/Assets/Tests +echo ... Unity - cleaning cruft... +rm -R ./Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/_Projects +rm -R ./Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/_Projects + echo ... .NET Core - interpreter rsync -a --prune-empty-dirs --exclude 'AssemblyInfo.cs' --include '*/' --include '*.cs' --exclude '*' /git/my/moonsharp/src/MoonSharp.Interpreter/ ./MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.netcore/src/