Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into wpf-sample
Browse files Browse the repository at this point in the history
  • Loading branch information
khellang committed Mar 13, 2013
2 parents 0327312 + 6fd38ce commit 3607edf
Show file tree
Hide file tree
Showing 52 changed files with 1,503 additions and 1,142 deletions.
13 changes: 13 additions & 0 deletions ScriptCs.sln
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{9659F354
build\ScriptCs.Version.props = build\ScriptCs.Version.props
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptCs.Engine.Roslyn", "src\ScriptCs.Engine.Roslyn\ScriptCs.Engine.Roslyn.csproj", "{E79EC231-E27D-4057-91C9-2D001A3A8C3B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptCs.Engine.Roslyn.Tests", "test\ScriptCs.Engine.Roslyn.Tests\ScriptCs.Engine.Roslyn.Tests.csproj", "{28D11DE5-9F98-4E0A-8CCC-9CDC19110451}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -54,12 +58,21 @@ Global
{AC228213-7356-4F0D-BA48-EBA5FB8A7506}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AC228213-7356-4F0D-BA48-EBA5FB8A7506}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AC228213-7356-4F0D-BA48-EBA5FB8A7506}.Release|Any CPU.Build.0 = Release|Any CPU
{E79EC231-E27D-4057-91C9-2D001A3A8C3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E79EC231-E27D-4057-91C9-2D001A3A8C3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E79EC231-E27D-4057-91C9-2D001A3A8C3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E79EC231-E27D-4057-91C9-2D001A3A8C3B}.Release|Any CPU.Build.0 = Release|Any CPU
{28D11DE5-9F98-4E0A-8CCC-9CDC19110451}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{28D11DE5-9F98-4E0A-8CCC-9CDC19110451}.Debug|Any CPU.Build.0 = Debug|Any CPU
{28D11DE5-9F98-4E0A-8CCC-9CDC19110451}.Release|Any CPU.ActiveCfg = Release|Any CPU
{28D11DE5-9F98-4E0A-8CCC-9CDC19110451}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{4D6A2A55-BB17-40CB-9567-EAFF80BEFDCE} = {A59C6538-62EA-4BF6-AA00-E0E9A2892D47}
{AC228213-7356-4F0D-BA48-EBA5FB8A7506} = {A59C6538-62EA-4BF6-AA00-E0E9A2892D47}
{28D11DE5-9F98-4E0A-8CCC-9CDC19110451} = {A59C6538-62EA-4BF6-AA00-E0E9A2892D47}
EndGlobalSection
EndGlobal
10 changes: 1 addition & 9 deletions src/ScriptCs.Contracts/IScriptPack.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using Roslyn.Scripting.CSharp;

namespace ScriptCs.Contracts
namespace ScriptCs.Contracts
{
[InheritedExport]
public interface IScriptPack
{
void Initialize(IScriptPackSession session);
Expand Down
11 changes: 0 additions & 11 deletions src/ScriptCs.Contracts/ScriptCs.Contracts.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
</PropertyGroup>
<ItemGroup>
<Reference Include="Roslyn.Compilers, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\packages\Roslyn.Compilers.Common.1.2.20906.2\lib\net45\Roslyn.Compilers.dll</HintPath>
</Reference>
<Reference Include="Roslyn.Compilers.CSharp, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\..\packages\Roslyn.Compilers.CSharp.1.2.20906.2\lib\net45\Roslyn.Compilers.CSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
Expand All @@ -38,9 +30,6 @@
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
</Project>
26 changes: 0 additions & 26 deletions src/ScriptCs.Core/CompilationResult.cs

This file was deleted.

27 changes: 0 additions & 27 deletions src/ScriptCs.Core/ConsoleCompiledDllDebugger.cs

This file was deleted.

28 changes: 0 additions & 28 deletions src/ScriptCs.Core/DebugFilePreProcessor.cs

This file was deleted.

68 changes: 8 additions & 60 deletions src/ScriptCs.Core/DebugScriptExecutor.cs
Original file line number Diff line number Diff line change
@@ -1,62 +1,10 @@
using System.ComponentModel.Composition;
using System.IO;
using ScriptCs.Exceptions;

namespace ScriptCs
namespace ScriptCs
{
[Export(Constants.DebugContractName, typeof(IScriptExecutor))]
public class DebugScriptExecutor : ScriptExecutor
{
private readonly ICompiledDllDebugger _compiledDllDebugger;

[ImportingConstructor]
public DebugScriptExecutor(
IFileSystem fileSystem,
[Import(Constants.DebugContractName)]IFilePreProcessor filePreProcessor,
IScriptEngine scriptEngine,
ICompiledDllDebugger compiledDllDebugger,
IScriptHostFactory scriptHostFactory)
: base(fileSystem, filePreProcessor, scriptEngine, scriptHostFactory)
{
_compiledDllDebugger = compiledDllDebugger;
}

public DebugScriptExecutor(
IFileSystem fileSystem,
IFilePreProcessor filePreProcessor,
IScriptEngine scriptEngine,
ICompiledDllDebugger compiledDllDebugger)
: this(fileSystem, filePreProcessor, scriptEngine, compiledDllDebugger, new ScriptHostFactory())
{
}

protected override void Execute(string absolutePathToScript, ISession session, string code)
{
var fileName = Path.GetFileName(absolutePathToScript);
var nameWithoutExtension = fileName.Replace(Path.GetExtension(fileName), string.Empty);
var outputName = nameWithoutExtension + ".dll";
var pdbName = nameWithoutExtension + ".pdb";
var outputPath = Path.Combine(session.Engine.BaseDirectory, outputName);
var pdbPath = Path.Combine(session.Engine.BaseDirectory, pdbName);

ISubmission<object> submission = session.CompileSubmission<object>(code);

ICompilationResult result;

using (Stream outputStream = _fileSystem.CreateFileStream(outputPath, FileMode.OpenOrCreate))
using (Stream pdbStream = _fileSystem.CreateFileStream(pdbPath, FileMode.OpenOrCreate))
{
result = submission.Compilation.Emit(outputStream, pdbStream);
}

if (result.Success)
{
_compiledDllDebugger.Run(outputPath, session);
}
else
{
throw new CompilationException(result.ErrorMessage);
}
}
}
public class DebugScriptExecutor : ScriptExecutor
{
public DebugScriptExecutor(IFileSystem fileSystem, IFilePreProcessor filePreProcessor, IScriptEngine scriptEngine)
: base(fileSystem, filePreProcessor, scriptEngine)
{
}
}
}
11 changes: 0 additions & 11 deletions src/ScriptCs.Core/Exceptions/CompilationException.cs

This file was deleted.

11 changes: 11 additions & 0 deletions src/ScriptCs.Core/Exceptions/ScriptExecutionException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;

namespace ScriptCs.Exceptions
{
public class ScriptExecutionException : Exception
{
public ScriptExecutionException(string message) : base(message)
{
}
}
}
Loading

0 comments on commit 3607edf

Please sign in to comment.