Skip to content

Commit

Permalink
Merge branch 'master' into newdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfoxy committed Jun 10, 2017
2 parents 95d3fb8 + ecc4643 commit 4e384b9
Show file tree
Hide file tree
Showing 20 changed files with 143 additions and 189 deletions.
12 changes: 9 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ $RECYCLE.BIN/
# NuGet Packages Directory
packages/

# Generated documentation folder
docs/output/

# Temp folder used for publishing docs
temp/

# Test results produced by build
TestResults.xml

Expand All @@ -180,7 +186,7 @@ localpackages/
paket-files
*.orig
.paket/paket.exe
docsraw/content/license.md
docsraw/content/release-notes.md
docs/content/license.md
docs/content/release-notes.md
.fake
docsraw/tools/FSharp.Formatting.svclog
docs/tools/FSharp.Formatting.svclog
22 changes: 22 additions & 0 deletions CheckFSharpInstallation.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="CheckFSharpInstallation" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
</PropertyGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '11.0'">
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets')">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</Otherwise>
</Choose>
<Target Name="CheckFSharpInstallation">
<Error Text="File Microsoft.FSharp.Targets not found. Is F# correctly installed on this system? I looked in '$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets' and '$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets'" Condition="!Exists('$(FSharpTargetsPath)')" />
</Target>
</Project>
4 changes: 2 additions & 2 deletions FSharp.ProjectScaffold.sln
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{83F16175
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "content", "content", "{8E6D5255-776D-4B61-85F9-73C37AA1FB9A}"
ProjectSection(SolutionItems) = preProject
docsraw\content\index.fsx = docsraw\content\index.fsx
docsraw\content\tutorial.fsx = docsraw\content\tutorial.fsx
docs\content\index.fsx = docs\content\index.fsx
docs\content\tutorial.fsx = docs\content\tutorial.fsx
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{ED8079DD-2B06-4030-9F0F-DC548F98E1C4}"
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ This project can be used to scaffold a prototypical .NET solution including file

* updates all AssemblyInfo files
* compiles the application and runs all test projects
* generates [SourceLinks](https://github.com/ctaggart/SourceLink)
* generates API docs based on XML document tags
* generates [documentation based on Markdown files](http://fsprojects.github.io/ProjectScaffold/writing-docs.html)
* generates [NuGet](http://www.nuget.org) packages
Expand Down
5 changes: 4 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
### 1.0 - Unreleased
### 1.0.1
* Removed SourceLink

### 1.0
* More awesome stuff coming
* Added SourceLink for Source Indexing PDB

Expand Down
81 changes: 36 additions & 45 deletions build.template
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@ open Fake.Git
open Fake.AssemblyInfoFile
open Fake.ReleaseNotesHelper
open Fake.UserInputHelper

open System
open System.IO
#if MONO
#else
#load "packages/build/SourceLink.Fake/tools/Fake.fsx"
open SourceLink
#endif
open System.Diagnostics

// --------------------------------------------------------------------------------------
// START TODO: Provide project-specific details below
Expand All @@ -24,7 +21,7 @@ open SourceLink
// - for version and project name in generated AssemblyInfo file
// - by the generated NuGet package
// - to run tests and to publish documentation on GitHub gh-pages
// - for documentation, you also need to edit info in "docsraw/tools/generate.fsx"
// - for documentation, you also need to edit info in "docs/tools/generate.fsx"

// The name of the project
// (used by attributes in AssemblyInfo, name of a NuGet package and directory in 'src')
Expand Down Expand Up @@ -131,7 +128,7 @@ let vsProjProps =

Target "Clean" (fun _ ->
!! solutionFile |> MSBuildReleaseExt "" vsProjProps "Clean" |> ignore
CleanDirs ["bin"; "temp"; "docs"]
CleanDirs ["bin"; "temp"; "docs/output"]
)

// --------------------------------------------------------------------------------------
Expand All @@ -155,23 +152,6 @@ Target "RunTests" (fun _ ->
OutputFile = "TestResults.xml" })
)

#if MONO
#else
// --------------------------------------------------------------------------------------
// SourceLink allows Source Indexing on the PDB generated by the compiler, this allows
// the ability to step through the source code of external libraries http://ctaggart.github.io/SourceLink/

Target "SourceLink" (fun _ ->
let baseUrl = sprintf "%s/%s/{0}/%%var2%%" gitRaw project
!! "src/**/*.??proj"
-- "src/**/*.shproj"
|> Seq.iter (fun projFile ->
let proj = VsProj.LoadRelease projFile
SourceLink.Index proj.CompilesNotLinked proj.OutputFilePdb __SOURCE_DIRECTORY__ baseUrl
)
)

#endif

// --------------------------------------------------------------------------------------
// Build a NuGet package
Expand All @@ -197,7 +177,7 @@ Target "PublishNuget" (fun _ ->

let fakePath = "packages" </> "build" </> "FAKE" </> "tools" </> "FAKE.exe"
let fakeStartInfo script workingDirectory args fsiargs environmentVars =
(fun (info: System.Diagnostics.ProcessStartInfo) ->
(fun (info: ProcessStartInfo) ->
info.FileName <- System.IO.Path.GetFullPath fakePath
info.Arguments <- sprintf "%s --fsiargs -d:FAKE %s \"%s\"" args fsiargs script
info.WorkingDirectory <- workingDirectory
Expand All @@ -221,7 +201,7 @@ let executeFAKEWithOutput workingDirectory script fsiargs envArgs =
// Documentation
let buildDocumentationTarget fsiargs target =
trace (sprintf "Building documentation (%s), this could take some time, please wait..." target)
let exit = executeFAKEWithOutput "docsraw/tools" "generate.fsx" fsiargs ["target", target]
let exit = executeFAKEWithOutput "docs/tools" "generate.fsx" fsiargs ["target", target]
if exit <> 0 then
failwith "generating reference documentation failed"
()
Expand All @@ -245,31 +225,31 @@ let generateHelp fail =
generateHelp' fail false

Target "GenerateHelp" (fun _ ->
DeleteFile "docsraw/content/release-notes.md"
CopyFile "docsraw/content/" "RELEASE_NOTES.md"
Rename "docsraw/content/release-notes.md" "docsraw/content/RELEASE_NOTES.md"
DeleteFile "docs/content/release-notes.md"
CopyFile "docs/content/" "RELEASE_NOTES.md"
Rename "docs/content/release-notes.md" "docs/content/RELEASE_NOTES.md"

DeleteFile "docsraw/content/license.md"
CopyFile "docsraw/content/" "LICENSE.txt"
Rename "docsraw/content/license.md" "docsraw/content/LICENSE.txt"
DeleteFile "docs/content/license.md"
CopyFile "docs/content/" "LICENSE.txt"
Rename "docs/content/license.md" "docs/content/LICENSE.txt"

generateHelp true
)

Target "GenerateHelpDebug" (fun _ ->
DeleteFile "docsraw/content/release-notes.md"
CopyFile "docsraw/content/" "RELEASE_NOTES.md"
Rename "docsraw/content/release-notes.md" "docsraw/content/RELEASE_NOTES.md"
DeleteFile "docs/content/release-notes.md"
CopyFile "docs/content/" "RELEASE_NOTES.md"
Rename "docs/content/release-notes.md" "docs/content/RELEASE_NOTES.md"

DeleteFile "docsraw/content/license.md"
CopyFile "docsraw/content/" "LICENSE.txt"
Rename "docsraw/content/license.md" "docsraw/content/LICENSE.txt"
DeleteFile "docs/content/license.md"
CopyFile "docs/content/" "LICENSE.txt"
Rename "docs/content/license.md" "docs/content/LICENSE.txt"

generateHelp' true true
)

Target "KeepRunning" (fun _ ->
use watcher = !! "docsraw/content/**/*.*" |> WatchChanges (fun changes ->
use watcher = !! "docs/content/**/*.*" |> WatchChanges (fun changes ->
generateHelp' true true
)

Expand All @@ -293,7 +273,7 @@ F# Project Scaffold ({0})
=========================
*)
"""
let targetDir = "docsraw/content" </> lang
let targetDir = "docs/content" </> lang
let targetFile = targetDir </> "index.fsx"
ensureDirectory targetDir
System.IO.File.WriteAllText(targetFile, System.String.Format(content, lang))
Expand All @@ -309,7 +289,7 @@ Target "AddLangDocs" (fun _ ->
failwithf "Language must be 2 or 3 characters (ex. 'de', 'fr', 'ja', 'gsw', etc.): %s" lang

let templateFileName = "template.cshtml"
let templateDir = "docsraw/tools/templates"
let templateDir = "docs/tools/templates"
let langTemplateDir = templateDir </> lang
let langTemplateFileName = langTemplateDir </> templateFileName

Expand All @@ -325,6 +305,17 @@ Target "AddLangDocs" (fun _ ->
// --------------------------------------------------------------------------------------
// Release Scripts

Target "ReleaseDocs" (fun _ ->
let tempDocsDir = "temp/gh-pages"
CleanDir tempDocsDir
Repository.cloneSingleBranch "" (gitHome + "/" + gitName + ".git") "gh-pages" tempDocsDir

CopyRecursive "docs/output" tempDocsDir true |> tracefn "%A"
StageAll tempDocsDir
Git.Commit.Commit tempDocsDir (sprintf "Update generated documentation for version %s" release.NugetVersion)
Branches.push tempDocsDir
)

#load "paket-files/build/fsharp/FAKE/modules/Octokit/Octokit.fsx"
open Octokit

Expand Down Expand Up @@ -371,13 +362,10 @@ Target "All" DoNothing
==> "RunTests"
==> "GenerateReferenceDocs"
==> "GenerateDocs"
#if MONO
#else
=?> ("SourceLink", Pdbstr.tryFind().IsSome )
#endif
==> "NuGet"
==> "BuildPackage"
==> "All"
=?> ("ReleaseDocs",isLocalBuild)

"GenerateHelp"
==> "GenerateReferenceDocs"
Expand All @@ -393,4 +381,7 @@ Target "All" DoNothing
==> "PublishNuget"
==> "Release"

"ReleaseDocs"
==> "Release"

RunTargetOrDefault "All"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
17 changes: 17 additions & 0 deletions docs/output/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
This file is in the `docs/output` directory.

This directory will contain the final artifacts for both narrative and API documentation.
This folder will be automatically created by the documenation generation process.

**It is strongly recommended that nothing be put into this directory.**

It is **strongly advised** that the **contents of this directory not be committed** to source control
(with the sole exception being this `README.md` file).

---

NOTE:

This file is a placeholder, used to preserve directory structure in Git.

This file does not need to be edited.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------
// Builds the documentation from `.fsx` and `.md` files in the 'docsraw/content' directory
// (the generated documentation is stored in the 'docsraw/output' directory)
// Builds the documentation from `.fsx` and `.md` files in the 'docs/content' directory
// (the generated documentation is stored in the 'docs/output' directory)
// --------------------------------------------------------------------------------------

// Binaries that have XML documentation (in a corresponding generated XML file)
Expand Down Expand Up @@ -41,13 +41,13 @@ open FSharp.MetadataFormat
#if RELEASE
let root = website
#else
let root = "file://" + (__SOURCE_DIRECTORY__ @@ "../../docs")
let root = "file://" + (__SOURCE_DIRECTORY__ @@ "../output")
#endif

// Paths with template/source/output locations
let bin = __SOURCE_DIRECTORY__ @@ "../../bin"
let content = __SOURCE_DIRECTORY__ @@ "../content"
let output = __SOURCE_DIRECTORY__ @@ "../../docs"
let output = __SOURCE_DIRECTORY__ @@ "../output"
let files = __SOURCE_DIRECTORY__ @@ "../files"
let templates = __SOURCE_DIRECTORY__ @@ "templates"
let formatting = __SOURCE_DIRECTORY__ @@ "../../packages/build/FSharp.Formatting/"
Expand Down
File renamed without changes.
27 changes: 26 additions & 1 deletion init.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,31 @@ open System.Collections.Generic
// It generates the build.fsx and generate.fsx files
// --------------------------------

let checkFSharpInstallation () =
try
MSBuildRelease "." "CheckFSharpInstallation" ["CheckFSharpInstallation.fsproj"] |> ignore
true
with e ->
false

if File.Exists("CheckFSharpInstallation.fsproj") then
if checkFSharpInstallation() then
File.Delete "CheckFSharpInstallation.fsproj" // F# is installed, no need to check again if init.fsx gets run a second time somehow
else
traceError "F# does not seem to be installed."
if isMacOS then
traceError "Please install F# (see http://fsharp.org/use/mac/ for instructions),"
elif isWindows then
traceError "Please install F# (see http://fsharp.org/use/windows/ for instructions),"
elif isUnix then
traceError "Please install the \"fsharp\" package with your system's standard package manager,"
if isLinux then
traceError "(e.g., \"sudo apt-get install fsharp\" or \"sudo yum install fsharp\"),"
else
traceError "Please install F# (see http://fsharp.org/ for instructions),"
traceError "then run the build script again."
failwith "Build script aborted: please install F# and try again."

let dirsWithProjects = ["src";"tests";"docsraw/content"]
|> List.map (fun d -> directoryInfo (__SOURCE_DIRECTORY__ @@ d))

Expand Down Expand Up @@ -210,7 +235,7 @@ let generate templatePath generatedFilePath =
print (sprintf "# Generated %s" generatedFilePath)

generate (localFile "build.template") (localFile "build.fsx")
generate (localFile "docsraw/tools/generate.template") (localFile "docsraw/tools/generate.fsx")
generate (localFile "docs/tools/generate.template") (localFile "docs/tools/generate.fsx")

//Handle source control
let isGitRepo () =
Expand Down
13 changes: 10 additions & 3 deletions paket.dependencies
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
framework: >= net45
source https://nuget.org/api/v2

nuget FSharp.Core redirects: force
# The setting below means your libraries will assume a minimum target of .NET 4.5 + F# 4.0.
#
# To increase the minimum assumed .NET Framework, change the TargetFrameworkVersion in the .fsproj project files.
#
# To increase the minimum assumed F# version to F# 4.1, change to
# nuget FSharp.Core ~> 4.1.0 redirects: force

nuget FSharp.Core ~> 4.0.0.1 redirects: force

group Build
source https://nuget.org/api/v2

nuget SourceLink.Fake
nuget FAKE
nuget FSharp.Formatting

Expand All @@ -15,4 +22,4 @@ group Test
source https://nuget.org/api/v2

nuget NUnit ~> 2
nuget NUnit.Runners ~> 2
nuget NUnit.Runners ~> 2
8 changes: 4 additions & 4 deletions paket.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FRAMEWORK: >= NET45
NUGET
remote: https://www.nuget.org/api/v2
FSharp.Core (4.0.0.1) - redirects: force

GROUP Build
NUGET
remote: https://www.nuget.org/api/v2
FAKE (4.38.3)
FAKE (4.61.3)
FSharp.Compiler.Service (2.0.0.6)
FSharp.Formatting (2.14.4)
FSharp.Compiler.Service (2.0.0.6)
Expand All @@ -18,12 +19,11 @@ NUGET
Microsoft.Net.Http (2.2.29) - framework: net10, net11, net20, net30, net35, net40, net40-full
Microsoft.Bcl (>= 1.1.10)
Microsoft.Bcl.Build (>= 1.0.14)
Octokit (0.21.1)
Octokit (0.24)
Microsoft.Net.Http - framework: net10, net11, net20, net30, net35, net40, net40-full
SourceLink.Fake (1.1)
GITHUB
remote: fsharp/FAKE
modules/Octokit/Octokit.fsx (487d6a0dcf0f4b5450c9ce4cefa0a02b478166d9)
modules/Octokit/Octokit.fsx (ad65548e62c35ad64ad1f9db6f5768330bc06594)
Octokit (>= 0.20)
GROUP Test
NUGET
Expand Down
Loading

0 comments on commit 4e384b9

Please sign in to comment.