Skip to content

Commit

Permalink
Using the Roslyn compiler in more places
Browse files Browse the repository at this point in the history
  • Loading branch information
bounav committed Jan 30, 2024
1 parent b0349d7 commit 16c4250
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ public void RunPrecompiler()
Assert.That(File.Exists(targetFile), "File exists");

var result = Assembly.LoadFrom(targetFile);
Assert.AreEqual(3, result.GetTypes().Count());

var views = result.GetTypes().Where(x => x.BaseType == typeof(SparkView))
.ToArray();

Assert.AreEqual(3, views.Length);
}

public class ParentInstaller : Installer
Expand Down
2 changes: 1 addition & 1 deletion src/Castle.MonoRail.Views.Spark/SparkViewFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public ISparkViewEngine Engine

var viewFolder = new ViewSourceLoaderWrapper(this);

var batchCompiler = new CodeDomBatchCompiler();
var batchCompiler = new RoslynBatchCompiler();

this._engine =
new SparkViewEngine(
Expand Down
2 changes: 1 addition & 1 deletion src/Spark.Python/Compiler/PythonViewCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public override void CompileView(IEnumerable<IList<Chunk>> viewTemplates, IEnume
{
GenerateSourceCode(viewTemplates, allResources);

var compiler = new CodeDomBatchCompiler();
var compiler = new RoslynBatchCompiler();
var assembly = compiler.Compile(Debug, "csharp", null, new[] { SourceCode });
CompiledType = assembly.GetType(ViewClassFullName);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Spark.Ruby/Compiler/RubyViewCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public override void CompileView(IEnumerable<IList<Chunk>> viewTemplates, IEnume
{
GenerateSourceCode(viewTemplates, allResources);

var compiler = new CodeDomBatchCompiler();
var compiler = new RoslynBatchCompiler();
var assembly = compiler.Compile(Debug, "csharp", null, new[] { SourceCode });
CompiledType = assembly.GetType(ViewClassFullName);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Spark.Web.Tests/Compiler/CSharpViewCompilerTester.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public void ProvideFullException()
{
new SendExpressionChunk { Code = "NoSuchVariable" }
}),
Throws.TypeOf<CompilerException>());
Throws.TypeOf<RoslynCompilerException>());
}

[Test]
Expand Down
1 change: 0 additions & 1 deletion src/Spark/CompiledViewHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using System;
using System.Linq;
using System.Collections.Generic;
using Spark;

namespace Spark
{
Expand Down
2 changes: 1 addition & 1 deletion src/Spark/Compiler/BatchCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Spark.Compiler;

#if NETFRAMEWORK

[Obsolete("To be replaced with RoslynBatchCompiler (code dom cannot target .net 'core'")]
[Obsolete("To be replaced with RoslynBatchCompiler (code dom cannot target .net 'core')")]
public class CodeDomBatchCompiler : IBatchCompiler
{
/// <summary>
Expand Down

0 comments on commit 16c4250

Please sign in to comment.