Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Razor engine update and mono support. #207

Merged
merged 3 commits into from
Oct 7, 2014

Conversation

matthid
Copy link
Member

@matthid matthid commented Oct 5, 2014

  • Removed RazorEngine from paket and use RazorEngine.N paket, fixes Bundle RazorEngine.dll which works on mono #203.
  • add assemblyReferences optional parameter to specify the references for the templates (while compiling):
    • For RazorEngine I used the following code to make it work cross platform:
    let references =
      if isMono then
        // Workaround compiler errors in Razor-ViewEngine
        let d = RazorEngine.Compilation.Resolver.UseCurrentAssembliesReferenceResolver()
        let loadedList = d.GetReferences () |> Seq.cache
        //// We replace the list and add required items manually as mcs doesn't like duplicates...
        let getItem name =
            loadedList |> Seq.find (fun l -> l.Contains name)
        [ (getItem "FSharp.Core").Replace("4.3.0.0", "4.3.1.0")  // (if isMono then "/usr/lib64/mono/gac/FSharp.Core/4.3.1.0__b03f5f7f11d50a3a/FSharp.Core.dll" else "FSharp.Core") 
          Path.GetFullPath "./lib/FSharp.Compiler.Service/FSharp.Compiler.Service.dll"
          Path.GetFullPath "./build/net40/System.Web.Razor.dll"
          Path.GetFullPath "./build/net40/RazorEngine.dll"
          Path.GetFullPath "./lib/FSharp.Formatting/FSharp.Literate.dll"
          Path.GetFullPath "./lib/FSharp.Formatting/FSharp.CodeFormat.dll"
          Path.GetFullPath "./lib/FSharp.Formatting/FSharp.MetadataFormat.dll" ] 
        |> Some
      else None

See https://github.com/antaris/RazorEngine/blob/develop/generateDocs.fsx#L48-64 and https://github.com/antaris/RazorEngine/blob/develop/generateDocs.fsx#L98.

Currently I see no other good solution for making it work cross platform without delegating the problem to the user, if somebody can see another solution please open an issue on RazorEngine fork...
Besides that it has the additional advantage that now users can use their own types/code in custom templates by just adding a reference to their custom assembly.

Note this also fixes the problem mentioned at the end of #202.

The last commit fixes that ProcessDirectory doesn't process the directory recursively as indicated by the recursive inner function definition.

@matthid matthid force-pushed the razor_engine_update branch from c7044c7 to 97c9694 Compare October 6, 2014 16:47
@forki forki merged commit 97c9694 into fsprojects:master Oct 7, 2014
@forki
Copy link
Member

forki commented Oct 7, 2014

image

@forki
Copy link
Member

forki commented Oct 7, 2014

I accidently closed this. Please resubmit.

I'm getting an error during the unit tests. Can you reproduce?

@matthid
Copy link
Member Author

matthid commented Oct 7, 2014

I can actually, what is with this (and why do you not get this?):

Errors and Failures:
1) Test Failure : FSharp.Literate.Tests.Simple.Can split formatted document and formatted tool tips
     Expected: String containing "test : int"
  But was:  <string.Empty>

at FSharp.Literate.Tests.Simple.Can split formatted document and formatted tool tips() in C:\Projects\FSharp.Formatting\tests\FSharp.Literate.Tests\Tests.fs:line 262

I have this since I worked on this project... That's why this slipped through :(. Thanks for the screen! Will push a fixed version soon.

@forki
Copy link
Member

forki commented Oct 7, 2014

No I don't get the other one.
Weird. Please raise issue so that we don't forget. Maybe Tomas knows
something about that.
On Oct 7, 2014 1:05 PM, "matthid" [email protected] wrote:

I can actually, what is with this (and why do you not get this?):

Errors and Failures:

  1. Test Failure : FSharp.Literate.Tests.Simple.Can split formatted document and formatted tool tips
    Expected: String containing "test : int"
    But was: <string.Empty>

at FSharp.Literate.Tests.Simple.Can split formatted document and formatted tool tips() in C:\Projects\FSharp.Formatting\tests\FSharp.Literate.Tests\Tests.fs:line 262

I have this since I worked on this project... That's why this slipped
through :(. Thanks for the screen! Will push a fixed version soon.


Reply to this email directly or view it on GitHub
#207 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bundle RazorEngine.dll which works on mono
2 participants