55#I" packages/FAKE/tools"
66#r" packages/FAKE/tools/FakeLib.dll"
77open System
8- open Fake. AppVeyor
8+ open System. IO
99open Fake
10- open Fake.Git
10+ open Fake.AppVeyor
1111open Fake.ReleaseNotesHelper
12- open Fake.UserInputHelper
1312
1413#if MONO
1514// prevent incorrect output encoding (e.g. https://github.com/fsharp/FAKE/issues/1196)
@@ -21,38 +20,24 @@ System.Console.OutputEncoding <- System.Text.Encoding.UTF8
2120// --------------------------------------------------------------------------------------
2221
2322let assertExitCodeZero x = if x= 0 then () else failwithf" Command failed with exit code%i " x
24- let runCmdIn mono workDir exe = Printf.ksprintf( fun args ->
25- if monothen
26- printfn" mono%s /%s %s " workDir exe args
23+ let runCmdIn workDir ( exe : string ) = Printf.ksprintf( fun ( args : string ) ->
24+ #if MONO
25+ let exe = exe.Replace( " \\ " , " /" )
26+ let args = args.Replace( " \\ " , " /" )
27+ printfn" [%s ] mono%s %s " workDir exe args
2728 Shell.Exec( " mono" , sprintf" %s %s " exe args, workDir)
28- |> assertExitCodeZero
29- else
30- printfn" %s /%s %s " workDir exe args
29+ #else
30+ printfn" [%s ]%s %s " workDir exe args
3131 Shell.Exec( exe, args, workDir)
32+ #endif
3233|> assertExitCodeZero
3334)
34- let run mono exe = runCmdIn mono" ." exe
35-
36- // --------------------------------------------------------------------------------------
37- // Information about the project to be used at NuGet
38- // --------------------------------------------------------------------------------------
39-
40- let project = " FSharp.Compiler.Service"
41- let authors = [ " Microsoft Corporation, Dave Thomas, Anh-Dung Phan, Tomas Petricek" ]
42-
43- let gitOwner = " fsharp"
44- let gitHome = " https://github.com/" + gitOwner
45-
46- let gitName = " FSharp.Compiler.Service"
47- let gitRaw = environVarOrDefault" gitRaw" " https://raw.githubusercontent.com/fsharp"
48-
49- let netFrameworks = [ (* "v4.0";*) " v4.5" ]
5035
5136// --------------------------------------------------------------------------------------
5237// The rest of the code is standard F# build script
5338// --------------------------------------------------------------------------------------
5439
55- let releaseDir = " ../Release"
40+ let releaseDir = Path.Combine (__ SOURCE _ DIRECTORY __, " ../Release" )
5641
5742
5843// Read release notes & version info from RELEASE_NOTES.md
@@ -84,8 +69,6 @@ let buildVersion =
8469else if isAppVeyorBuildthen sprintf" %s -b%s " assemblyVersion AppVeyorEnvironment.BuildNumber
8570else assemblyVersion
8671
87- let netstdsln = gitName+ " .netstandard.sln" ;
88-
8972Target" BuildVersion" ( fun _ ->
9073 Shell.Exec( " appveyor" , sprintf" UpdateBuild -Version\" %s \" " buildVersion) |> ignore
9174)
@@ -95,7 +78,7 @@ Target "BuildVersion" (fun _ ->
9578
9679
9780Target" Build.NetFx" ( fun _ ->
98- !! ( project + " . sln" )
81+ !! " FSharp.Compiler.Service. sln"
9982|> MSBuild" " " Build" [ " Configuration" , " Release" ]
10083|> Log( " .NETFxBuild-Output:" )
10184)
@@ -116,9 +99,9 @@ Target "Test.NetFx" (fun _ ->
11699// --------------------------------------------------------------------------------------
117100// Build a NuGet package
118101Target" NuGet.NetFx" ( fun _ ->
119- run false @" ..\.nuget\nuget .exe" @" pack nuget\FSharp.Compiler.Service.nuspec -OutputDirectory %s" releaseDir
120- run false @" ..\.nuget\nuget .exe" @" pack nuget\FSharp.Compiler.Service.MSBuild.v12.nuspec -OutputDirectory %s" releaseDir
121- run false @" ..\.nuget\nuget .exe" @" pack nuget\FSharp.Compiler.Service.ProjectCracker.nuspec -OutputDirectory %s" releaseDir
102+ runCmdIn __ SOURCE _ DIRECTORY __ @" ..\.nuget\NuGet .exe" @" pack nuget\FSharp.Compiler.Service.nuspec -OutputDirectory %s" releaseDir
103+ runCmdIn __ SOURCE _ DIRECTORY __ @" ..\.nuget\NuGet .exe" @" pack nuget\FSharp.Compiler.Service.MSBuild.v12.nuspec -OutputDirectory %s" releaseDir
104+ runCmdIn __ SOURCE _ DIRECTORY __ @" ..\.nuget\NuGet .exe" @" pack nuget\FSharp.Compiler.Service.ProjectCracker.nuspec -OutputDirectory %s" releaseDir
122105)
123106
124107
@@ -140,28 +123,27 @@ let isDotnetSDKInstalled =
140123
141124
142125Target" Build.NetStd" ( fun _ ->
143- run false " dotnet" " pack%s -v n -c Release" netstdsln
126+ runCmdIn __ SOURCE _ DIRECTORY __ " dotnet" " pack%s -v n -c Release" " FSharp.Compiler.Service.netstandard.sln "
144127)
145128
146129
147130Target" Test.NetStd" ( fun _ ->
148- run false " dotnet" " run -p FSharp.Compiler.Service.Tests.netcore/FSharp.Compiler.Service.Tests.netcore.fsproj -c Release -- --result:TestResults.NetStd.xml;format=nunit3"
131+ runCmdIn __ SOURCE _ DIRECTORY __ " dotnet" " run -p FSharp.Compiler.Service.Tests.netcore/FSharp.Compiler.Service.Tests.netcore.fsproj -c Release -- --result:TestResults.NetStd.xml;format=nunit3"
149132)
150133
151134
152135//use dotnet-mergenupkg to merge the .NETstandard nuget package into the default one
153136Target" Nuget.AddNetStd" ( fun _ ->
154- do
155- let nupkg = sprintf" %s /FSharp.Compiler.Service.%s .nupkg" releaseDir release.AssemblyVersion
156- let netcoreNupkg = sprintf" FSharp.Compiler.Service.netstandard/bin/Release/FSharp.Compiler.Service.%s .nupkg" release.AssemblyVersion
157- runCmdInfalse " ." " dotnet" " mergenupkg --source%s --other%s --framework netstandard1.6" nupkg netcoreNupkg
137+ let nupkg = sprintf" %s /FSharp.Compiler.Service.%s .nupkg" releaseDir release.AssemblyVersion
138+ let netcoreNupkg = sprintf" FSharp.Compiler.Service.netstandard/bin/Release/FSharp.Compiler.Service.%s .nupkg" release.AssemblyVersion
139+ runCmdIn__ SOURCE_ DIRECTORY__ " dotnet" " mergenupkg --source%s --other%s --framework netstandard1.6" nupkg netcoreNupkg
158140)
159141
160142
161143// --------------------------------------------------------------------------------------
162144// Generate the documentation
163145
164- Target" GenerateDocs " ( fun _ ->
146+ Target" GenerateDocsEn " ( fun _ ->
165147 executeFSIWithArgs" docsrc/tools" " generate.fsx" [ " --define:RELEASE" ] [] |> ignore
166148)
167149
@@ -187,10 +169,11 @@ Target "PublishNuGet" (fun _ ->
187169// Run all targets by default. Invoke 'build <Target>' to override
188170
189171Target" Clean" DoNothing
190- Target" CleanDocs" DoNothing
191172Target" Release" DoNothing
192173Target" NuGet" DoNothing
193174Target" Build" DoNothing
175+ Target" GenerateDocs" DoNothing
176+ Target" TestAndNuGet" DoNothing
194177
195178" Clean"
196179=?> ( " BuildVersion" , isAppVeyorBuild)
@@ -218,14 +201,29 @@ Target "Build" DoNothing
218201=?> ( " Nuget.AddNetStd" , isDotnetSDKInstalled)
219202==> " NuGet"
220203
204+ " Test.NetFx"
205+ ==> " TestAndNuGet"
206+
207+ " NuGet"
208+ ==> " TestAndNuGet"
209+
210+ //"Test.NetStd"
211+ // ==> "TestAndNuGet"
212+
221213" Build"
222214==> " NuGet"
223215==> " PublishNuGet"
224216==> " Release"
225217
226- " CleanDocs"
218+ " Build"
219+ ==> " GenerateDocsEn"
227220==> " GenerateDocs"
221+
222+ " Build"
228223==> " GenerateDocsJa"
224+ ==> " GenerateDocs"
225+
226+ " GenerateDocs"
229227==> " Release"
230228
231229RunTargetOrDefault" Build"