fsprojects / ProjectScaffold

A prototypical .NET solution (file system layout and tooling), recommended for F# projects
http://fsprojects.github.io/ProjectScaffold
The Unlicense
516 stars 153 forks source link

Can't generate docs on Linux or OSX #65

Open GabrieleCocco opened 10 years ago

GabrieleCocco commented 10 years ago

From a clear clone on OSX 10.9.3 + Mono 3.4.0, after having setup the project info through build.sh, I run build.sh ReleaseDoc and I get the following error:

fsharpi --define:RELEASE generate.fsx

/Users/gabriele/Projects/ProjectScaffold/docs/tools/generate.fsx(29,1): error FS0078: Unable to find the file 'NuGet.Core.dll' in any of /Library/Frameworks/Mono.framework/Versions/3.4.0/lib/mono/4.5 /Users/gabriele/Projects/ProjectScaffold/docs/tools/../../packages/FSharp.Formatting.2.4.1/lib/net40 /Users/gabriele/Projects/ProjectScaffold/docs/tools/../../packages/RazorEngine.3.3.0/lib/net40 /Users/gabriele/Projects/ProjectScaffold/docs/tools/../../packages/FSharp.Compiler.Service.0.0.36/lib/net40 /Users/gabriele/Projects/ProjectScaffold/docs/tools /Library/Frameworks/Mono.framework/Versions/3.4.0/lib/mono/4.0/

GabrieleCocco commented 10 years ago

I tried to fix the issue copying the suggested dll from within packages/FAKE/tools to docs/tools (simply cause the trace above says this folder is among the inspected ones). Doing this fixes the missing dll problem, but raises another one (please note I did not touch any src file, just did build.sh the first time to setup NeGet and repo info):

fsharpi --define:RELEASE generate.fsx Copying file: /Users/gabriele/Projects/ProjectScaffold/docs/output/img/logo.png Copying styles and scripts: /Users/gabriele/Projects/ProjectScaffold/docs/output/content/style.css Copying styles and scripts: /Users/gabriele/Projects/ProjectScaffold/docs/output/content/tips.js Generating 'index.html' System.Exception: Generating HTML failed. at FSharp.Literate.RazorRender.ProcessFile[IDictionary2](System.String source, Microsoft.FSharp.Core.FSharpOption1 properties) [0x00000] in :0 at FSharp.Literate.Templating.generateFile (System.String contentTag, IEnumerable1 parameters, Microsoft.FSharp.Core.FSharpOption1 templateOpt, System.String output, IEnumerable1 layoutRoots) [0x00000] in <filename unknown>:0 at FSharp.Literate.Templating.processFile (FSharp.Literate.LiterateDocument doc, System.String output, FSharp.Literate.ProcessingContext ctx) [0x00000] in <filename unknown>:0 at FSharp.Literate.Literate.ProcessScriptFile (System.String input, Microsoft.FSharp.Core.FSharpOption1 templateFile, Microsoft.FSharp.Core.FSharpOption1 output, Microsoft.FSharp.Core.FSharpOption1 format, Microsoft.FSharp.Core.FSharpOption1 formatAgent, Microsoft.FSharp.Core.FSharpOption1 prefix, Microsoft.FSharp.Core.FSharpOption1 compilerOptions, Microsoft.FSharp.Core.FSharpOption1 lineNumbers, Microsoft.FSharp.Core.FSharpOption1 references, Microsoft.FSharp.Core.FSharpOption1 fsiEvaluator, Microsoft.FSharp.Core.FSharpOption1 replacements, Microsoft.FSharp.Core.FSharpOption1 includeSource, Microsoft.FSharp.Core.FSharpOption1 layoutRoots) [0x00000] in <filename unknown>:0 at <StartupCode$FSharp-Literate>.$Main+processScriptFile@152.Invoke (System.String file, System.String output) [0x00000] in <filename unknown>:0 at Microsoft.FSharp.Core.FSharpFunc2[System.String,System.String].InvokeFast[Unit](Microsoft.FSharp.Core.FSharpFunc2 func, System.String arg1, System.String arg2) [0x00000] in <filename unknown>:0 at <StartupCode$FSharp-Literate>.$Main.processDirectory@165 (Microsoft.FSharp.Core.FSharpOption1 format, Microsoft.FSharp.Core.FSharpFunc2 processScriptFile, Microsoft.FSharp.Core.FSharpFunc2 processMarkdown, System.String indir, System.String outdir) [0x00000] in :0 at FSharp.Literate.Literate.ProcessDirectory (System.String inputDirectory, Microsoft.FSharp.Core.FSharpOption1 templateFile, Microsoft.FSharp.Core.FSharpOption1 outputDirectory, Microsoft.FSharp.Core.FSharpOption1 format, Microsoft.FSharp.Core.FSharpOption1 formatAgent, Microsoft.FSharp.Core.FSharpOption1 prefix, Microsoft.FSharp.Core.FSharpOption1 compilerOptions, Microsoft.FSharp.Core.FSharpOption1 lineNumbers, Microsoft.FSharp.Core.FSharpOption1 references, Microsoft.FSharp.Core.FSharpOption1 fsiEvaluator, Microsoft.FSharp.Core.FSharpOption1 replacements, Microsoft.FSharp.Core.FSharpOption1 includeSource, Microsoft.FSharp.Core.FSharpOption1 layoutRoots) [0x00000] in :0 at FSI_0002.buildDocumentation () [0x00000] in :0 at <StartupCode$FSI_0002>.$FSI_0002.main@ () [0x00000] in :0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0

fsgit commented 10 years ago

Should be fixed by this direct commit: https://github.com/fsprojects/ProjectScaffold/commit/ccdd395f7ba0e9a79ccffb029dffe57d80c6209c

fsgit commented 10 years ago

Reopened and renamed because of the problem with generating docs

caindy commented 10 years ago

The generated file is:

// ------------------------------------------------------------------------------
//  <autogenerated>
//      This code was generated by a tool.
//      Mono Runtime Version: 4.0.30319.17020
// 
//      Changes to this file may cause incorrect behavior and will be lost if 
//      the code is regenerated.
//  </autogenerated>
// ------------------------------------------------------------------------------

namespace CompiledRazorTemplates.Dynamic {
    using System;
    using System.Collections.Generic;
    using System.Linq;

    public class bdfebedcbe : FSharp.Literate.DocPageTemplateBase<System.Object> {

#line hidden

        public bdfebedcbe() {
        }

        public override void Execute() {

  Layout = "template";
  Title = Properties["page-title"];
  Description = Properties["project-summary"];

WriteLiteral("\r\n");

Write(Properties["document"]);

WriteLiteral("\r\n");

Write(Properties["tooltips"]);

        }
    }
}
caindy commented 10 years ago

FWIW, neither the output above nor the output listed in #68 contain any specific parsing errors from the error handling code in FSharp.Formatting

dsyme commented 10 years ago

@tpetricek - It would be great if the scaffolding (or FSharp.Formatting) could drop the dependency on Razor. Is Razor really doing anything particularly complicated here? Could we have a fully cross-platform F#-only FSharp.Formatting?

forki commented 10 years ago

It's not that complicated, but we would need a good OSS templating tool. Ideally it would be a separate project and pluggable into asp.NET as well. I read about ideas of a Fazor project but didn't see it happen. Maybe you can ask on Twitter. On Aug 1, 2014 1:28 PM, "Don Syme" notifications@github.com wrote:

@tpetricek https://github.com/tpetricek - It would be great if the scaffolding (or FSharp.Formatting) could drop the dependency on Razor. Is Razor really doing anything particularly complicated here? Could we have a fully cross-platform F#-only FSharp.Formatting?

— Reply to this email directly or view it on GitHub https://github.com/fsprojects/ProjectScaffold/issues/65#issuecomment-50874322 .

tpetricek commented 10 years ago

I think @7sharp9 knows some things about fixing the Razor engine on Mono.

I'd love to drop it too. We just need some pretty basic OSS templating tool instead. I would welcome any pull requests to F# Formatting that replace Razor - either with another dependency or even with a simple templating tool written in F# instead.

Though it should probably not be completely basic - the templates currently do some non-trivial things. We could move the grouping into the F# code itself, but it still needs some composition, looping and if statements.

7sharp9 commented 10 years ago

I made a PR that fixed Razor, not sure if it made it to a nuget release of Razor though. It was some time ago ...

dahlbyk commented 10 years ago

I started implementing F# support in Razor years ago, but I'm sure Razor has changed substantially since then.

bentayloruk commented 10 years ago

DotLiquid might be a good candidate. It is a .NET implementation of Liquid, which is the default template engine for Jekyll (used on Github pages). I've not tried it on Mono.

7sharp9 commented 10 years ago

Incidentally, my fix was here in the RazorEngine: https://github.com/Antaris/RazorEngine/commit/2098fb0264839b09601f5b2bf335eafa567d352e

When I built all from source I could use formatting fine, some of the fsx scripts were troublesome though. Ive never built the scaffolding, so it might not be relevant ...

tpetricek commented 10 years ago

The other problem with Razor is that the newer versions require .NET 4.5, while F# Formatting can work fine with just .NET 4.0. So updating to newer version of Razor also means updating to .NET 4.5 (might not be a big deal though). F# support for Razor sounds nice, but it probably does not fix the problem here.

@7sharp9 Thanks for the clarification! We could try updating the package.

7sharp9 commented 10 years ago

I was going to start using ProjectScaffold soon, as it doesn't work out of the box on osx its dissapointing :-(

7sharp9 commented 10 years ago

@tpetricek I rebuilt everything from scratch so I probably made everything .Net 4.5, I cant actually remember now.

tpetricek commented 10 years ago

@7sharp9 It is disappointing indeed! That's why we need help from some mono experts ;-)

pblasucci commented 10 years ago

@7sharp9 Are you having a different issue than the one at the start of this thread? If so, please create an new issue. I'm in the process of moving my primary dev stack over to OS X. So I intend to tackle this issue (maybe a few others) in the very near future.

7sharp9 commented 10 years ago

@pblasucci I had issues with Razor ages ago, thats what @tpetricek was referring to.

I have the same issue thats described here just checked.

icorderi commented 10 years ago

Any updates on this? Where should we put some effort together to get this working?

tpetricek commented 10 years ago

The best way to get this started would be to start a discussion on the F# Formatting project page: http://github.com/tpetricek/FSharp.Formatting/

I think writing a custom system might be more work than one would expect, but if there is something we could use instead of Razor, that would be fantastic...

icorderi commented 10 years ago

Ok, created Issue #188 over at FSharp.Formatting.

matthid commented 9 years ago

Please try with #135.