22// FAKE build script
33// --------------------------------------------------------------------------------------
44
5- #I @" packages/build/FAKE/tools"
65#r @" packages/build/FAKE/tools/FakeLib.dll"
6+ #load " tools/fakexunithelper.fsx" // helper for xunit 1 is gone, work around by having our own copy for now
77
88open System
99open System.IO
10- open Fake
11- open Fake.AssemblyInfoFile
10+ open Fake.Core
1211open Fake.Git
12+ open Fake.IO
13+ open Fake.IO .FileSystemOperators
14+ open Fake.IO .Globbing
15+ open Fake.IO .Globbing .Operators
16+ open Fake.DotNet
1317
1418Environment.CurrentDirectory <- __ SOURCE_ DIRECTORY__
1519
@@ -31,7 +35,7 @@ let gitName = "FSharp.Data.SqlClient"
3135// Read release notes & version info from RELEASE_NOTES.md
3236let release =
3337 File.ReadLines " RELEASE_NOTES.md"
34- |> ReleaseNotesHelper.parseReleaseNotes
38+ |> Fake.Core.ReleaseNotes.parse
3539
3640let version = release.AssemblyVersion
3741let releaseNotes = release.Notes |> String.concat " \n "
@@ -40,33 +44,33 @@ let testDir = "bin"
4044// --------------------------------------------------------------------------------------
4145// Generate assembly info files with the right version & up-to-date information
4246
43- Target " AssemblyInfo" ( fun _ ->
47+ Target.create " AssemblyInfo" ( fun _ ->
4448 [ " src/SqlClient/AssemblyInfo.fs" , " SqlClient" , project, summary ]
4549 |> Seq.iter ( fun ( fileName , title , project , summary ) ->
46- CreateFSharpAssemblyInfo fileName
47- [ Attribute .Title title
48- Attribute .Product project
49- Attribute .Description summary
50- Attribute .Version version
51- Attribute .FileVersion version
52- Attribute .InternalsVisibleTo " SqlClient.Tests" ] )
50+ AssemblyInfoFile.createFSharp fileName
51+ [ AssemblyInfo .Title title
52+ AssemblyInfo .Product project
53+ AssemblyInfo .Description summary
54+ AssemblyInfo .Version version
55+ AssemblyInfo .FileVersion version
56+ AssemblyInfo .InternalsVisibleTo " SqlClient.Tests" ] )
5357)
5458
55- Target " Clean" ( fun _ ->
56- CleanDirs [ " bin" ; " temp" ]
59+ Target.create " Clean" ( fun _ ->
60+ Shell.cleanDirs [ " bin" ; " temp" ]
5761)
5862
59- Target " CleanDocs" ( fun _ ->
60- CleanDirs [ " docs/output" ]
63+ Target.create " CleanDocs" ( fun _ ->
64+ Shell.cleanDirs [ " docs/output" ]
6165)
6266
6367// --------------------------------------------------------------------------------------
6468// Build library (builds Visual Studio solution, which builds multiple versions
6569// of the runtime library & desktop + Silverlight version of design time library)
6670
67- Target " Build" ( fun _ ->
71+ Target.create " Build" ( fun _ ->
6872 files ([ " SqlClient.sln" ])
69- |> MSBuildRelease " " " Rebuild"
73+ |> MSBuild.runRelease id " " " Rebuild"
7074 |> ignore
7175)
7276
@@ -80,7 +84,7 @@ open System.Data.SqlClient
8084open System.Configuration
8185open System.IO .Compression
8286
83- Target " DeployTestDB" ( fun () ->
87+ Target.create " DeployTestDB" ( fun _ ->
8488 let testsSourceRoot = Path.GetFullPath( @" src\SqlClient.Tests" )
8589 let map = ExeConfigurationFileMap()
8690 map.ExeConfigFilename <- testsSourceRoot @@ " app.config"
@@ -135,34 +139,35 @@ Target "DeployTestDB" (fun() ->
135139 cmd.ExecuteNonQuery() |> ignore
136140)
137141
138- Target " BuildTests" ( fun _ ->
142+ Target.create " BuildTests" ( fun _ ->
139143 files [ " Tests.sln" ]
140- |> MSBuildReleaseExt " " ([]) " Rebuild"
144+ |> MSBuild.runReleaseExt id " " ([]) " Rebuild"
141145 |> ignore
142146)
143147
144148// --------------------------------------------------------------------------------------
145149// Run the unit tests
146- Target " RunTests" ( fun _ ->
150+ Target.create " RunTests" ( fun _ ->
147151 !! ( testDir + " /*.Tests.dll" )
148- |> xUnit ( fun p ->
152+ |> Fake.XUnitHelper. xUnit ( fun p ->
149153 { p with
150- ShadowCopy = false ;
151- HtmlOutput = true ;
152- XmlOutput = true ;
153- OutputDir = testDir})
154+ ShadowCopy = false
155+ HtmlOutput = true
156+ XmlOutput = true
157+ WorkingDir = testDir
158+ })
154159)
155160
156161// --------------------------------------------------------------------------------------
157162// Build a NuGet package
158163
159- Target " NuGet" ( fun _ ->
164+ Target.create " NuGet" ( fun _ ->
160165
161166 // Format the description to fit on a single line (remove \r\n and double-spaces)
162167 let description = description.Replace( " \r " , " " ) .Replace( " \n " , " " ) .Replace( " " , " " )
163168 let nugetPath = " packages/build/NuGet.CommandLine/tools/NuGet.exe"
164-
165- NuGet ( fun p ->
169+
170+ Fake.DotNet.NuGet.NuGet. NuGet ( fun p ->
166171 { p with
167172 Authors = authors
168173 Project = project
@@ -173,35 +178,37 @@ Target "NuGet" (fun _ ->
173178 Tags = tags
174179 OutputPath = " nuget"
175180 ToolPath = nugetPath
176- AccessKey = getBuildParamOrDefault " nugetkey" " "
177- Publish = hasBuildParam " nugetkey"
181+ AccessKey = Fake.Core.Environment.environVarOrDefault " nugetkey" " "
182+ Publish = Fake.Core.Environment.hasEnvironVar " nugetkey"
178183 Dependencies = [] })
179184 " nuget/SqlClient.nuspec"
180185)
181186
182187// --------------------------------------------------------------------------------------
183188// Generate the documentation
184189
185- Target " GenerateDocs" ( fun _ ->
186- executeFSIWithArgs " docs/tools" " generate.fsx" [ " --define:RELEASE" ] [] |> ignore
190+ Target.create " GenerateDocs" ( fun _ ->
191+ Fake.FSIHelper. executeFSIWithArgs " docs/tools" " generate.fsx" [ " --define:RELEASE" ] [] |> ignore
187192)
188193
189- Target " ReleaseDocs" ( fun _ ->
194+ Target.create " ReleaseDocs" ( fun _ ->
190195 Repository.clone " " ( gitHome + " /" + gitName + " .git" ) " temp/gh-pages"
191196 Branches.checkoutBranch " temp/gh-pages" " gh-pages"
192- CopyRecursive " docs/output" " temp/gh-pages" true |> printfn " %A "
197+ Shell.copyRecursive " docs/output" " temp/gh-pages" true |> printfn " %A "
193198 CommandHelper.runSimpleGitCommand " temp/gh-pages" " add ." |> printfn " %s "
194199 let cmd = sprintf """ commit -a -m "Update generated documentation for version %s """ release.NugetVersion
195200 CommandHelper.runSimpleGitCommand " temp/gh-pages" cmd |> printfn " %s "
196201 Branches.push " temp/gh-pages"
197202)
198203
199- Target " Release" DoNothing
204+ Target.create " Release" Target. DoNothing
200205
201206// --------------------------------------------------------------------------------------
202207// Run all targets by default. Invoke 'build <Target>' to override
203208
204- Target " All" DoNothing
209+ Target.create " All" Target.DoNothing
210+
211+ open Fake.Core .TargetOperators // for ==>
205212
206213" Clean"
207214 ==> " AssemblyInfo"
@@ -220,5 +227,5 @@ Target "All" DoNothing
220227 ==> " GenerateDocs"
221228 ==> " ReleaseDocs"
222229
223- RunTargetOrDefault " All"
230+ Target.runOrDefault " All"
224231
0 commit comments