forked from fsprojects/FAKE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.fsx
1228 lines (1074 loc) · 49 KB
/
build.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#if BOOTSTRAP
#r "paket:
source release/dotnetcore
source https://api.nuget.org/v3/index.json
nuget FSharp.Core ~> 4.1
nuget System.AppContext prerelease
nuget Paket.Core prerelease
nuget Fake.Api.GitHub prerelease
nuget Fake.BuildServer.AppVeyor prerelease
nuget Fake.BuildServer.TeamCity prerelease
nuget Fake.BuildServer.Travis prerelease
nuget Fake.BuildServer.TeamFoundation prerelease
nuget Fake.BuildServer.GitLab prerelease
nuget Fake.Core.Target prerelease
nuget Fake.Core.SemVer prerelease
nuget Fake.Core.Vault prerelease
nuget Fake.IO.FileSystem prerelease
nuget Fake.IO.Zip prerelease
nuget Fake.Core.ReleaseNotes prerelease
nuget Fake.DotNet.AssemblyInfoFile prerelease
nuget Fake.DotNet.MSBuild prerelease
nuget Fake.DotNet.Cli prerelease
nuget Fake.DotNet.NuGet prerelease
nuget Fake.DotNet.Paket prerelease
nuget Fake.DotNet.FSFormatting prerelease
nuget Fake.DotNet.Testing.MSpec prerelease
nuget Fake.DotNet.Testing.XUnit2 prerelease
nuget Fake.DotNet.Testing.NUnit prerelease
nuget Fake.Windows.Chocolatey prerelease
nuget Fake.Tools.Git prerelease
nuget Mono.Cecil prerelease
nuget System.Reactive.Compatibility
nuget Suave
nuget Newtonsoft.Json
nuget Octokit //"
#endif
// We need to use this for now as "regular" Fake breaks when its caching logic cannot find "intellisense.fsx".
// This is the reason why we need to checkin the "intellisense.fsx" file for now...
#load ".fake/build.fsx/intellisense.fsx"
#load "legacy-build.fsx"
open System.Reflection
//#if !FAKE
//let execContext = Fake.Core.Context.FakeExecutionContext.Create false "build.fsx" []
//Fake.Core.Context.setExecutionContext (Fake.Core.Context.RuntimeContext.Fake execContext)
//#endif
open System.IO
open Fake.Api
open Fake.Core
open Fake.BuildServer
open Fake.Tools
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.IO.Globbing.Operators
open Fake.Windows
open Fake.DotNet
open Fake.DotNet.Testing
// Set this to true if you have lots of breaking changes, for small breaking changes use #if BOOTSTRAP, setting this flag will not be accepted
let disableBootstrap = false
// properties
let projectName = "FAKE"
let projectSummary = "FAKE - F# Make - Get rid of the noise in your build scripts."
let projectDescription = "FAKE - F# Make - is a build automation tool for .NET. Tasks and dependencies are specified in a DSL which is integrated in F#."
let authors = ["Steffen Forkmann"; "Mauricio Scheffer"; "Colin Bull"; "Matthias Dittrich"]
// The name of the project on GitHub
let gitName = "FAKE"
let release = ReleaseNotes.load "RELEASE_NOTES.md"
let buildDir = "./build"
let testDir = "./test"
let docsDir = "./docs"
let apidocsDir = "./docs/apidocs/"
let releaseDir = "./release"
let nugetDncDir = releaseDir </> "dotnetcore"
let chocoReleaseDir = nugetDncDir </> "chocolatey"
let nugetLegacyDir = releaseDir </> "legacy"
let reportDir = "./report"
let packagesDir = "./packages"
let buildMergedDir = buildDir </> "merged"
let root = __SOURCE_DIRECTORY__
let srcDir = root</>"src"
let appDir = srcDir</>"app"
let templateDir = srcDir</>"template"
let legacyDir = srcDir</>"legacy"
let nuget_exe = Directory.GetCurrentDirectory() </> "packages" </> "build" </> "NuGet.CommandLine" </> "tools" </> "NuGet.exe"
let vault = ``Legacy-build``.vault
let getVarOrDefault name def = ``Legacy-build``.getVarOrDefault name def
let releaseSecret replacement name = ``Legacy-build``.releaseSecret replacement name
let github_release_user = getVarOrDefault "github_release_user" "fsharp"
let nugetsource = getVarOrDefault "nugetsource" "https://www.nuget.org/api/v2/package"
let chocosource = getVarOrDefault "chocosource" "https://push.chocolatey.org/"
let artifactsDir = getVarOrDefault "artifactsdirectory" ""
let docsDomain = getVarOrDefault "docs_domain" "fake.build"
let buildLegacy = System.Boolean.Parse(getVarOrDefault "BuildLegacy" "false")
let fromArtifacts = not <| String.isNullOrEmpty artifactsDir
let apikey = releaseSecret "<nugetkey>" "nugetkey"
let chocoKey = releaseSecret "<chocokey>" "CHOCOLATEY_API_KEY"
let githubtoken = releaseSecret "<githubtoken>" "github_token"
BuildServer.install [
AppVeyor.Installer
TeamCity.Installer
Travis.Installer
TeamFoundation.Installer
GitLab.Installer
]
let version = ``Legacy-build``.version
let simpleVersion = ``Legacy-build``.simpleVersion
let nugetVersion = ``Legacy-build``.nugetVersion
let chocoVersion =
// Replace "." with "-" in the prerelease-string
let build =
if version.Build > 0I then ("." + (let bi = version.Build in bi.ToString("D"))) else ""
let pre =
match version.PreRelease with
| Some preRelease -> ("-" + preRelease.Origin.Replace(".", "-"))
| None -> ""
let result = sprintf "%d.%d.%d%s%s" version.Major version.Minor version.Patch build pre
if pre.Length > 20 then
let msg = sprintf "Version '%s' is too long for chocolatey (Prerelease string is max 20 chars)" result
Trace.traceError msg
failwithf "%s" msg
result
match TeamFoundation.Environment.SystemPullRequestIsFork with
| None | Some false ->
Trace.setBuildNumber nugetVersion
| _ ->
Trace.traceFAKE "Not setting buildNumber to '%s', because of https://developercommunity.visualstudio.com/content/problem/350007/build-from-github-pr-fork-error-tf400813-the-user-1.html" nugetVersion
let dotnetSdk = lazy DotNet.install DotNet.Versions.FromGlobalJson
let inline dtntWorkDir wd =
DotNet.Options.lift dotnetSdk.Value
>> DotNet.Options.withWorkingDirectory wd
let inline dtntSmpl arg = DotNet.Options.lift dotnetSdk.Value arg
let publish f =``Legacy-build``.publish f
let cleanForTests () =
// Clean NuGet cache (because it might contain appveyor stuff)
let cacheFolders = [ Paket.Constants.UserNuGetPackagesFolder; Paket.Constants.NuGetCacheFolder ]
for f in cacheFolders do
printfn "Clearing FAKE-NuGet packages in %s" f
!! (f </> "Fake.*")
|> Seq.iter (Shell.rm_rf)
let run workingDir fileName args =
printfn "CWD: %s" workingDir
let fileName, args =
if Environment.isUnix
then fileName, args else "cmd", ("/C " + fileName + " " + args)
let ok =
Process.execSimple (fun info ->
{ info with
FileName = fileName
WorkingDirectory = workingDir
Arguments = args }
) System.TimeSpan.MaxValue
if ok <> 0 then failwith (sprintf "'%s> %s %s' task failed" workingDir fileName args)
let rmdir dir =
if Environment.isUnix
then Shell.rm_rf dir
// Use this in Windows to prevent conflicts with paths too long
else run "." "cmd" ("/C rmdir /s /q " + Path.GetFullPath dir)
// Clean test directories
!! "integrationtests/*/temp"
|> Seq.iter rmdir
Target.create "WorkaroundPaketNuspecBug" (fun _ ->
// Workaround https://github.com/fsprojects/Paket/issues/2830
// https://github.com/fsprojects/Paket/issues/2689
// Basically paket fails if there is already an existing nuspec in obj/ dir because then MSBuild will call paket with multiple nuspec file arguments separated by ';'
!! "src/*/*/obj/**/*.nuspec"
-- (sprintf "src/*/*/obj/**/*%s.nuspec" nugetVersion)
|> File.deleteAll
)
// Targets
Target.create "Clean" (fun _ ->
!! "src/*/*/bin"
//++ "src/*/*/obj"
|> Shell.cleanDirs
Shell.cleanDirs [buildDir; testDir; docsDir; apidocsDir; nugetDncDir; nugetLegacyDir; reportDir]
// Clean Data for tests
cleanForTests()
)
let common = [
AssemblyInfo.Product "FAKE - F# Make"
AssemblyInfo.Version release.AssemblyVersion
AssemblyInfo.InformationalVersion nugetVersion
AssemblyInfo.FileVersion nugetVersion]
// New FAKE libraries
let dotnetAssemblyInfos =
[ "dotnet-fake", "Fake dotnet-cli command line tool"
"fake-cli", "Fake global dotnet-cli command line tool"
"Fake.Api.GitHub", "GitHub Client API Support via Octokit"
"Fake.Api.HockeyApp", "HockeyApp Integration Support"
"Fake.Api.Slack", "Slack Integration Support"
"Fake.Azure.CloudServices", "Azure Cloud Services Support"
"Fake.Azure.Emulators", "Azure Emulators Support"
"Fake.Azure.Kudu", "Azure Kudu Support"
"Fake.Azure.WebJobs", "Azure Web Jobs Support"
"Fake.BuildServer.AppVeyor", "Integration into AppVeyor buildserver"
"Fake.BuildServer.GitLab", "Integration into GitLab-CI buildserver"
"Fake.BuildServer.TeamCity", "Integration into TeamCity buildserver"
"Fake.BuildServer.TeamFoundation", "Integration into TeamFoundation buildserver"
"Fake.BuildServer.Travis", "Integration into Travis buildserver"
"Fake.Core.CommandLineParsing", "Core commandline parsing support via docopt like syntax"
"Fake.Core.Context", "Core Context Infrastructure"
"Fake.Core.Environment", "Environment Detection"
"Fake.Core.Process", "Starting and managing Processes"
"Fake.Core.ReleaseNotes", "Parsing ReleaseNotes"
"Fake.Core.SemVer", "Parsing and working with SemVer"
"Fake.Core.String", "Core String manipulations"
"Fake.Core.Target", "Defining and running Targets"
"Fake.Core.Tasks", "Repeating and managing Tasks"
"Fake.Core.Trace", "Core Logging functionality"
"Fake.Core.UserInput", "User input helpers"
"Fake.Core.Vault", "Encrypt secrets and prevent accidental disclosure"
"Fake.Core.Xml", "Core Xml functionality"
"Fake.Documentation.DocFx", "Documentation with DocFx"
"Fake.DotNet.AssemblyInfoFile", "Writing AssemblyInfo files"
"Fake.DotNet.Cli", "Running the dotnet cli"
"Fake.DotNet.Fsc", "Running the f# compiler - fsc"
"Fake.DotNet.FSFormatting", "Running fsformatting.exe and generating documentation"
"Fake.DotNet.Fsi", "FSharp Interactive - fsi"
"Fake.DotNet.Mage", "Manifest Generation and Editing Tool"
"Fake.DotNet.MSBuild", "Running msbuild"
"Fake.DotNet.NuGet", "Running NuGet Client and interacting with NuGet Feeds"
"Fake.DotNet.Paket", "Running Paket and publishing packages"
"Fake.DotNet.Testing.DotCover", "Code coverage with DotCover"
"Fake.DotNet.Testing.Expecto", "Running expecto test runner"
"Fake.DotNet.Testing.MSpec", "Running mspec test runner"
"Fake.DotNet.Testing.MSTest", "Running mstest test runner"
"Fake.DotNet.Testing.NUnit", "Running nunit test runner"
"Fake.DotNet.Testing.OpenCover", "Code coverage with OpenCover"
"Fake.DotNet.Testing.SpecFlow", "BDD with Gherkin and SpecFlow"
"Fake.DotNet.Testing.VSTest", "Running vstest test runner"
"Fake.DotNet.Testing.XUnit2", "Running xunit test runner"
"Fake.DotNet.Xamarin", "Running Xamarin builds"
"Fake.Installer.InnoSetup", "Creating installers with InnoSetup"
"Fake.Installer.Squirrel", "Squirrel for windows Squirrel.exe tool helper"
"Fake.Installer.Wix", "WiX helper to create msi installers"
"Fake.IO.FileSystem", "Core Filesystem utilities and globbing support"
"Fake.IO.Zip", "Core Zip functionality"
"Fake.JavaScript.Npm", "Running npm commands"
"Fake.JavaScript.Yarn", "Running Yarn commands"
"Fake.Net.Http", "HTTP Client"
"Fake.netcore", "Command line tool"
"Fake.Runtime", "Core runtime features"
"Fake.Sql.DacPac", "Sql Server Data Tools DacPac operations"
"Fake.Sql.SqlServer", "Helpers around interacting with SQL Server databases"
"Fake.Testing.Common", "Common testing data types"
"Fake.Testing.ReportGenerator", "Convert XML coverage output to various formats"
"Fake.Testing.SonarQube", "Analyzing your project with SonarQube"
"Fake.Tools.Git", "Running git commands"
"Fake.Tools.GitVersion", "GitVersion helper"
"Fake.Tools.Octo", "Octopus Deploy octo.exe tool helper"
"Fake.Tools.Pickles", "Convert Gherkin to HTML"
"Fake.Tools.Rsync", "Running Rsync commands"
"Fake.Tracing.NAntXml", "NAntXml"
"Fake.Windows.Chocolatey", "Running and packaging with Chocolatey"
"Fake.Windows.Registry", "CRUD functionality for Windows registry" ]
let assemblyInfos =
(``Legacy-build``.legacyAssemblyInfos |> List.map (fun (proj, desc) -> proj, desc @ common)) @
(dotnetAssemblyInfos
|> List.map (fun (project, description) ->
appDir </> sprintf "%s/AssemblyInfo.fs" project, [AssemblyInfo.Title (sprintf "FAKE - F# Make %s" description) ] @ common))
Target.create "SetAssemblyInfo" (fun _ ->
for assemblyFile, attributes in assemblyInfos do
// Fixes merge conflicts in AssemblyInfo.fs files, while at the same time leaving the repository in a compilable state.
// http://stackoverflow.com/questions/32251037/ignore-changes-to-a-tracked-file
// Quick-fix: git ls-files -v . | grep ^S | cut -c3- | xargs git update-index --no-skip-worktree
Git.CommandHelper.directRunGitCommandAndFail "." (sprintf "update-index --skip-worktree %s" assemblyFile)
attributes |> AssemblyInfoFile.createFSharp assemblyFile
()
)
Target.create "DownloadPaket" (fun _ ->
if 0 <> Process.execSimple (fun info ->
{ info with
FileName = ".paket/paket.exe"
Arguments = "--version" }
|> Process.withFramework
) (System.TimeSpan.FromMinutes 5.0) then
failwith "paket failed to start"
)
Target.create "UnskipAndRevertAssemblyInfo" (fun _ ->
for assemblyFile, _ in assemblyInfos do
// While the files are skipped in can be hard to switch between branches
// Therefore we unskip and revert here.
Git.CommandHelper.directRunGitCommandAndFail "." (sprintf "update-index --no-skip-worktree %s" assemblyFile)
Git.CommandHelper.directRunGitCommandAndFail "." (sprintf "checkout HEAD %s" assemblyFile)
()
)
Target.create "GenerateDocs" (fun _ ->
Shell.cleanDir docsDir
let source = "./help"
let docsTemplate = "docpage.cshtml"
let indexTemplate = "indexpage.cshtml"
let githubLink = sprintf "https://github.com/%s/%s" github_release_user gitName
let projInfo =
[ "page-description", "FAKE - F# Make"
"page-author", String.separated ", " authors
"project-author", String.separated ", " authors
"github-link", githubLink
"version", simpleVersion
"project-github", sprintf "http://github.com/%s/%s" github_release_user gitName
"project-nuget", "https://www.nuget.org/packages/FAKE"
"root", sprintf "https://%s" docsDomain
"project-name", "FAKE - F# Make" ]
let layoutRoots = [ "./help/templates"; "./help/templates/reference"]
let fake5LayoutRoots = "./help/templates/fake5" :: layoutRoots
let legacyLayoutRoots = "./help/templates/legacy" :: layoutRoots
let fake4LayoutRoots = "./help/templates/fake4" :: layoutRoots
Shell.copyDir (docsDir) "help/content" FileFilter.allFiles
// to skip circleci builds
let docsCircleCi = docsDir + "/.circleci"
Directory.ensure docsCircleCi
Shell.copyDir docsCircleCi ".circleci" FileFilter.allFiles
File.writeString false "./docs/.nojekyll" ""
File.writeString false "./docs/CNAME" docsDomain
//CopyDir (docsDir @@ "pics") "help/pics" FileFilter.allFiles
Shell.copy (source @@ "markdown") ["RELEASE_NOTES.md"]
FSFormatting.createDocs (fun s ->
{ s with
Source = source @@ "markdown"
OutputDirectory = docsDir
Template = docsTemplate
ProjectParameters = ("CurrentPage", "Modules") :: projInfo
LayoutRoots = layoutRoots })
FSFormatting.createDocs (fun s ->
{ s with
Source = source @@ "redirects"
OutputDirectory = docsDir
Template = docsTemplate
ProjectParameters = ("CurrentPage", "FAKE-4") :: projInfo
LayoutRoots = layoutRoots })
FSFormatting.createDocs (fun s ->
{ s with
Source = source @@ "startpage"
OutputDirectory = docsDir
Template = indexTemplate
// TODO: CurrentPage shouldn't be required as it's written in the template, but it is -> investigate
ProjectParameters = ("CurrentPage", "Home") :: projInfo
LayoutRoots = layoutRoots })
Directory.ensure apidocsDir
let baseDir = Path.GetFullPath "."
let dllsAndLibDirs (dllPattern:IGlobbingPattern) =
let dlls =
dllPattern
|> GlobbingPattern.setBaseDir baseDir
|> Seq.distinctBy Path.GetFileName
|> List.ofSeq
let libDirs =
dlls
|> Seq.map Path.GetDirectoryName
|> Seq.distinct
|> List.ofSeq
(dlls,libDirs)
// FAKE 5 module documentation
let fake5ApidocsDir = apidocsDir @@ "v5"
Directory.ensure fake5ApidocsDir
let fake5Dlls, fake5LibDirs =
!! "src/app/Fake.*/bin/Release/**/Fake.*.dll"
|> dllsAndLibDirs
fake5Dlls
|> FSFormatting.createDocsForDlls (fun s ->
{ s with
OutputDirectory = fake5ApidocsDir
LayoutRoots = fake5LayoutRoots
LibDirs = fake5LibDirs
// TODO: CurrentPage shouldn't be required as it's written in the template, but it is -> investigate
ProjectParameters = ("api-docs-prefix", "/apidocs/v5/") :: ("CurrentPage", "APIReference") :: projInfo
SourceRepository = githubLink + "/blob/master" })
// Compat urls
let redirectPage newPage =
sprintf """
<html>
<head>
<title>Redirecting</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<p><a href="%s">This page has moved here...</a></p>
<script type="text/javascript">
var url = "%s";
window.location.replace(url);
</script>
</body>
</html>""" newPage newPage
!! (fake5ApidocsDir + "/*.html")
|> Seq.iter (fun v5File ->
// ./docs/apidocs/v5/blub.html
let name = Path.GetFileName v5File
let v4Name = Path.GetDirectoryName (Path.GetDirectoryName v5File) @@ name
// ./docs/apidocs/blub.html
let link = sprintf "/apidocs/v5/%s" name
File.WriteAllText(v4Name, redirectPage link)
)
// Legacy v4 and v5 documentation
let buildLegacyFromDocsDir layoutRoots fakeLegacyApidocsDir prefix githubBranch toolsDir =
Directory.ensure fakeLegacyApidocsDir
let fakeLegacyDlls, fakeLegacyLibDirs =
!! (toolsDir + "/Fake.*.dll")
++ (toolsDir + "/FakeLib.dll")
-- (toolsDir + "/Fake.Experimental.dll")
-- (toolsDir + "/FSharp.Compiler.Service.dll")
-- (toolsDir + "/FAKE.FSharp.Compiler.Service.dll")
-- (toolsDir + "/Fake.IIS.dll")
-- (toolsDir + "/Fake.Deploy.Lib.dll")
|> dllsAndLibDirs
fakeLegacyDlls
|> FSFormatting.createDocsForDlls (fun s ->
{ s with
OutputDirectory = fakeLegacyApidocsDir
LayoutRoots = layoutRoots
LibDirs = fakeLegacyLibDirs
// TODO: CurrentPage shouldn't be required as it's written in the template, but it is -> investigate
ProjectParameters = ("api-docs-prefix", prefix) ::("CurrentPage", "APIReference") :: projInfo
SourceRepository = githubLink + githubBranch })
// FAKE 5 legacy documentation
if buildLegacy then
let fake5LegacyApidocsDir = apidocsDir @@ "v5/legacy"
Directory.ensure fake5LegacyApidocsDir
let fake5LegacyDlls, fake5LegacyLibDirs =
!! "build/**/Fake.*.dll"
++ "build/FakeLib.dll"
-- "build/**/Fake.Experimental.dll"
-- "build/**/FSharp.Compiler.Service.dll"
-- "build/**/netcore/FAKE.FSharp.Compiler.Service.dll"
-- "build/**/FAKE.FSharp.Compiler.Service.dll"
-- "build/**/Fake.IIS.dll"
-- "build/**/Fake.Deploy.Lib.dll"
|> dllsAndLibDirs
fake5LegacyDlls
|> FSFormatting.createDocsForDlls (fun s ->
{ s with
OutputDirectory = fake5LegacyApidocsDir
LayoutRoots = legacyLayoutRoots
LibDirs = fake5LegacyLibDirs
// TODO: CurrentPage shouldn't be required as it's written in the template, but it is -> investigate
ProjectParameters = ("api-docs-prefix", "/apidocs/v5/legacy/") :: ("CurrentPage", "APIReference") :: projInfo
SourceRepository = githubLink + "/blob/master" })
else
buildLegacyFromDocsDir legacyLayoutRoots (apidocsDir @@ "v5/legacy") "/apidocs/v5/legacy/" "/blob/master" ("packages/docslegacyv5/FAKE/tools")
// FAKE 4 legacy documentation
buildLegacyFromDocsDir fake4LayoutRoots (apidocsDir @@ "v4") "/apidocs/v4/" "/blob/hotfix_fake4" ("packages/docslegacyv4/FAKE/tools")
)
let startWebServer () =
let rec findPort port =
let portIsTaken = false
//if Environment.isMono then false else
//System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpListeners()
//|> Seq.exists (fun x -> x.Port = port)
if portIsTaken then findPort (port + 1) else port
let port = findPort 8083
let serverConfig =
{ Suave.Web.defaultConfig with
homeFolder = Some (Path.GetFullPath docsDir)
bindings = [ Suave.Http.HttpBinding.createSimple Suave.Http.Protocol.HTTP "127.0.0.1" port ]
}
let (>=>) = Suave.Operators.(>=>)
let app =
Suave.WebPart.choose [
//Filters.path "/websocket" >=> handShake socketHandler
Suave.Writers.setHeader "Cache-Control" "no-cache, no-store, must-revalidate"
>=> Suave.Writers.setHeader "Pragma" "no-cache"
>=> Suave.Writers.setHeader "Expires" "0"
>=> Suave.Files.browseHome ]
Suave.Web.startWebServerAsync serverConfig app |> snd |> Async.Start
let psi = System.Diagnostics.ProcessStartInfo(sprintf "http://localhost:%d/index.html" port)
psi.UseShellExecute <- true
System.Diagnostics.Process.Start (psi) |> ignore
Target.create "HostDocs" (fun _ ->
startWebServer()
Trace.traceImportant "Press any key to stop."
System.Console.ReadKey() |> ignore
)
Target.create "DotNetCoreIntegrationTests" (fun _ ->
cleanForTests()
let processResult =
DotNet.exec (dtntWorkDir root) "src/test/Fake.Core.IntegrationTests/bin/Release/netcoreapp2.1/Fake.Core.IntegrationTests.dll" "--summary"
if processResult.ExitCode <> 0 then failwithf "DotNet Core Integration tests failed."
Trace.publish (ImportData.Nunit NunitDataVersion.Nunit) "Fake_Core_IntegrationTests.TestResults.xml"
)
Target.create "TemplateIntegrationTests" (fun _ ->
let targetDir = srcDir </> "test" </> "Fake.DotNet.Cli.IntegrationTests"
let processResult =
DotNet.exec (dtntWorkDir targetDir) "bin/Release/netcoreapp2.1/Fake.DotNet.Cli.IntegrationTests.dll" "--summary"
if processResult.ExitCode <> 0 then failwithf "DotNet CLI Template Integration tests failed."
Trace.publish (ImportData.Nunit NunitDataVersion.Nunit) (targetDir </> "Fake_DotNet_Cli_IntegrationTests.TestResults.xml")
)
Target.create "DotNetCoreUnitTests" (fun _ ->
// dotnet run -p src/test/Fake.Core.UnitTests/Fake.Core.UnitTests.fsproj
let processResult =
DotNet.exec (dtntWorkDir root) "src/test/Fake.Core.UnitTests/bin/Release/netcoreapp2.1/Fake.Core.UnitTests.dll" "--summary"
if processResult.ExitCode <> 0 then failwithf "Unit-Tests failed."
Trace.publish (ImportData.Nunit NunitDataVersion.Nunit) "Fake_Core_UnitTests.TestResults.xml"
// dotnet run --project src/test/Fake.Core.CommandLine.UnitTests/Fake.Core.CommandLine.UnitTests.fsproj
let processResult =
DotNet.exec (dtntWorkDir root) "src/test/Fake.Core.CommandLine.UnitTests/bin/Release/netcoreapp2.1/Fake.Core.CommandLine.UnitTests.dll" "--summary"
if processResult.ExitCode <> 0 then failwithf "Unit-Tests for Fake.Core.CommandLine failed."
Trace.publish (ImportData.Nunit NunitDataVersion.Nunit) "Fake_Core_CommandLine_UnitTests.TestResults.xml"
)
Target.create "BootstrapTestDotNetCore" (fun _ ->
let buildScript = "build.fsx"
let testScript = "testbuild.fsx"
// Check if we can build ourself with the new binaries.
let test timeout clearCache script =
let clear () =
// Will make sure the test call actually compiles the script.
// Note: We cannot just clean .fake here as it might be locked by the currently executing code :)
[ ".fake/testbuild.fsx/packages"
".fake/testbuild.fsx/paket.depedencies.sha1"
".fake/testbuild.fsx/paket.lock"
"testbuild.fsx.lock" ]
|> List.iter Shell.rm_rf
// TODO: Clean a potentially cached dll as well.
let executeTarget target =
if clearCache then clear ()
let fileName =
if Environment.isUnix then nugetDncDir </> "Fake.netcore/current/fake"
else nugetDncDir </> "Fake.netcore/current/fake.exe"
Process.execSimple (fun info ->
{ info with
FileName = fileName
WorkingDirectory = "."
Arguments = sprintf "run --fsiargs \"--define:BOOTSTRAP\" %s --target %s" script target }
|> Process.setEnvironmentVariable "FAKE_DETAILED_ERRORS" "true"
)
timeout
//true (Trace.traceFAKE "%s") Trace.trace
let result = executeTarget "PrintColors"
if result <> 0 then failwithf "Bootstrapping failed (because of exitcode %d)" result
let result = executeTarget "FailFast"
if result = 0 then failwithf "Bootstrapping failed (because of exitcode %d)" result
// Replace the include line to use the newly build FakeLib, otherwise things will be weird.
// TODO: We might need another way, because currently we reference the same paket group?
File.ReadAllText buildScript
|> fun text -> File.WriteAllText(testScript, text)
try
// Will compile the script.
test (System.TimeSpan.FromMinutes 15.0) true testScript
// Will use the compiled/cached version.
test (System.TimeSpan.FromMinutes 3.0) false testScript
finally File.Delete(testScript)
)
Target.create "SourceLink" (fun _ ->
//#if !DOTNETCORE
// !! "src/app/**/*.fsproj"
// |> Seq.iter (fun f ->
// let proj = VsProj.LoadRelease f
// let url = sprintf "%s/%s/{0}/%%var2%%" gitRaw projectName
// SourceLink.Index proj.CompilesNotLinked proj.OutputFilePdb __SOURCE_DIRECTORY__ url )
// let pdbFakeLib = "./build/FakeLib.pdb"
// Shell.CopyFile "./build/FAKE.Deploy" pdbFakeLib
// Shell.CopyFile "./build/FAKE.Deploy.Lib" pdbFakeLib
//#else
printfn "We don't currently have VsProj.LoadRelease on dotnetcore."
//#endif
)
let runtimes =
[ "win7-x86"; "win7-x64"; "osx.10.11-x64"; "linux-x64" ]
module CircleCi =
let isCircleCi = Environment.environVarAsBool "CIRCLECI"
// Create target for each runtime
let info = lazy DotNet.info dtntSmpl
runtimes
|> List.map Some
|> (fun rs -> None :: rs)
|> Seq.iter (fun runtime ->
let runtimeName, runtime =
match runtime with
| Some r -> r, lazy r
| None -> "current", lazy info.Value.RID
let targetName = sprintf "_DotNetPublish_%s" runtimeName
Target.create targetName (fun _ ->
!! (appDir </> "Fake.netcore/Fake.netcore.fsproj")
|> Seq.iter(fun proj ->
let nugetDir = System.IO.Path.GetFullPath nugetDncDir
let projName = Path.GetFileName(Path.GetDirectoryName proj)
//DotNetRestore (fun c -> {c with Runtime = Some runtime}) proj
let outDir = nugetDir @@ projName @@ runtimeName
DotNet.publish (fun c ->
{ c with
Runtime = Some runtime.Value
Configuration = DotNet.Release
OutputPath = Some outDir
} |> dtntSmpl) proj
let source = outDir </> "dotnet"
if File.Exists source then
failwithf "Workaround no longer required?" //TODO: If this is not triggered delete this block
Trace.traceFAKE "Workaround https://github.com/dotnet/cli/issues/6465"
let target = outDir </> "fake"
if File.Exists target then File.Delete target
File.Move(source, target)
)
)
)
Target.create "_DotNetPublish_portable" (fun _ ->
let nugetDir = System.IO.Path.GetFullPath nugetDncDir
// Publish portable as well (see https://docs.microsoft.com/en-us/dotnet/articles/core/app-types)
let netcoreFsproj = appDir </> "Fake.netcore/Fake.netcore.fsproj"
let outDir = nugetDir @@ "Fake.netcore" @@ "portable"
DotNet.publish (fun c ->
{ c with
Framework = Some "netcoreapp2.1"
OutputPath = Some outDir
} |> dtntSmpl) netcoreFsproj
)
Target.create "_DotNetPackage" (fun _ ->
let nugetDir = System.IO.Path.GetFullPath nugetDncDir
// This line actually ensures we get the correct version checked in
// instead of the one previously bundled with 'fake`
Git.CommandHelper.gitCommand "" "checkout .paket/Paket.Restore.targets"
//Environment.setEnvironVar "IncludeSource" "true"
//Environment.setEnvironVar "IncludeSymbols" "false"
Environment.setEnvironVar "GenerateDocumentationFile" "true"
Environment.setEnvironVar "PackageVersion" nugetVersion
Environment.setEnvironVar "Version" nugetVersion
Environment.setEnvironVar "Authors" (String.separated ";" authors)
Environment.setEnvironVar "Description" projectDescription
Environment.setEnvironVar "PackageReleaseNotes" (release.Notes |> String.toLines)
Environment.setEnvironVar "SourceLinkCreate" "false"
Environment.setEnvironVar "PackageTags" "build;fake;f#"
Environment.setEnvironVar "PackageIconUrl" "https://raw.githubusercontent.com/fsharp/FAKE/fee4f05a2ee3c646979bf753f3b1f02d927bfde9/help/content/pics/logo.png"
Environment.setEnvironVar "PackageProjectUrl" "https://github.com/fsharp/Fake"
Environment.setEnvironVar "PackageLicenseUrl" "https://github.com/fsharp/FAKE/blob/d86e9b5b8e7ebbb5a3d81c08d2e59518cf9d6da9/License.txt"
// dotnet pack
DotNet.pack (fun c ->
{ c with
Configuration = DotNet.Release
OutputPath = Some nugetDir
Common =
if CircleCi.isCircleCi then
{ c.Common with CustomParams = Some "/m:1" }
else c.Common
} |> dtntSmpl) "Fake.sln"
// TODO: Check if we run the test in the current build!
Directory.ensure "temp"
let testZip = "temp/tests.zip"
!! "src/test/*/bin/Release/netcoreapp2.1/**"
|> Zip.zip "src/test" testZip
publish testZip
)
Target.create "DotNetCoreCreateZipPackages" (fun _ ->
Environment.setEnvironVar "Version" nugetVersion
// build zip packages
!! (nugetDncDir </> "*.nupkg")
-- (nugetDncDir </> "*.symbols.nupkg")
|> Zip.zip nugetDncDir (nugetDncDir </> "Fake.netcore/fake-dotnetcore-packages.zip")
("portable" :: runtimes)
|> Seq.iter (fun runtime ->
let runtimeDir = sprintf "%s/Fake.netcore/%s" nugetDncDir runtime
!! (sprintf "%s/**" runtimeDir)
|> Zip.zip runtimeDir (sprintf "%s/Fake.netcore/fake-dotnetcore-%s.zip" nugetDncDir runtime)
)
runtimes @ [ "portable"; "packages" ]
|> List.map (fun n -> sprintf "%s/Fake.netcore/fake-dotnetcore-%s.zip" nugetDncDir n)
|> List.iter publish
)
let getChocoWrapper () =
let altToolPath = Path.GetFullPath "temp/choco.sh"
if not Environment.isWindows then
Directory.ensure "temp"
File.WriteAllText(altToolPath, """#!/bin/bash
docker run --rm -v $PWD:$PWD -w $PWD linuturk/mono-choco $@
""" )
let result = Shell.Exec("chmod", sprintf "+x %s" altToolPath)
if result <> 0 then failwithf "'chmod +x %s' failed on unix" altToolPath
altToolPath
Target.create "DotNetCoreCreateChocolateyPackage" (fun _ ->
// !! ""
let altToolPath = getChocoWrapper()
let changeToolPath (p: Choco.ChocoPackParams) =
if Environment.isWindows
then p
else { p with ToolPath = altToolPath }
Directory.ensure chocoReleaseDir
Choco.packFromTemplate (fun p ->
{ p with
PackageId = "fake"
ReleaseNotes = release.Notes |> String.toLines
InstallerType = Choco.ChocolateyInstallerType.SelfContained
Version = chocoVersion
Files =
[ (System.IO.Path.GetFullPath (nugetDncDir </> @"Fake.netcore\win7-x86")) + @"\**", Some "bin", None
(System.IO.Path.GetFullPath @"src\VERIFICATION.txt"), Some "VERIFICATION.txt", None
(System.IO.Path.GetFullPath @"License.txt"), Some "LICENSE.txt", None ]
OutputDir = chocoReleaseDir }
|> changeToolPath) "src/Fake-choco-template.nuspec"
let name = sprintf "%s.%s" "fake" chocoVersion
let chocoPackage = sprintf "%s/%s.nupkg" chocoReleaseDir name
let chocoTargetPackage = sprintf "%s/chocolatey-%s.nupkg" chocoReleaseDir name
File.Copy(chocoPackage, chocoTargetPackage, true)
publish chocoTargetPackage
)
Target.create "DotNetCorePushChocolateyPackage" (fun _ ->
let name = sprintf "%s.%s.nupkg" "fake" chocoVersion
let path = sprintf "%s/%s" chocoReleaseDir name
if not Environment.isWindows && not (File.exists path) && fromArtifacts then
Directory.ensure chocoReleaseDir
Shell.copyFile path (artifactsDir </> sprintf "chocolatey-%s" name)
let altToolPath = getChocoWrapper()
let changeToolPath (p: Choco.ChocoPushParams) =
if Environment.isWindows then p else { p with ToolPath = altToolPath }
path |> Choco.push (fun p ->
{ p with
Source = chocosource
ApiKey = chocoKey.Value }
|> changeToolPath)
)
Target.create "CheckReleaseSecrets" (fun _ ->
for secret in ``Legacy-build``.secrets do
secret.Force() |> ignore
)
Target.create "DotNetCoreCreateDebianPackage" (fun _ ->
let runtime = "linux-x64"
let targetFramework = "netcoreapp2.1"
// See https://github.com/dotnet/cli/issues/9823
let args =
[
sprintf "/restore"
sprintf "/t:%s" "CreateDeb"
sprintf "/p:TargetFramework=%s" targetFramework
sprintf "/p:CustomTarget=%s" "CreateDeb"
sprintf "/p:RuntimeIdentifier=%s" runtime
sprintf "/p:Configuration=%s" "Release"
sprintf "/p:PackageVersion=%s" simpleVersion
] |> String.concat " "
let result =
DotNet.exec (fun opt ->
{ opt with
WorkingDirectory = "src/app/fake-cli/" } |> dtntSmpl
) "msbuild" args
if result.OK |> not then
failwith "Debian package creation failed"
let fileName = sprintf "fake-cli.%s.%s.deb" simpleVersion runtime
let sourceFile = sprintf "src/app/fake-cli/bin/Release/%s/%s/%s" targetFramework runtime fileName
Directory.ensure nugetDncDir
let target = sprintf "%s/%s" nugetDncDir fileName
File.Copy(sourceFile, target, true)
publish target
)
let rec nugetPush tries nugetpackage =
let ignore_conflict = Environment.environVar "IGNORE_CONFLICT" = "true"
try
if not <| System.String.IsNullOrEmpty apikey.Value then
Process.execWithResult (fun info ->
{ info with
FileName = nuget_exe
Arguments = sprintf "push %s %s -Source %s" (Process.toParam nugetpackage) (Process.toParam apikey.Value) (Process.toParam nugetsource) }
) (System.TimeSpan.FromMinutes 10.)
|> (fun r ->
for res in r.Results do
if res.IsError then
Trace.traceFAKE "%s" res.Message
else
Trace.tracefn "%s" res.Message
if r.ExitCode <> 0 then
if not ignore_conflict ||
not (r.Errors |> Seq.exists (fun err -> err.Contains "409"))
then
let msgs = r.Results |> Seq.map (fun c -> (if c.IsError then "(Err) " else "") + c.Message)
let msg = System.String.Join ("\n", msgs)
failwithf "failed to push package %s (code %d): \n%s" nugetpackage r.ExitCode msg
else Trace.traceFAKE "ignore conflict error because IGNORE_CONFLICT=true!")
else Trace.traceFAKE "could not push '%s', because api key was not set" nugetpackage
with exn when tries > 1 ->
Trace.traceFAKE "Error while pushing NuGet package: %s" exn.Message
nugetPush (tries - 1) nugetpackage
Target.create "DotNetCorePushNuGet" (fun _ ->
// dotnet pack
!! (appDir </> "*/*.fsproj")
-- (appDir </> "Fake.netcore/*.fsproj")
++ (templateDir </> "*/*.fsproj")
|> Seq.iter(fun proj ->
let projName = Path.GetFileName(Path.GetDirectoryName proj)
!! (sprintf "%s/%s.*.nupkg" nugetDncDir projName)
-- (sprintf "%s/%s.*.symbols.nupkg" nugetDncDir projName)
|> Seq.iter (nugetPush 4))
)
Target.create "ReleaseDocs" (fun _ ->
Shell.cleanDir "gh-pages"
let auth = sprintf "%s:x-oauth-basic@" githubtoken.Value
let url = sprintf "https://%sgithub.com/%s/%s.git" auth github_release_user gitName
Git.Repository.cloneSingleBranch "" url "gh-pages" "gh-pages"
Git.Repository.fullclean "gh-pages"
Shell.copyRecursive "docs" "gh-pages" true |> printfn "%A"
Shell.copyFile "gh-pages" "./Samples/FAKE-Calculator.zip"
File.writeString false "./gh-pages/CNAME" docsDomain
Git.Staging.stageAll "gh-pages"
if not BuildServer.isLocalBuild then
Git.CommandHelper.directRunGitCommandAndFail "gh-pages" "config user.email matthi.d@gmail.com"
Git.CommandHelper.directRunGitCommandAndFail "gh-pages" "config user.name \"Matthias Dittrich\""
Git.Commit.exec "gh-pages" (sprintf "Update generated documentation %s" simpleVersion)
Git.Branches.pushBranch "gh-pages" url "gh-pages"
)
Target.create "FastRelease" (fun _ ->
let token = githubtoken.Value
let auth = sprintf "%s:x-oauth-basic@" token
let url = sprintf "https://%sgithub.com/%s/%s.git" auth github_release_user gitName
let gitDirectory = getVarOrDefault "git_directory" ""
if not BuildServer.isLocalBuild then
Git.CommandHelper.directRunGitCommandAndFail gitDirectory "config user.email matthi.d@gmail.com"
Git.CommandHelper.directRunGitCommandAndFail gitDirectory "config user.name \"Matthias Dittrich\""
if gitDirectory <> "" && BuildServer.buildServer = BuildServer.TeamFoundation then
Trace.trace "Prepare git directory"
Git.Branches.checkout gitDirectory false TeamFoundation.Environment.BuildSourceVersion
else
Git.Staging.stageAll gitDirectory
Git.Commit.exec gitDirectory (sprintf "Bump version to %s" simpleVersion)
let branch = Git.Information.getBranchName gitDirectory
Git.Branches.pushBranch gitDirectory "origin" branch
Git.Branches.tag gitDirectory simpleVersion
Git.Branches.pushTag gitDirectory url simpleVersion
let linuxRuntime = "linux-x64"
let debFileName = sprintf "fake-cli.%s.%s.deb" simpleVersion linuxRuntime
let debTarget = sprintf "%s/%s" nugetDncDir debFileName
let files =
runtimes @ [ "portable"; "packages" ]
|> List.map (fun n -> sprintf "%s/Fake.netcore/fake-dotnetcore-%s.zip" nugetDncDir n)
|> fun l -> l @ [ debTarget ]
GitHub.createClientWithToken token
|> GitHub.draftNewRelease github_release_user gitName simpleVersion (release.SemVer.PreRelease <> None) release.Notes
|> GitHub.uploadFiles files
|> GitHub.publishDraft
|> Async.RunSynchronously
)
Target.create "Release_Staging" (fun _ -> ())
open System.IO.Compression
Target.create "PrepareArtifacts" (fun _ ->
if not fromArtifacts then
Trace.trace "empty artifactsDir."
else
Trace.trace "ensure artifacts."
let files =
!! (artifactsDir </> "fake-dotnetcore-*.zip")
|> GlobbingPattern.setBaseDir "C:\\" // workaround a globbing bug, remove me with 5.0.0-rc014
|> Seq.toList
Trace.tracefn "files: %A" files
files
|> Shell.copy (nugetDncDir </> "Fake.netcore")
Zip.unzip nugetDncDir (artifactsDir </> "fake-dotnetcore-packages.zip")
if Environment.isWindows then
Directory.ensure chocoReleaseDir
let name = sprintf "%s.%s.nupkg" "fake" chocoVersion
Shell.copyFile (sprintf "%s/%s" chocoReleaseDir name) (artifactsDir </> sprintf "chocolatey-%s" name)
else
Zip.unzip "." (artifactsDir </> "chocolatey-requirements.zip")
if buildLegacy then
Directory.ensure nugetLegacyDir
Zip.unzip nugetLegacyDir (artifactsDir </> "fake-legacy-packages.zip")
Directory.ensure "temp/build"
!! (nugetLegacyDir </> "*.nupkg")
|> Seq.iter (fun pack ->
Zip.unzip "temp/build" pack
)
Shell.copyDir "build" "temp/build" (fun _ -> true)
let linuxRuntime = "linux-x64"
let debFileName = sprintf "fake-cli.%s.%s.deb" simpleVersion linuxRuntime
Directory.ensure nugetDncDir
let debTarget = sprintf "%s/%s" nugetDncDir debFileName
Shell.copyFile debTarget (artifactsDir </> debFileName)
let unzipIfExists dir file =
Directory.ensure dir
if File.Exists file then
Zip.unzip dir file
// File is not available in case we already have build the full docs
unzipIfExists "help" (artifactsDir </> "help-markdown.zip")
unzipIfExists "docs" (artifactsDir </> "docs.zip")
unzipIfExists "src/test" (artifactsDir </> "tests.zip")
)
Target.create "BuildArtifacts" (fun args ->
Directory.ensure "temp"
if not Environment.isWindows then
// Chocolatey package is done in a separate step...
let chocoReq = "temp/chocolatey-requirements.zip"
//!! @"nuget\dotnetcore\Fake.netcore\win7-x86\**" already part of fake-dotnetcore-win7-x86
!! @"src\VERIFICATION.txt"
++ @"License.txt"
++ "src/Fake-choco-template.nuspec"
|> Zip.zip "." chocoReq
publish chocoReq
let buildCache = "temp/build-cache.zip"
!! (".fake" </> "build.fsx" </> "*.dll")
++ (".fake" </> "build.fsx" </> "*.pdb")
++ "build.fsx"