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 improved mono support. #209

Merged
merged 4 commits into from
Oct 7, 2014

Conversation

matthid
Copy link
Member

@matthid matthid commented Oct 7, 2014

Same as #207 but with an additional fix:

  • 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/matthid/RazorEngine/blob/develop/generateDocs.fsx#L48-64 and https://github.com/matthid/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 my 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.

@forki forki merged commit 0913e82 into fsprojects:master Oct 7, 2014
@forki
Copy link
Member

forki commented Oct 7, 2014

Sorry, I had to revert again.

The dll name change will break downstream projects. I'm not comfortable to do this without @tpetricek's consent.

@forki
Copy link
Member

forki commented Oct 7, 2014

what

@matthid
Copy link
Member Author

matthid commented Oct 7, 2014

What is breaking what? There should be no changed name as the dll is still called RazorEngine.dll.

@forki
Copy link
Member

forki commented Oct 7, 2014

yes, but the folder is called RazorEngine.N.
People will have to update their generate.fsx.

@matthid
Copy link
Member Author

matthid commented Oct 7, 2014

Thanks for the explanation.
Wow that hurts :( . I contacted the authors to update the original package, but I have no response until now. I think the original project is quite dead. That's sad for such a robust and good code-base.
So do not hope that the original package is updated anytime soon (you can try to send an email to the original author as well).

@forki
Copy link
Member

forki commented Oct 7, 2014

Oh I always thought it was directly from MS.

I'm not saying we should not merge this, but I will have defer this decision to tomas.

forki added a commit that referenced this pull request Oct 8, 2014
matthid added a commit to matthid/FSharp.Formatting that referenced this pull request Dec 23, 2014
This reverts commit 1289f61 and updates RazorEngine to version 3.5.0.
The problem with the previous commit was that upstream projects broke (because of a different dependency).
This time we use the official update of the RazorEngine project.

Conflicts:
	RELEASE_NOTES.md
	build.fsx
	src/Common/AssemblyInfo.fs
	src/Common/Razor.fs
	src/FSharp.Literate/Formatting.fs
matthid added a commit to matthid/FSharp.Formatting that referenced this pull request Jan 1, 2015
This reverts commit 1289f61 and updates RazorEngine to version 3.5.0-beta1.
The problem with the previous commit was that upstream projects broke (because of a different dependency).
This time we use the official update of the RazorEngine project.

Conflicts:
	RELEASE_NOTES.md
	build.fsx
	src/Common/AssemblyInfo.fs
	src/Common/Razor.fs
	src/FSharp.Literate/Formatting.fs
@matthid matthid mentioned this pull request Jan 1, 2015
matthid added a commit to matthid/FSharp.Formatting that referenced this pull request Jan 6, 2015
This reverts commit 1289f61 and updates RazorEngine to version 3.5.0-beta3.
The problem with the previous commit was that upstream projects broke (because of a different dependency).
This time we use the official update of the RazorEngine project.

Conflicts:
	RELEASE_NOTES.md
	build.fsx
	src/Common/AssemblyInfo.fs
	src/Common/Razor.fs
	src/FSharp.Literate/Formatting.fs
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