-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1.build.ps1
More file actions
139 lines (119 loc) · 3.5 KB
/
1.build.ps1
File metadata and controls
139 lines (119 loc) · 3.5 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<#
.Synopsis
Build script, https://github.com/nightroman/Invoke-Build
#>
param(
$Configuration = (property Configuration Release),
$FarHome = (property FarHome C:\Bin\Far\x64)
)
Set-StrictMode -Version 3
$_name = 'FarNet.FSharp.Charting'
$_root = "$FarHome\FarNet\Lib\$_name"
$_description = 'FarNet friendly FSharp.Charting extension.'
# Synopsis: Remove temp files.
task clean {
remove src\bin, src\obj, README.htm, *.nupkg, z
}
# Synopsis: Build and Post (post build target).
task build meta, {
Set-Location src
exec { dotnet build -c $Configuration -tl:off }
}
# Synopsis: Post build event.
task publish {
exec { dotnet publish src\FarNet.FSharp.Charting.fsproj -c $Configuration -o $_root --no-build }
Remove-Item "$_root\FarNet.FSharp.Charting.deps.json"
Copy-Item "src\$_name.ini" $_root
Set-Location $_root
remove FSharp.Core.dll
Set-Location runtimes
remove unix, win-arm64, win-x86
}
# Synopsis: Set $Script:Version.
task version {
($Script:_version = Get-BuildVersion Release-Notes.md '##\s+v(\d+\.\d+\.\d+)')
}
# Synopsis: Convert markdown to HTML.
task markdown {
requires -Path $env:MarkdownCss
exec { pandoc.exe @(
'README.md'
'--output=README.htm'
'--from=gfm'
'--embed-resources'
'--standalone'
"--css=$env:MarkdownCss"
"--metadata=pagetitle=$_name"
)}
}
# Synopsis: Generate meta files.
task meta -Inputs 1.build.ps1, Release-Notes.md -Outputs src/Directory.Build.props -Jobs version, {
Set-Content src/Directory.Build.props @"
<Project>
<PropertyGroup>
<Company>https://github.com/nightroman/$_name</Company>
<Copyright>Copyright (c) Roman Kuzmin</Copyright>
<Description>$_description</Description>
<Product>$_name</Product>
<Version>$_version</Version>
<FileVersion>$_version</FileVersion>
<AssemblyVersion>$_version</AssemblyVersion>
</PropertyGroup>
</Project>
"@
}
# Synopsis: Collect package files.
task package markdown, {
remove z
$toModule = mkdir "z\tools\FarHome\FarNet\Lib\$_name"
exec { robocopy $_root $toModule /s } 1
Copy-Item -Destination z @(
'README.md'
)
Copy-Item -Destination $toModule @(
"README.htm"
"LICENSE"
)
Assert-SameFile.ps1 -Result (Get-ChildItem $toModule -Recurse -File -Name) -Text -View $env:MERGE -Sample @'
FarNet.FSharp.Charting.dll
FarNet.FSharp.Charting.ini
FarNet.FSharp.Charting.pdb
FarNet.FSharp.Charting.xml
LICENSE
README.htm
System.Data.OleDb.dll
System.Data.SqlClient.dll
System.Windows.Forms.DataVisualization.dll
runtimes\win\lib\net10.0\System.Data.OleDb.dll
runtimes\win\lib\net8.0\System.Data.SqlClient.dll
runtimes\win-x64\native\sni.dll
'@
}
# Synopsis: Make NuGet package.
task nuget package, version, {
$dllPath = "$FarHome\FarNet\Lib\$_name\$_name.dll"
($dllVersion = (Get-Item $dllPath).VersionInfo.FileVersion.ToString())
assert $dllVersion.StartsWith("$_version.") 'Versions mismatch.'
Set-Content z\Package.nuspec @"
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>$_name</id>
<version>$_version</version>
<authors>Roman Kuzmin</authors>
<owners>Roman Kuzmin</owners>
<license type="expression">Apache-2.0</license>
<readme>README.md</readme>
<projectUrl>https://github.com/nightroman/$_name</projectUrl>
<description>$_description</description>
<releaseNotes>https://github.com/nightroman/FarNet.FSharp.Charting/blob/main/Release-Notes.md</releaseNotes>
<tags>FarManager FarNet FSharp Charting</tags>
</metadata>
</package>
"@
exec { NuGet.exe pack z\Package.nuspec }
}
task test {
Invoke-Build ** test
}
task . build, clean