77open Fake
88open Fake.Git
99open Fake.ReleaseNotesHelper
10+ open Fake.AssemblyInfoFile
1011open System
1112open System.IO
1213
@@ -21,6 +22,8 @@ let project = "src/FSharp.Control.AsyncSeq"
2122// File system information
2223let solutionFile = " FSharp.Control.AsyncSeq.sln"
2324
25+ let summary = " Asynchronous sequences for F#"
26+
2427let buildDir = " bin"
2528
2629// Git configuration (used for publishing documentation in gh-pages branch)
@@ -56,6 +59,43 @@ Target "Restore" (fun _ ->
5659 DotNetCli.Restore id
5760)
5861
62+ // Helper active pattern for project types
63+ let (| Fsproj | Csproj | Vbproj | Shproj |) ( projFileName : string ) =
64+ match projFileName with
65+ | f when f.EndsWith( " fsproj" ) -> Fsproj
66+ | f when f.EndsWith( " csproj" ) -> Csproj
67+ | f when f.EndsWith( " vbproj" ) -> Vbproj
68+ | f when f.EndsWith( " shproj" ) -> Shproj
69+ | _ -> failwith ( sprintf " Project file %s not supported. Unknown project type." projFileName)
70+
71+ // Generate assembly info files with the right version & up-to-date information
72+ Target " AssemblyInfo" ( fun _ ->
73+ let getAssemblyInfoAttributes projectName =
74+ [ Attribute.Title ( projectName)
75+ Attribute.Product project
76+ Attribute.Description summary
77+ Attribute.Version release.AssemblyVersion
78+ Attribute.FileVersion release.AssemblyVersion ]
79+
80+ let getProjectDetails projectPath =
81+ let projectName = System.IO.Path.GetFileNameWithoutExtension( projectPath)
82+ ( projectPath,
83+ projectName,
84+ System.IO.Path.GetDirectoryName( projectPath),
85+ ( getAssemblyInfoAttributes projectName)
86+ )
87+
88+ !! " src/**/*.??proj"
89+ |> Seq.map getProjectDetails
90+ |> Seq.iter ( fun ( projFileName , projectName , folderName , attributes ) ->
91+ match projFileName with
92+ | Fsproj -> CreateFSharpAssemblyInfo ( folderName </> " AssemblyInfo.fs" ) attributes
93+ | Csproj -> CreateCSharpAssemblyInfo (( folderName </> " Properties" ) </> " AssemblyInfo.cs" ) attributes
94+ | Vbproj -> CreateVisualBasicAssemblyInfo (( folderName </> " My Project" ) </> " AssemblyInfo.vb" ) attributes
95+ | Shproj -> ()
96+ )
97+ )
98+
5999// --------------------------------------------------------------------------------------
60100// Build library & test project
61101
0 commit comments