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+
711open Fake.Core .TargetOperators
812open Fake.Core
913open 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
108108let root = __ SOURCE_ DIRECTORY__
109109let 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"
0 commit comments