Xanathar 10 jaren geleden
bovenliggende
commit
e037ea6cb6

+ 46 - 4
src/DevTools/SynchProjects/Program.cs

@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
+using System.Reflection;
 using System.Text;
 using System.Xml;
 
@@ -9,8 +10,15 @@ namespace SynchProjects
 {
 	class Program
 	{
+		static string BASEPATH;
+
 		static void CopyCompileFilesAsLinks(string platformName, string srcCsProj, string platformDest, string pathPrefix)
 		{
+			platformName = AdjustBasePath(platformName);
+			srcCsProj = AdjustBasePath(srcCsProj);
+			platformDest = AdjustBasePath(platformDest);
+			pathPrefix = AdjustBasePath(pathPrefix);
+
 			string dstCsProj = string.Format(platformDest, platformName);
 			try
 			{
@@ -84,27 +92,61 @@ namespace SynchProjects
 			Console.WriteLine("\n");
 		}
 
+		private static string AdjustBasePath(string str)
+		{
+			return str.Replace("{BASEPATH}", BASEPATH);
+		}
+
 		static void Main(string[] args)
 		{
-			const string INTERPRETER_PROJECT = @"C:\git\moonsharp\src\MoonSharp.Interpreter\MoonSharp.Interpreter.net35-client.csproj";
-			const string INTERPRETER_SUBPROJECTS_PATHS = @"C:\git\moonsharp\src\MoonSharp.Interpreter\_Projects\MoonSharp.Interpreter.{0}\MoonSharp.Interpreter.{0}.csproj";
+			const string INTERPRETER_PROJECT = @"{BASEPATH}\MoonSharp.Interpreter\MoonSharp.Interpreter.net35-client.csproj";
+			const string INTERPRETER_SUBPROJECTS_PATHS = @"{BASEPATH}\MoonSharp.Interpreter\_Projects\MoonSharp.Interpreter.{0}\MoonSharp.Interpreter.{0}.csproj";
 			const string INTERPRETER_PATH_PREFIX = @"..\..\";
 
-			const string TESTS_PROJECT = @"C:\git\moonsharp\src\MoonSharp.Interpreter.Tests\MoonSharp.Interpreter.Tests.net35-client.csproj";
-			const string TESTS_SUBPROJECTS_PATHS = @"C:\git\moonsharp\src\MoonSharp.Interpreter.Tests\_Projects\MoonSharp.Interpreter.Tests.{0}\MoonSharp.Interpreter.Tests.{0}.csproj";
+			const string DEBUGGER_PROJECT = @"{BASEPATH}\MoonSharp.RemoteDebugger\MoonSharp.RemoteDebugger.net35-client.csproj";
+			const string DEBUGGER_SUBPROJECTS_PATHS = @"{BASEPATH}\MoonSharp.RemoteDebugger\_Projects\MoonSharp.RemoteDebugger.{0}\MoonSharp.RemoteDebugger.{0}.csproj";
+			const string DEBUGGER_PATH_PREFIX = @"..\..\";
+
+			const string TESTS_PROJECT = @"{BASEPATH}\MoonSharp.Interpreter.Tests\MoonSharp.Interpreter.Tests.net35-client.csproj";
+			const string TESTS_SUBPROJECTS_PATHS = @"{BASEPATH}\MoonSharp.Interpreter.Tests\_Projects\MoonSharp.Interpreter.Tests.{0}\MoonSharp.Interpreter.Tests.{0}.csproj";
 			const string TESTS_PATH_PREFIX = @"..\..\";
 
 			string[] INTERPRETER_PLATFORMS = new string[] { "net40-client", "portable40" };
+			string[] DEBUGGER_PLATFORMS = new string[] { "net40-client" };
 			string[] TESTS_PLATFORMS = new string[] { "net40-client", "portable40", "Embeddable.portable40" };
 
+			CalcBasePath();
+
 			foreach (string platform in INTERPRETER_PLATFORMS)
 				CopyCompileFilesAsLinks(platform, INTERPRETER_PROJECT, INTERPRETER_SUBPROJECTS_PATHS, INTERPRETER_PATH_PREFIX);
 
+			foreach (string platform in DEBUGGER_PLATFORMS)
+				CopyCompileFilesAsLinks(platform, DEBUGGER_PROJECT, DEBUGGER_SUBPROJECTS_PATHS, DEBUGGER_PATH_PREFIX);
+
 			foreach (string platform in TESTS_PLATFORMS)
 				CopyCompileFilesAsLinks(platform, TESTS_PROJECT, TESTS_SUBPROJECTS_PATHS, TESTS_PATH_PREFIX);
 
 
 			Console.ReadLine();
 		}
+
+		private static void CalcBasePath()
+		{
+			string path = "";
+			string[] dir = AppDomain.CurrentDomain.BaseDirectory.Split('\\');
+
+			for (int i = 0; i < dir.Length; i++)
+			{
+				if (dir[i].ToLower() == "devtools")
+					break;
+
+				if (path.Length > 0)
+					path = path + "\\" + dir[i];
+				else
+					path = dir[i];
+			}
+
+			BASEPATH = path;
+		}
 	}
 }

+ 1 - 0
src/MoonSharp.RemoteDebugger/MoonSharp.RemoteDebugger.csproj → src/MoonSharp.RemoteDebugger/MoonSharp.RemoteDebugger.net35-client.csproj

@@ -11,6 +11,7 @@
     <AssemblyName>MoonSharp.RemoteDebugger</AssemblyName>
     <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
+    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>

+ 4 - 4
src/MoonSharp.RemoteDebugger/Properties/AssemblyInfo.cs

@@ -17,10 +17,10 @@ using System.Runtime.InteropServices;
 // Setting ComVisible to false makes the types in this assembly not visible 
 // to COM components.  If you need to access a type in this assembly from 
 // COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
+//[assembly: ComVisible(false)]
 
 // The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("cb040393-a596-41b5-9b11-5d2bed6b768c")]
+//[assembly: Guid("cb040393-a596-41b5-9b11-5d2bed6b768c")]
 
 // Version information for an assembly consists of the following four values:
 //
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.7.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion(MoonSharp.Interpreter.Script.VERSION)]
+[assembly: AssemblyFileVersion(MoonSharp.Interpreter.Script.VERSION)]

+ 99 - 0
src/MoonSharp.RemoteDebugger/_Projects/MoonSharp.RemoteDebugger.net40-client/MoonSharp.RemoteDebugger.net40-client.csproj

@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{F9D383B9-2639-4738-A897-4D9F8801B8C9}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>MoonSharp.RemoteDebugger.net40_client</RootNamespace>
+    <AssemblyName>MoonSharp.RemoteDebugger.net40-client</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="..\..\DebugServer.cs">
+      <Link>DebugServer.cs</Link>
+    </Compile>
+    <Compile Include="..\..\DebugWebHost.cs">
+      <Link>DebugWebHost.cs</Link>
+    </Compile>
+    <Compile Include="..\..\Network\HttpResource.cs">
+      <Link>HttpResource.cs</Link>
+    </Compile>
+    <Compile Include="..\..\Network\HttpResourceType.cs">
+      <Link>HttpResourceType.cs</Link>
+    </Compile>
+    <Compile Include="..\..\Network\HttpServer.cs">
+      <Link>HttpServer.cs</Link>
+    </Compile>
+    <Compile Include="..\..\Network\Utf8TcpPeerEventArgs.cs">
+      <Link>Utf8TcpPeerEventArgs.cs</Link>
+    </Compile>
+    <Compile Include="..\..\Network\Utf8TcpServerOptions.cs">
+      <Link>Utf8TcpServerOptions.cs</Link>
+    </Compile>
+    <Compile Include="..\..\Network\XmlWriter_Extensions.cs">
+      <Link>XmlWriter_Extensions.cs</Link>
+    </Compile>
+    <Compile Include="..\..\Properties\AssemblyInfo.cs">
+      <Link>AssemblyInfo.cs</Link>
+    </Compile>
+    <Compile Include="..\..\Network\Utf8TcpPeer.cs">
+      <Link>Utf8TcpPeer.cs</Link>
+    </Compile>
+    <Compile Include="..\..\Network\Utf8TcpServer.cs">
+      <Link>Utf8TcpServer.cs</Link>
+    </Compile>
+    <Compile Include="..\..\RemoteDebugger.cs">
+      <Link>RemoteDebugger.cs</Link>
+    </Compile>
+    <Compile Include="..\..\RemoteDebuggerOptions.cs">
+      <Link>RemoteDebuggerOptions.cs</Link>
+    </Compile>
+    <Compile Include="..\..\Threading\BlockingQueue.cs">
+      <Link>BlockingQueue.cs</Link>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\MoonSharp.Interpreter\_Projects\MoonSharp.Interpreter.net40-client\MoonSharp.Interpreter.net40-client.csproj">
+      <Project>{88d2880c-a863-4b16-abef-f67bd1e98bd1}</Project>
+      <Name>MoonSharp.Interpreter.net40-client</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 36 - 0
src/MoonSharp.RemoteDebugger/_Projects/MoonSharp.RemoteDebugger.net40-client/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("MoonSharp.RemoteDebugger.net40-client")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("MoonSharp.RemoteDebugger.net40-client")]
+[assembly: AssemblyCopyright("Copyright ©  2015")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("85ee48d6-2fe1-4551-ad98-2f535319c95b")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 2 - 2
src/MoonSharp/MoonSharp.csproj

@@ -79,9 +79,9 @@
       <Project>{91ea9b9d-fe03-4273-bdaf-8ad42ede1e59}</Project>
       <Name>MoonSharp.Interpreter.net35-client</Name>
     </ProjectReference>
-    <ProjectReference Include="..\MoonSharp.RemoteDebugger\MoonSharp.RemoteDebugger.csproj">
+    <ProjectReference Include="..\MoonSharp.RemoteDebugger\MoonSharp.RemoteDebugger.net35-client.csproj">
       <Project>{43d3ad52-fed5-4305-b0f4-6b991220cd0a}</Project>
-      <Name>MoonSharp.RemoteDebugger</Name>
+      <Name>MoonSharp.RemoteDebugger.net35-client</Name>
     </ProjectReference>
   </ItemGroup>
   <ItemGroup>

+ 22 - 12
src/MoonSharp/Program.cs

@@ -115,35 +115,45 @@ namespace MoonSharp
 
 		private static void ParseCommand(Script S, string p)
 		{
-			if (p == "debug" && m_Debugger == null)
+			if (p == "help")
+			{
+				Console.WriteLine("Type Lua code followed by two <enter> keystrokes to execute Lua code, ");
+				Console.WriteLine("or type one of the following commands to execute them.");
+				Console.WriteLine("");
+				Console.WriteLine("Commands:");
+				Console.WriteLine("");
+				Console.WriteLine("	!debug - Starts the debugger");
+				Console.WriteLine("	!run <filename> - Executes the specified Lua script");
+				Console.WriteLine("	!compile <filename> - Compiles the file in a binary format");
+				Console.WriteLine("");
+			}
+			else if (p == "debug" && m_Debugger == null)
 			{
 				m_Debugger = new RemoteDebuggerService();
 				m_Debugger.Attach(S, "MoonSharp REPL interpreter", false);
 				Process.Start(m_Debugger.HttpUrlStringLocalHost);
 			}
-			if (p.StartsWith("run"))
+			else if (p.StartsWith("run"))
 			{
 				p = p.Substring(3).Trim();
 				S.DoFile(p);
 			}
-			if (p == "!")
+			else if (p == "!")
 			{
 				ParseCommand(S, "debug");
 				ParseCommand(S, @"run c:\temp\test.lua");
 			}
-			if (p == "wb")
+			else if (p.StartsWith("compile"))
 			{
-				DynValue chunk = S.LoadFile(@"c:\temp\test.lua");
+				p = p.Substring("compile".Length).Trim();
+
+				string targetFileName = p + "-compiled";
+
+				DynValue chunk = S.LoadFile(p);
 
-				using (Stream stream = new FileStream(@"c:\temp\test.bin", FileMode.Create, FileAccess.Write))
+				using (Stream stream = new FileStream(targetFileName, FileMode.Create, FileAccess.Write))
 					S.Dump(chunk, stream);
 			}
-			if (p == "rb")
-			{
-				DynValue chunk = S.LoadFile(@"c:\temp\test.bin");
-				chunk.Function.Call();
-			}
-
 		}
 
 		static void m_Server_DataReceivedAny(object sender, Utf8TcpPeerEventArgs e)

+ 2 - 2
src/MoonSharp/Properties/AssemblyInfo.cs

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.5.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion(MoonSharp.Interpreter.Script.VERSION)]
+[assembly: AssemblyFileVersion(MoonSharp.Interpreter.Script.VERSION)]

+ 14 - 1
src/moonsharp.sln

@@ -15,7 +15,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{F02DBEDA-6
 EndProject
 Project("{7CF6DF6D-3B04-46F8-A40B-537D21BCA0B4}") = "MoonSharp.Documentation", "MoonSharp.Documentation\MoonSharp.Documentation.shfbproj", "{26B3033C-D1E2-4188-870C-D197E95A7F6B}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoonSharp.RemoteDebugger", "MoonSharp.RemoteDebugger\MoonSharp.RemoteDebugger.csproj", "{43D3AD52-FED5-4305-B0F4-6B991220CD0A}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoonSharp.RemoteDebugger.net35-client", "MoonSharp.RemoteDebugger\MoonSharp.RemoteDebugger.net35-client.csproj", "{43D3AD52-FED5-4305-B0F4-6B991220CD0A}"
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DevTools", "DevTools", "{3C626068-E8CE-4F62-8974-F42A56F4EFD3}"
 EndProject
@@ -55,6 +55,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsPhoneTestRunner", "T
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SilverlightTestRunner", "TestRunners\SilverlightTestRunner\SilverlightTestRunner.csproj", "{6D867B0C-EFC6-48C8-972C-EE0A2F99FEB4}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoonSharp.RemoteDebugger.net40-client", "MoonSharp.RemoteDebugger\_Projects\MoonSharp.RemoteDebugger.net40-client\MoonSharp.RemoteDebugger.net40-client.csproj", "{F9D383B9-2639-4738-A897-4D9F8801B8C9}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -271,6 +273,16 @@ Global
 		{6D867B0C-EFC6-48C8-972C-EE0A2F99FEB4}.Release|ARM.ActiveCfg = Release|Any CPU
 		{6D867B0C-EFC6-48C8-972C-EE0A2F99FEB4}.Release|x64.ActiveCfg = Release|Any CPU
 		{6D867B0C-EFC6-48C8-972C-EE0A2F99FEB4}.Release|x86.ActiveCfg = Release|Any CPU
+		{F9D383B9-2639-4738-A897-4D9F8801B8C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{F9D383B9-2639-4738-A897-4D9F8801B8C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{F9D383B9-2639-4738-A897-4D9F8801B8C9}.Debug|ARM.ActiveCfg = Debug|Any CPU
+		{F9D383B9-2639-4738-A897-4D9F8801B8C9}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{F9D383B9-2639-4738-A897-4D9F8801B8C9}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{F9D383B9-2639-4738-A897-4D9F8801B8C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{F9D383B9-2639-4738-A897-4D9F8801B8C9}.Release|Any CPU.Build.0 = Release|Any CPU
+		{F9D383B9-2639-4738-A897-4D9F8801B8C9}.Release|ARM.ActiveCfg = Release|Any CPU
+		{F9D383B9-2639-4738-A897-4D9F8801B8C9}.Release|x64.ActiveCfg = Release|Any CPU
+		{F9D383B9-2639-4738-A897-4D9F8801B8C9}.Release|x86.ActiveCfg = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -293,5 +305,6 @@ Global
 		{28B8B747-5683-46C0-B308-62E6D3C2F4CB} = {FA582319-EA17-4C52-870D-C00EF793628F}
 		{642B8AC9-97EB-4AA8-8F1D-D3F94CABCE37} = {023F1F7D-5F49-430F-9CC4-5FF891439548}
 		{6D867B0C-EFC6-48C8-972C-EE0A2F99FEB4} = {023F1F7D-5F49-430F-9CC4-5FF891439548}
+		{F9D383B9-2639-4738-A897-4D9F8801B8C9} = {5014C740-F6C7-4995-8D40-C250FB159A20}
 	EndGlobalSection
 EndGlobal