@@ -18,45 +18,39 @@ module Environment =
18
18
let [<Literal>] REPOSITORY = " https://github.com/OrleansContrib/Orleans.Persistence.Minio.git"
19
19
20
20
module GitVersion =
21
- module Process =
22
- let exec f =
21
+ let showVariable =
22
+ let execProcess f =
23
23
Process.execWithResult f ( System.TimeSpan.FromMinutes 2. )
24
-
25
- let private exec commit args =
26
- match Environment.environVarOrNone Environment.APPVEYOR_ REPO_ BRANCH, Environment.environVarOrNone Environment.APPVEYOR_ PULL_ REQUEST_ NUMBER with
27
- | Some branch, None ->
28
- Process.exec ( fun info ->
29
- { info with
30
- FileName = " gitversion"
31
- Arguments = sprintf " /url %s /b b-%s /dynamicRepoLocation .\g itversion /c %s %s " Environment.REPOSITORY branch commit args })
32
- | _ ->
33
- Process.exec ( fun info -> { info with FileName = " gitversion" ; Arguments = args })
34
-
35
- let private getResult ( result : ProcessResult ) =
36
- result.Messages |> List.head
24
+ |> fun r -> r.Messages
25
+ |> List.head
26
+
27
+ let commit =
28
+ match Environment.environVarOrNone Environment.APPVEYOR_ REPO_ COMMIT with
29
+ | Some c -> c
30
+ | None -> execProcess ( fun info -> { info with FileName = " git" ; Arguments = " rev-parse HEAD" })
31
+
32
+ printfn " Executing gitversion from commit '%s '." commit
33
+
34
+ fun variable ->
35
+ match Environment.environVarOrNone Environment.APPVEYOR_ REPO_ BRANCH, Environment.environVarOrNone Environment.APPVEYOR_ PULL_ REQUEST_ NUMBER with
36
+ | Some branch, None ->
37
+ execProcess ( fun info ->
38
+ { info with
39
+ FileName = " gitversion"
40
+ Arguments = sprintf " /showvariable %s /url %s /b b-%s /dynamicRepoLocation .\g itversion /c %s " variable Environment.REPOSITORY branch commit })
41
+ | _ ->
42
+ execProcess ( fun info -> { info with FileName = " gitversion" ; Arguments = sprintf " /showvariable %s " variable })
37
43
38
44
let get =
39
- let mutable value : Option <( unit -> ProcessResult ) * string * string > = None
45
+ let mutable value : Option < string * string * string > = None
40
46
41
47
fun () ->
42
48
match value with
43
49
| None ->
44
- let commit =
45
- match Environment.environVarOrNone Environment.APPVEYOR_ REPO_ COMMIT with
46
- | Some c -> c
47
- | None -> Process.exec ( fun info -> { info with FileName = " git" ; Arguments = " rev-parse HEAD" }) |> getResult
48
-
49
- printfn " Executing gitversion from commit '%s '." commit
50
-
51
- match Environment.environVarOrNone Environment.APPVEYOR_ REPO_ TAG_ NAME with
52
- | Some v ->
53
- printfn " Full sementic versioning: '%s ', NuGet sementic versioning: '%s '" v v
54
- value <- Some (( fun () -> exec commit " /updateassemblyinfo" ), v, v)
55
- | None ->
56
- let fullSemVer = exec commit " /showvariable FullSemVer" |> getResult
57
- let nuGetVer = exec commit " /showvariable NuGetVersionV2" |> getResult
58
- printfn " Full sementic versioning: '%s ', NuGet sementic versioning: '%s '" fullSemVer nuGetVer
59
- value <- Some (( fun () -> exec commit " /updateassemblyinfo" ), fullSemVer, nuGetVer)
50
+ value <-
51
+ match Environment.environVarOrNone Environment.APPVEYOR_ REPO_ TAG_ NAME with
52
+ | Some v -> Some ( v, showVariable " AssemblySemVer" , v)
53
+ | None -> Some ( showVariable " FullSemVer" , showVariable " AssemblySemVer" , showVariable " NuGetVersionV2" )
60
54
61
55
Target.activateFinal " ClearGitVersionRepositoryLocation"
62
56
Option.get value
@@ -70,24 +64,27 @@ Target.create "Clean" (fun _ ->
70
64
|> Shell.deleteDirs
71
65
)
72
66
73
- Target.create " PatchAssemblyInfo" ( fun _ ->
74
- let ( updateAssemblyInfo , _ , _ ) = GitVersion.get()
75
-
76
- updateAssemblyInfo()
77
- |> fun res -> res.Messages
78
- |> List.iter ( printfn " %s " )
67
+ Target.create " PrintVersion" ( fun _ ->
68
+ let ( fullSemVer , assemblyVer , nugetVer ) = GitVersion.get()
69
+ printfn " Full version: '%s '" fullSemVer
70
+ printfn " Assembly version: '%s '" assemblyVer
71
+ printfn " NuGet version: '%s '" nugetVer
79
72
)
80
73
81
74
Target.create " UpdateBuildVersion" ( fun _ ->
82
- let ( _ , fullSemVer , _ ) = GitVersion.get()
75
+ let ( fullSemVer , _ , _ ) = GitVersion.get()
83
76
84
77
Shell.Exec( " appveyor" , sprintf " UpdateBuild -Version \" %s (%s )\" " fullSemVer ( Environment.environVar Environment.APPVEYOR_ BUILD_ NUMBER))
85
78
|> ignore
86
79
)
87
80
88
81
Target.create " Build" ( fun _ ->
82
+ let ( fullSemVer , assemblyVer , _ ) = GitVersion.get()
83
+
89
84
let setParams ( buildOptions : DotNet.BuildOptions ) =
90
- { buildOptions with Configuration = DotNet.BuildConfiguration.fromEnvironVarOrDefault Environment.BUILD_ CONFIGURATION DotNet.BuildConfiguration.Debug }
85
+ { buildOptions with
86
+ Common = { buildOptions.Common with DotNet.CustomParams = Some ( sprintf " /p:Version=%s /p:FileVersion=%s " fullSemVer assemblyVer) }
87
+ Configuration = DotNet.BuildConfiguration.fromEnvironVarOrDefault Environment.BUILD_ CONFIGURATION DotNet.BuildConfiguration.Debug }
91
88
92
89
!! " **/*.*proj"
93
90
-- " **/Orleans.Persistence.Minio.*Test.*proj"
@@ -118,7 +115,7 @@ Target.createFinal "ClearGitVersionRepositoryLocation" (fun _ ->
118
115
Target.create " All" ignore
119
116
120
117
" Clean"
121
- =?> ( " PatchAssemblyInfo " , Environment.environVarAsBool Environment.APPVEYOR )
118
+ ==> " PrintVersion "
122
119
=?> ( " UpdateBuildVersion" , Environment.environVarAsBool Environment.APPVEYOR)
123
120
==> " Build"
124
121
==> " Pack"
0 commit comments