|
2 | 2 |
|
3 | 3 | open Fake.Core |
4 | 4 |
|
5 | | -let project = "Plotly.NET" |
| 5 | +/// Contains relevant information about a project (e.g. version info, project location) |
| 6 | +type ProjectInfo = { |
| 7 | + Name: string |
| 8 | + ProjFile: string |
| 9 | + ReleaseNotes: ReleaseNotes.ReleaseNotes Option |
| 10 | + PackageVersionTag: string |
| 11 | + mutable PackagePrereleaseTag: string |
| 12 | + AssemblyVersion: string |
| 13 | + AssemblyInformationalVersion: string |
| 14 | +} with |
| 15 | + /// creates a ProjectInfo given a name, project file path, and release notes file path. |
| 16 | + /// version info is created from the version header of the uppermost release notes entry. |
| 17 | + /// Assembly version is set to X.0.0, where X is the major version from the releas enotes. |
| 18 | + static member create( |
| 19 | + name: string, |
| 20 | + projFile: string, |
| 21 | + releaseNotesPath: string |
| 22 | + ): ProjectInfo = |
| 23 | + let release = releaseNotesPath |> ReleaseNotes.load |
| 24 | + let stableVersion = release.NugetVersion |> SemVer.parse |
| 25 | + let stableVersionTag = $"{stableVersion.Major}.{stableVersion.Minor}.{stableVersion.Patch}" |
| 26 | + let assemblyVersion = $"{stableVersion.Major}.0.0" |
| 27 | + let assemblyInformationalVersion = stableVersionTag |
| 28 | + { |
| 29 | + Name = name |
| 30 | + ProjFile = projFile |
| 31 | + ReleaseNotes = Some release |
| 32 | + PackagePrereleaseTag = "" |
| 33 | + PackageVersionTag = stableVersionTag |
| 34 | + AssemblyVersion = assemblyVersion |
| 35 | + AssemblyInformationalVersion = assemblyInformationalVersion |
| 36 | + } |
| 37 | + static member create( |
| 38 | + name: string, |
| 39 | + projFile: string |
| 40 | + ): ProjectInfo = |
| 41 | + { |
| 42 | + Name = name |
| 43 | + ProjFile = projFile |
| 44 | + ReleaseNotes = None |
| 45 | + PackagePrereleaseTag = "" |
| 46 | + PackageVersionTag = "" |
| 47 | + AssemblyVersion = "" |
| 48 | + AssemblyInformationalVersion = "" |
| 49 | + } |
6 | 50 |
|
7 | | -let testProjects = |
8 | | - [ |
9 | | - "tests/Plotly.NET.Tests/Plotly.NET.Tests.fsproj" |
10 | | - "tests/Plotly.NET.ImageExport.Tests/Plotly.NET.ImageExport.Tests.fsproj" |
11 | | - "tests/Plotly.NET.Tests.CSharp/Plotly.NET.Tests.CSharp.csproj" |
12 | | - ] |
| 51 | +let projectName = "Plotly.NET" |
13 | 52 |
|
14 | | -let solutionFile = $"{project}.sln" |
15 | | - |
16 | | -let configuration = "Release" |
| 53 | +let solutionFile = $"{projectName}.sln" |
17 | 54 |
|
18 | 55 | let gitOwner = "plotly" |
| 56 | +let gitHome = $"https://github.com/{gitOwner}" |
| 57 | +let projectRepo = $"https://github.com/{gitOwner}/{projectName}" |
19 | 58 |
|
20 | | -let gitHome = |
21 | | - $"https://github.com/{gitOwner}" |
| 59 | +/// packages are generated in this directory. |
| 60 | +let pkgDir = "pkg" |
22 | 61 |
|
23 | | -let projectRepo = |
24 | | - $"https://github.com/{gitOwner}/{project}" |
| 62 | +/// binaries are built using this configuration. |
| 63 | +let configuration = "Release" |
25 | 64 |
|
26 | | -let pkgDir = "pkg" |
| 65 | +let CoreTestProject = ProjectInfo.create("Plotly.NET.Tests", "tests/Plotly.NET.Tests/Plotly.NET.Tests.fsproj") |
| 66 | +let ImageExportTestProject = ProjectInfo.create("Plotly.NET.ImageExport.Tests", "tests/Plotly.NET.ImageExport.Tests/Plotly.NET.ImageExport.Tests.fsproj") |
| 67 | +let CSharpInteroperabilityTestProject = ProjectInfo.create("Plotly.NET.Tests.CSharpInteroperability", "tests/Plotly.NET.Tests.CSharpInteroperability/Plotly.NET.Tests.CSharpInteroperability.csproj") |
| 68 | +let CSharpTestProject = ProjectInfo.create("Plotly.NET.CSharp.Tests", "tests/Plotly.NET.CSharp.Tests/Plotly.NET.CSharp.Tests.csproj") |
| 69 | + |
| 70 | +/// contains project info about all test projects |
| 71 | +let testProjects = |
| 72 | + [ |
| 73 | + CoreTestProject |
| 74 | + ImageExportTestProject |
| 75 | + CSharpTestProject |
| 76 | + ] |
| 77 | + |
| 78 | +let CoreProject = ProjectInfo.create("Plotly.NET", "src/Plotly.NET/Plotly.NET.fsproj", "src/Plotly.NET/RELEASE_NOTES.md") |
| 79 | +let InteractiveProject = ProjectInfo.create("Plotly.NET.Interactive", "src/Plotly.NET.Interactive/Plotly.NET.Interactive.fsproj", "src/Plotly.NET.Interactive/RELEASE_NOTES.md") |
| 80 | +let ImageExportProject = ProjectInfo.create("Plotly.NET.ImageExport", "src/Plotly.NET.ImageExport/Plotly.NET.ImageExport.fsproj", "src/Plotly.NET.ImageExport/RELEASE_NOTES.md") |
| 81 | +let CSharpProject = ProjectInfo.create("Plotly.NET.CSharp", "src/Plotly.NET.CSharp/Plotly.NET.CSharp.csproj", "src/Plotly.NET.CSharp/RELEASE_NOTES.md") |
27 | 82 |
|
28 | | -let release = |
29 | | - ReleaseNotes.load "RELEASE_NOTES.md" |
| 83 | +/// contains project info about all projects |
| 84 | +let projects = [ |
| 85 | + CoreProject |
| 86 | + InteractiveProject |
| 87 | + ImageExportProject |
| 88 | + CSharpProject |
| 89 | +] |
30 | 90 |
|
31 | | -let stableVersion = |
32 | | - SemVer.parse release.NugetVersion |
| 91 | +/// docs are always targeting the version of the core project |
| 92 | +let stableDocsVersionTag = CoreProject.PackageVersionTag |
33 | 93 |
|
34 | | -let stableVersionTag = |
35 | | - (sprintf "%i.%i.%i" stableVersion.Major stableVersion.Minor stableVersion.Patch) |
| 94 | +/// branch tag is always the version of the core project |
| 95 | +let branchTag = CoreProject.PackageVersionTag |
36 | 96 |
|
| 97 | +/// prerelease suffix used by prerelease buildtasks |
37 | 98 | let mutable prereleaseSuffix = "" |
38 | 99 |
|
| 100 | +/// prerelease tag used by prerelease buildtasks |
39 | 101 | let mutable prereleaseTag = "" |
40 | 102 |
|
| 103 | +/// mutable switch used to signal that we are building a prerelease version, used in prerelease buildtasks |
41 | 104 | let mutable isPrerelease = false |
0 commit comments