forked from fsprojects/FSharp.TypeProviders.SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.fsx
113 lines (93 loc) · 3.73 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// --------------------------------------------------------------------------------------
// FAKE build script
// --------------------------------------------------------------------------------------
#I "packages/FAKE/tools"
#r "packages/FAKE/tools/FakeLib.dll"
open System
open System.IO
open Fake
open Fake.AssemblyInfoFile
open Fake.Git
open Fake.FscHelper
// --------------------------------------------------------------------------------------
// Information about the project to be used at NuGet
// --------------------------------------------------------------------------------------
let project = "FSharp.TypeProviders.StarterPack"
let authors = ["Tomas Petricek"; "Gustavo Guerra"; "Michael Newton"]
let summary = "Helper code and examples for getting started with Type Providers"
let description = """
The F# Type Provider Starter Pack contains everything you need to start building your own
type providers."""
let tags = "F# fsharp typeprovider"
let gitHome = "https://github.com/mavnn"
let gitName = "FSharp.TypeProviders.StarterPack"
// Read release notes & version info from RELEASE_NOTES.md
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
let release =
File.ReadLines "RELEASE_NOTES.md"
|> ReleaseNotesHelper.parseReleaseNotes
let PullRequest =
match getBuildParamOrDefault "APPVEYOR_PULL_REQUEST_NUMBER" "" with
| "" ->
trace "Master build detected"
None
| a ->
trace "Pull Request build detected"
Some <| int a
let buildNumber =
int (getBuildParamOrDefault "APPVEYOR_BUILD_VERSION" "0")
let version =
match PullRequest with
| None ->
sprintf "%s.%d" release.AssemblyVersion buildNumber
| Some num ->
sprintf "%s-pull-%d-%05d" release.AssemblyVersion num buildNumber
let releaseNotes = release.Notes |> String.concat "\n"
let outputPath = "./output/"
let workingDir = "./temp/"
let srcPath = "src"
// --------------------------------------------------------------------------------------
// Clean build results
Target "Clean" (fun _ ->
CleanDirs [outputPath; workingDir]
)
// --------------------------------------------------------------------------------------
// Compile ProvidedTypes as a smoke test
Target "Compile" (fun _ ->
Fsc id [srcPath @@ "ProvidedTypes.fsi";srcPath @@ "ProvidedTypes.fs"]
)
// --------------------------------------------------------------------------------------
// Build a NuGet package
Target "NuGet" (fun _ ->
[srcPath @@ "ProvidedTypes.fsi"] |> CopyTo (workingDir @@ "content")
[srcPath @@ "ProvidedTypes.fs"; "./src/DebugProvidedTypes.fs"] |> CopyTo (workingDir @@ "content")
NuGet (fun p ->
{ p with
Authors = authors
Project = project
Summary = summary
Description = description
Version = version
ReleaseNotes = releaseNotes
Tags = tags
OutputPath = outputPath
WorkingDir = workingDir
AccessKey = getBuildParamOrDefault "nugetkey" ""
Publish = hasBuildParam "nugetkey"
Files = [workingDir, None, None]
Dependencies = [] })
"nuget/FSharp.TypeProviders.StarterPack.nuspec"
)
// --------------------------------------------------------------------------------------
// Help
Target "Help" (fun _ ->
printfn ""
printfn " Please specify the target by calling 'build <Target>'"
printfn ""
printfn " * NuGet (creates package only, doesn't publish unless api key provided)"
printfn " * Compile (attempts to compile ProvidedTypes.fs)"
printfn "")
"Clean"
==> "Compile"
==> "NuGet"
RunTargetOrDefault "Help"