-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.fsx
89 lines (75 loc) · 2.99 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
#I @"dependencies\FAKE.Core\tools\"
#r "FakeLib.dll"
open Fake
open Fake.AssemblyInfoFile
open System.IO
open System
open System.Text.RegularExpressions
let pathConcat a = String.concat (string Path.DirectorySeparatorChar) a
let config = getBuildParamOrDefault "config" "Release"
let coreProjPath = "src" </> "Org.Interactivity.Recognizer"
let buildSlns = [ "src" </> "GestureRecognizer.sln" ]
let outputPath = "output" </> config
let mainOutputPath = outputPath </> "Org.Interactivity.Recognizer"
let projectId = "WPFGestureRecognizer"
let packagePath = outputPath </> "nuget-package"
let projectName = "WPF Gesture Recognizer"
let projectDescription = "WPF interactivity trigger, running actions when swipe and/or tap gestures are detected."
let projectOwners = [ "Rod Landaeta" ]
let releaseInfo =
ReadFile "release_notes.md"
|> ReleaseNotesHelper.parseReleaseNotes
Target "Clean" <| fun _ ->
CleanDirs [ outputPath ]
Target "Version" <| fun _ ->
let ver = releaseInfo.AssemblyVersion
let gitHash = Git.Information.getCurrentHash()
printfn "##teamcity[buildNumber '%s']" ver
let productString = sprintf "%s %s (%s)" projectName ver gitHash
CreateCSharpAssemblyInfo
(pathConcat [coreProjPath; "Properties"; "AssemblyInfo.cs" ])
[ Attribute.Title productString
Attribute.Description productString
Attribute.Guid "c93fad81-4f16-40b0-b65a-383e1d1ef26e"
Attribute.Product projectName
Attribute.Company (projectOwners |> String.concat ", ")
Attribute.Version ver
Attribute.FileVersion ver ]
Target "Build" <| fun _ ->
buildSlns
|> MSBuild null "Build" [ "Configuration", config ]
|> ignore
Target "Package" <| fun _ ->
let lib = packagePath </> "lib" </> "net46"
let dlls = !! "*.dll" ++ "*.xml" |> SetBaseDir mainOutputPath
CreateDir lib
CopyFiles lib dlls
Target "Nuget" <| fun _ ->
let nugetOutput = outputPath </> "nuget"
CreateDir nugetOutput
(coreProjPath </> "Org.Interactivity.Recognizer.nuspec")
|> NuGet (fun p ->
{ p with
Project = projectId
Title = projectName
Authors = projectOwners
Description = projectDescription
OutputPath = nugetOutput
WorkingDir = packagePath
ReleaseNotes = releaseInfo.Notes |> String.concat "\n"
Version = releaseInfo.AssemblyVersion
AccessKey = getBuildParamOrDefault "nugetkey" ""
Publish = hasBuildParam "nugetkey"
})
Target "UpdateNuget" <| fun _ ->
let nugetPath = pathConcat ["dependencies";"nuget";"nuget.exe"]
Shell.Exec (nugetPath, "update -self") |> ignore
Target "-T" <| fun _ ->
log "Properties:"
log " config=Debug|Release"
log ""
PrintTargets()
Target "Full" DoNothing
// Dependencies
"Clean" ==> "Version" ==> "Build" ==> "Package" ==> "Nuget" ==> "Full"
RunTargetOrDefault "Full"