Skip to content

Commit

Permalink
Merge pull request #116 from Vidarls/multiproject
Browse files Browse the repository at this point in the history
[Suggestion] Support for multiple projects with deliverable output
  • Loading branch information
forki committed Mar 5, 2015
2 parents 2540a12 + 8c3ccbe commit b801219
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 deletions.
11 changes: 10 additions & 1 deletion build.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// --------------------------------------------------------------------------------------

#r @"packages/FAKE/tools/FakeLib.dll"

open Fake
open Fake.Git
open Fake.AssemblyInfoFile
Expand Down Expand Up @@ -100,6 +99,15 @@ Target "AssemblyInfo" (fun _ ->
csProjs |> Seq.iter genCSAssemblyInfo
)

// Copies binaries from default VS location to exepcted bin folder
// But keeps a subdirectory structure for each project in the
// src folder to support multiple project outputs
Target "CopyBinaries" (fun _ ->
!! "src/**/*.??proj"
|> Seq.map (fun f -> ((System.IO.Path.GetDirectoryName f) @@ "bin/Release", "bin" @@ (System.IO.Path.GetFileNameWithoutExtension f)))
|> Seq.iter (fun (fromDir, toDir) -> CopyDir toDir fromDir (fun _ -> true))
)

// --------------------------------------------------------------------------------------
// Clean build results

Expand Down Expand Up @@ -333,6 +341,7 @@ Target "All" DoNothing
"Clean"
==> "AssemblyInfo"
==> "Build"
==> "CopyBinaries"
==> "RunTests"
=?> ("GenerateReferenceDocs",isLocalBuild)
=?> ("GenerateDocs",isLocalBuild)
Expand Down
21 changes: 14 additions & 7 deletions docs/tools/generate.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// (the generated documentation is stored in the 'docs/output' directory)
// --------------------------------------------------------------------------------------

// Binaries that have XML documentation (in a corresponding generated XML file)
let referenceBinaries = [ "##ProjectName##.dll" ]
// Web site location for the generated documentation
let website = "/##ProjectName##"

Expand Down Expand Up @@ -86,19 +84,28 @@ let references =
|> Some
else None

let binaries =
directoryInfo bin
|> subDirectories
|> Array.map (fun d -> d.FullName @@ (sprintf "%s.dll" d.Name))
|> List.ofArray

let libDirs =
directoryInfo bin
|> subDirectories
|> Array.map (fun d -> d.FullName)
|> List.ofArray

// Build API reference from XML comments
let buildReference () =
CleanDir (output @@ "reference")
let binaries =
referenceBinaries
|> List.map (fun lib-> bin @@ lib)
MetadataFormat.Generate
( binaries, output @@ "reference", layoutRootsAll.["en"],
parameters = ("root", root)::info,
sourceRepo = githubLink @@ "tree/master",
sourceFolder = __SOURCE_DIRECTORY__ @@ ".." @@ "..",
publicOnly = true, libDirs = [bin],
?assemblyReferences = references )
?assemblyReferences = references,
publicOnly = true,libDirs = libDirs )

// Build documentation from `fsx` and `md` files in `docs/content`
let buildDocumentation () =
Expand Down
2 changes: 1 addition & 1 deletion paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ nuget NUnit.Runners
nuget FAKE
nuget SourceLink.Fake

github fsharp/FAKE modules/Octokit/Octokit.fsx
github fsharp/FAKE modules/Octokit/Octokit.fsx
10 changes: 5 additions & 5 deletions src/FSharp.ProjectTemplate/FSharp.ProjectTemplate.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<Tailcalls>false</Tailcalls>
<OutputPath>..\..\bin</OutputPath>
<OutputPath>.\bin\Debug</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<DocumentationFile>..\..\bin\FSharp.ProjectTemplate.xml</DocumentationFile>
<DocumentationFile>.\bin\Debug\FSharp.ProjectTemplate.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<Tailcalls>true</Tailcalls>
<OutputPath>..\..\bin</OutputPath>
<OutputPath>.\bin\Release</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<DocumentationFile>..\..\bin\FSharp.ProjectTemplate.xml</DocumentationFile>
<DocumentationFile>.\bin\Release\FSharp.ProjectTemplate.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="mscorlib" />
Expand Down Expand Up @@ -72,4 +72,4 @@
</Target>
-->
<Import Project="..\..\.paket\paket.targets" />
</Project>
</Project>

0 comments on commit b801219

Please sign in to comment.