Skip to content

Commit ae91204

Browse files
committed
Upgrade to fake 5.
1 parent 4e80acf commit ae91204

File tree

5 files changed

+856
-112
lines changed

5 files changed

+856
-112
lines changed

build.fsx

Lines changed: 25 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
// FAKE build script
33
// --------------------------------------------------------------------------------------
44

5-
#r @"packages/FAKE/tools/FakeLib.dll"
6-
open Fake.BuildServer
5+
#r "paket: groupref build //"
6+
#load "./.fake/build.fsx/intellisense.fsx"
7+
#if !FAKE
8+
#r "netstandard"
9+
#endif
10+
711
open Fake.Core.TargetOperators
812
open Fake.Core
913
open Fake.DotNet
@@ -54,7 +58,7 @@ let release =
5458
|> List.head
5559

5660
// Generate assembly info files with the right version & up-to-date information
57-
Target.create "AssemblyInfo" (fun _ ->
61+
Target.Create "AssemblyInfo" (fun _ ->
5862
let fileName = "src/" + project + "/AssemblyInfo.fs"
5963
AssemblyInfoFile.createFSharp fileName [ AssemblyInfo.Title project
6064
AssemblyInfo.Product project
@@ -71,44 +75,40 @@ let runDotNet cmd workingDir =
7175

7276
// --------------------------------------------------------------------------------------
7377
// Clean build results
74-
Target.create "Clean" (fun _ -> try Shell.cleanDirs [ "bin"; "temp"; "tests/integrationtests/bin" ] with _ -> () )
78+
Target.Create "Clean" (fun _ ->
79+
try Shell.cleanDirs [ "bin"; "temp"; "tests/integrationtests/bin" ] with _ -> ()
80+
)
7581

7682
// --------------------------------------------------------------------------------------
7783
// Restore project
78-
Target.create "RestoreProject" (fun _ ->
79-
runDotNet "restore" projectPath
84+
Target.Create "RestoreProject" (fun _ ->
85+
DotNet.restore id projectPath
8086
)
8187

8288
// --------------------------------------------------------------------------------------
8389
// Build library project
84-
Target.create "Build" (fun _ ->
85-
runDotNet "publish" projectPath
90+
Target.Create "Build" (fun _ ->
91+
DotNet.publish id projectPath
8692
)
8793

8894
// --------------------------------------------------------------------------------------
8995
// Run the unit tests using test runner
90-
Target.create "ResetTestData" (fun _ ->
91-
let script = Path.GetFullPath (testPath + @"\ResetTestData.fsx")
96+
Target.Create "ResetTestData" (fun _ ->
97+
let script = Path.Combine(testPath, "ResetTestData.fsx")
9298
Emulators.startStorageEmulator()
9399
Fsi.exec (fun p ->
94100
{ p with
95-
TargetProfile = Fsi.Profile.NetStandard
101+
TargetProfile = Fsi.Profile.Netcore
96102
WorkingDirectory = testPath
97-
ToolPath = Fsi.FsiTool.Internal
98103
}) script [""]
99104
|> snd
100105
|> Seq.iter(fun x -> printfn "%s" x)) ///ToBeFixed
101106
102-
103-
let build project framework =
104-
DotNet.build (fun p ->
105-
{ p with Framework = Some framework } ) project
106-
107107
// Run integration tests
108108
let root = __SOURCE_DIRECTORY__
109109
let testNetCoreDir = root </> "tests" </> "IntegrationTests" </> "bin" </> "Release" </> "netcoreapp2.0" </> "win10-x64" </> "publish"
110110

111-
Target.create "RunTests" (fun _ ->
111+
Target.Create "RunTests" (fun _ ->
112112
let result = DotNet.exec (withWorkDir testPath) "publish --self-contained -c Release -r win10-x64" ""
113113
if not result.OK then failwith "Publish failed"
114114
printfn "Dkr: %s" testNetCoreDir
@@ -121,7 +121,7 @@ Target.create "RunTests" (fun _ ->
121121

122122
// --------------------------------------------------------------------------------------
123123
// Build a NuGet package
124-
Target.create "NuGet" (fun _ ->
124+
Target.Create "NuGet" (fun _ ->
125125
Fake.IO.Directory.create @"bin\package"
126126
NuGet.NuGet (fun p ->
127127
{ p with
@@ -162,57 +162,26 @@ module AppVeyorHelpers =
162162

163163
// --------------------------------------------------------------------------------------
164164
// Release Scripts
165-
166-
Target.create "Release" (fun _ ->
167-
let user =
168-
match Environment.environVar "github-user" with
169-
| s when not (String.IsNullOrWhiteSpace s) -> s
170-
| _ -> UserInput.getUserInput "Username: "
171-
let pw =
172-
match Environment.environVar "github-pw" with
173-
| s when not (String.IsNullOrWhiteSpace s) -> s
174-
| _ -> UserInput.getUserPassword "Password: "
175-
let remote =
176-
CommandHelper.getGitResult "" "remote -v"
177-
|> Seq.filter (fun (s: string) -> s.EndsWith("(push)"))
178-
|> Seq.tryFind (fun (s: string) -> s.Contains(gitOwner + "/" + gitName))
179-
|> function None -> gitHome + "/" + gitName | Some (s: string) -> s.Split().[0]
180-
181-
Staging.stageAll ""
182-
Commit.exec "" (sprintf "Bump version to %s" release.NugetVersion)
183-
Branches.pushBranch "" remote (Information.getBranchName "")
184-
185-
Branches.tag "" release.NugetVersion
186-
Branches.pushTag "" remote release.NugetVersion)
187-
188-
Target.create "LocalDeploy" (fun _ ->
165+
Target.Create "LocalDeploy" (fun _ ->
189166
DirectoryInfo @"bin"
190167
|> DirectoryInfo.getMatchingFiles "*.nupkg"
191168
|> Seq.map(fun x -> x.FullName)
192169
|> Shell.copyFiles @"..\..\LocalPackages")
193170

194-
Target.create "BuildServerDeploy" (fun _ -> publishOnAppveyor buildDir)
195-
196-
Target.createFinal "PublishTestsResultsToAppveyor" (fun _ ->
197-
Trace.publish ImportData.BuildArtifact "TestOutput"
198-
)
171+
Target.Create "BuildServerDeploy" (fun _ -> publishOnAppveyor buildDir)
199172

200173
// --------------------------------------------------------------------------------------
201174
// Run all targets by default. Invoke 'build <Target>' to override
202175

203-
Target.create "All" ignore
176+
Target.Create "All" ignore
204177

205178
"Clean"
206179
==> "AssemblyInfo"
207180
==> "Build"
208181
==> "Nuget"
209182
==> "ResetTestData"
210183
==> "RunTests"
211-
=?> ("LocalDeploy", BuildServer.buildServer = LocalBuild)
212-
=?> ("BuildServerDeploy", BuildServer.buildServer = AppVeyor)
213-
214-
"RunTests"
215-
==> "Release"
184+
=?> ("LocalDeploy", BuildServer.isLocalBuild)
185+
=?> ("BuildServerDeploy", BuildServer.buildServer = Fake.Core.BuildServer.AppVeyor)
216186

217-
Target.activateFinal "PublishTestsResultsToAppveyor"
218-
Target.runOrDefault "RunTests"
187+
Target.RunOrDefault "RunTests"

paket.dependencies

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
redirects: force
22
source https://www.nuget.org/api/v2/
33
framework: netstandard2.0, netcoreapp2.0
4+
generate_load_scripts: true
45

56
nuget FSharp.Core
67
nuget WindowsAzure.Storage 9.3.2
@@ -22,5 +23,24 @@ nuget Taskbuilder.fs
2223

2324
github fsprojects/FSharp.TypeProviders.SDK src/ProvidedTypes.fsi
2425
github fsprojects/FSharp.TypeProviders.SDK src/ProvidedTypes.fs
25-
nuget FSharp.Compiler.Tools
26-
nuget Microsoft.NETCore.Runtime.CoreCLR
26+
nuget Microsoft.NETCore.Runtime.CoreCLR
27+
nuget System.Configuration.ConfigurationManager
28+
29+
group build
30+
31+
source https://www.nuget.org/api/v2/
32+
framework: netstandard2.0, netcoreapp2.0
33+
storage: none
34+
35+
nuget Fake.Azure.Emulators
36+
nuget Fake.BuildServer.AppVeyor
37+
nuget Fake.Core
38+
nuget Fake.Core.ReleaseNotes
39+
nuget Fake.Core.Targets
40+
nuget Fake.DotNet
41+
nuget Fake.DotNet.Cli
42+
nuget Fake.DotNet.Fsi
43+
nuget Fake.DotNet.AssemblyInfoFile
44+
nuget Fake.DotNet.NuGet
45+
nuget Fake.IO.FileSystem
46+
nuget Fake.Tools.Git

0 commit comments

Comments
 (0)