1
1
#r @" paket:
2
2
source https://api.nuget.org/v3/index.json
3
3
framework: net6.0
4
- storage: none
5
- nuget FSharp.Core
4
+ nuget FSharp.Core 6.0.0.0
6
5
nuget Fake.Core.Target
7
6
nuget Fake.Core.Trace
8
7
nuget Fake.Core.ReleaseNotes
67
66
let release = ReleaseNotes.load " RELEASE_NOTES.md"
68
67
69
68
// Helper active pattern for project types
70
- let (| Fsproj | Csproj | Vbproj |) ( projFileName : string ) =
69
+ let (| Fsproj | Csproj | Vbproj |) ( projFileName : string ) =
71
70
match projFileName with
72
71
| f when f.EndsWith( " fsproj" ) -> Fsproj
73
72
| f when f.EndsWith( " csproj" ) -> Csproj
74
73
| f when f.EndsWith( " vbproj" ) -> Vbproj
75
- | _ -> failwith ( sprintf " Project file %s not supported. Unknown project type." projFileName)
74
+ | _ -> failwith ( sprintf " Project file %s not supported. Unknown project type." projFileName)
76
75
77
76
// Generate assembly info files with the right version & up-to-date information
78
77
Target.create " AssemblyInfo" ( fun _ ->
79
78
let getAssemblyInfoAttributes projectName =
80
- [ AssemblyInfo.Title ( projectName)
79
+ [ AssemblyInfo.Title( projectName)
81
80
AssemblyInfo.Product project
82
81
AssemblyInfo.Description summary
83
82
AssemblyInfo.Version release.AssemblyVersion
84
83
AssemblyInfo.FileVersion release.AssemblyVersion ]
85
84
86
- let getProjectDetails ( projectPath : string ) =
85
+ let getProjectDetails ( projectPath : string ) =
87
86
let projectName = System.IO.Path.GetFileNameWithoutExtension( projectPath)
88
- ( projectPath,
89
- projectName,
90
- Path.GetDirectoryName( projectPath),
91
- ( getAssemblyInfoAttributes projectName)
92
- )
87
+ ( projectPath, projectName, Path.GetDirectoryName( projectPath), ( getAssemblyInfoAttributes projectName))
93
88
94
89
!! " src/**/*.??proj"
95
90
|> Seq.filter ( fun x -> not <| x.Contains( " .netstandard" ))
@@ -98,46 +93,39 @@ Target.create "AssemblyInfo" (fun _ ->
98
93
match projFileName with
99
94
| Fsproj -> AssemblyInfoFile.createFSharp ( folderName @@ " AssemblyInfo.fs" ) attributes
100
95
| Csproj -> AssemblyInfoFile.createCSharp (( folderName @@ " Properties" ) @@ " AssemblyInfo.cs" ) attributes
101
- | Vbproj -> AssemblyInfoFile.createVisualBasic (( folderName @@ " My Project" ) @@ " AssemblyInfo.vb" ) attributes
102
- )
103
- )
96
+ | Vbproj -> AssemblyInfoFile.createVisualBasic (( folderName @@ " My Project" ) @@ " AssemblyInfo.vb" ) attributes))
104
97
105
98
// Copies binaries from default VS location to expected bin folder
106
99
// But keeps a subdirectory structure for each project in the
107
100
// src folder to support multiple project outputs
108
101
Target.create " CopyBinaries" ( fun _ ->
109
102
!! " src/**/*.??proj"
110
- |> Seq.map ( fun f -> (( Path.GetDirectoryName f) @@ " bin/Release" , " bin" @@ ( Path.GetFileNameWithoutExtension f)))
111
- |> Seq.iter ( fun ( fromDir , toDir ) -> Shell.copyDir toDir fromDir ( fun _ -> true ))
112
- )
103
+ |> Seq.map ( fun f -> (( Path.GetDirectoryName f) @@ " bin/Release" , " bin" @@ ( Path.GetFileNameWithoutExtension f)))
104
+ |> Seq.iter ( fun ( fromDir , toDir ) -> Shell.copyDir toDir fromDir ( fun _ -> true )))
113
105
114
106
// --------------------------------------------------------------------------------------
115
107
// Clean build results
116
108
117
109
Target.create " Clean" ( fun _ ->
118
110
Shell.cleanDirs
119
- [
120
- " bin" ; " temp" ;
121
- " src/FsUnit.NUnit/bin/" ;
122
- " src/FsUnit.NUnit/obj/" ;
123
- " src/FsUnit.Xunit/bin/" ;
124
- " src/FsUnit.Xunit/obj/" ;
125
- " src/FsUnit.MsTestUnit/bin/"
126
- " src/FsUnit.MsTestUnit/obj/"
127
- ]
128
- )
129
-
130
- Target.create " CleanDocs" ( fun _ ->
131
- Shell.cleanDirs [ " docs/output" ]
132
- )
111
+ [ " bin"
112
+ " temp"
113
+ " src/FsUnit.NUnit/bin/"
114
+ " src/FsUnit.NUnit/obj/"
115
+ " src/FsUnit.Xunit/bin/"
116
+ " src/FsUnit.Xunit/obj/"
117
+ " src/FsUnit.MsTestUnit/bin/"
118
+ " src/FsUnit.MsTestUnit/obj/" ])
119
+
120
+ Target.create " CleanDocs" ( fun _ -> Shell.cleanDirs [ " docs/output" ])
133
121
134
122
// --------------------------------------------------------------------------------------
135
123
// Check code format & format code using Fantomas
136
124
137
125
let sourceFiles =
138
126
!! " src/**/*.fs"
139
- ++ " tests/**/*.fs"
140
- -- " ./**/*Assembly*.fs"
127
+ ++ " tests/**/*.fs"
128
+ -- " ./**/*Assembly*.fs"
141
129
142
130
Target.create " CheckFormat" ( fun _ ->
143
131
let result =
@@ -152,8 +140,7 @@ Target.create "CheckFormat" (fun _ ->
152
140
elif result.ExitCode = 99 then
153
141
failwith " Some files need formatting, check output for more info"
154
142
else
155
- Trace.logf " Errors while formatting: %A " result.Errors
156
- )
143
+ Trace.logf " Errors while formatting: %A " result.Errors)
157
144
158
145
Target.create " Format" ( fun _ ->
159
146
let result =
@@ -163,62 +150,66 @@ Target.create "Format" (fun _ ->
163
150
|> DotNet.exec id " fantomas"
164
151
165
152
if not result.OK then
166
- printfn " Errors while formatting all files: %A " result.Messages
167
- )
153
+ printfn " Errors while formatting all files: %A " result.Messages)
168
154
169
155
// --------------------------------------------------------------------------------------
170
156
// Build library & test project
171
157
172
158
Target.create " Build" ( fun _ ->
173
159
let result = DotNet.exec id " build" " FsUnit.sln -c Release"
174
- if not result.OK
175
- then failwithf " Build failed: %A " result.Errors
176
- )
160
+
161
+ if not result.OK then
162
+ failwithf " Build failed: %A " result.Errors )
177
163
178
164
// --------------------------------------------------------------------------------------
179
165
// Run the unit tests using test runner
180
166
181
167
Target.create " NUnit" ( fun _ ->
182
- DotNet.test id " tests/FsUnit.NUnit.Test/"
183
- )
168
+ let result = DotNet.exec id " test" " tests/FsUnit.NUnit.Test/"
184
169
185
- Target.create " xUnit" ( fun _ ->
186
- DotNet.test id " tests/FsUnit.Xunit.Test/"
187
- )
170
+ if not result.OK then
171
+ failwithf " NUnit test failed: %A " result.Errors)
188
172
189
- Target.create " MsTest" ( fun _ ->
190
- DotNet.test id " tests/FsUnit.MsTest.Test/"
191
- )
173
+ Target.create " xUnit" ( fun _ ->
174
+ let result = DotNet.exec id " test" " tests/FsUnit.Xunit.Test/"
175
+
176
+ if not result.OK then
177
+ failwithf " xUnit test failed: %A " result.Errors)
178
+
179
+ Target.create " MsTest" ( fun _ ->
180
+ let result = DotNet.exec id " test" " tests/FsUnit.MsTest.Test/"
181
+
182
+ if not result.OK then
183
+ failwithf " MsTest test failed: %A " result.Errors)
192
184
193
185
Target.create " RunTests" ignore
194
186
195
187
// --------------------------------------------------------------------------------------
196
188
// Build a NuGet package
197
189
198
190
Target.create " NuGet" ( fun _ ->
199
- Paket.pack( fun p ->
191
+ Paket.pack ( fun p ->
200
192
{ p with
201
193
ToolType = ToolType.CreateLocalTool()
202
194
OutputPath = " bin"
203
- Version = release.NugetVersion
204
- ReleaseNotes = String.toLines release.Notes})
205
- )
195
+ Version = release.AssemblyVersion
196
+ ReleaseNotes = String.toLines release.Notes }))
206
197
207
198
Target.create " PublishNuget" ( fun _ ->
208
- Paket.push( fun p ->
199
+ Paket.push ( fun p ->
209
200
{ p with
210
201
ToolType = ToolType.CreateLocalTool()
211
- WorkingDir = " bin" })
212
- )
202
+ WorkingDir = " bin" }))
213
203
214
204
215
205
// --------------------------------------------------------------------------------------
216
206
// Generate the documentation
217
207
218
208
Target.create " GenerateDocs" ( fun _ ->
219
- Shell.cleanDir " .fsdocs"
220
- DotNet.exec id " fsdocs" " build --clean --parameters root https://fsprojects.github.io/FsUnit" |> ignore
221
- )
209
+ Shell.cleanDir " .fsdocs"
210
+
211
+ DotNet.exec id " fsdocs" " build --clean --parameters root https://fsprojects.github.io/FsUnit"
212
+ |> ignore)
222
213
// --------------------------------------------------------------------------------------
223
214
// Release Scripts
224
215
@@ -231,8 +222,7 @@ Target.create "ReleaseDocs" (fun _ ->
231
222
Shell.copyRecursive " output" tempDocsDir true |> Trace.tracefn " %A "
232
223
Staging.stageAll tempDocsDir
233
224
Commit.exec tempDocsDir ( sprintf " Update generated documentation for version %s " release.NugetVersion)
234
- Branches.push tempDocsDir
235
- )
225
+ Branches.push tempDocsDir)
236
226
237
227
// --------------------------------------------------------------------------------------
238
228
// Run all targets by default. Invoke 'build <Target>' to override
0 commit comments