-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.settings.ps1
235 lines (182 loc) · 11.6 KB
/
build.settings.ps1
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
###############################################################################
# Customize these properties and tasks for your module.
###############################################################################
Push-Location $PSScriptRoot
Set-BuildEnvironment -Force
Properties {
# ----------------------- Basic properties --------------------------------
# The name of your module should match the basename of the PSD1 file.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$ModuleName = $env:BHProjectName
<#$ModuleName = Get-Item $SrcRootDir/*.psd1 |
Where-Object { $null -ne (Test-ModuleManifest -Path $_ -ErrorAction SilentlyContinue) } |
Select-Object -First 1 | Foreach-Object BaseName
#>
# The root directories for the module's docs, src and test.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$DocsRootDir = Join-Path -Path $PSScriptRoot -ChildPath 'docs'
$SrcRootDir = Join-Path -Path $PSScriptRoot -ChildPath $ModuleName
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$TestRootDir = Join-Path -Path $PSScriptRoot -ChildPath 'test'
# The $OutDir is where module files and updatable help files are staged for signing, install and publishing.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$ModuleVersion = (Test-ModuleManifest -Path (Join-Path -Path $SrcRootDir -ChildPath "$ModuleName.psd1").Version.ToString())
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$OutDir = [IO.Path]::Combine($PSScriptRoot,'Release',$ModuleName)
# The local installation directory for the install task. Defaults to your home Modules location.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$InstallPath = [IO.Path]::Combine((Split-Path $profile.CurrentUserAllHosts -Parent),'Modules',$ModuleName,$ModuleVersion)
# Default Locale used for help generation, defaults to en-US.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$DefaultLocale = 'en-US'
# Items in the $Exclude array will not be copied to the $OutDir e.g. $Exclude = @('.gitattributes')
# Typically you wouldn't put any file under the src dir unless the file was going to ship with
# the module. However, if there are such files, add their $SrcRootDir relative paths to the exclude list.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$Exclude = @()
# ------------------ Script analysis properties ---------------------------
# Enable/disable use of PSScriptAnalyzer to perform script analysis.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$ScriptAnalysisEnabled = $false
# When PSScriptAnalyzer is enabled, control which severity level will generate a build failure.
# Valid values are Error, Warning, Information and None. "None" will report errors but will not
# cause a build failure. "Error" will fail the build only on diagnostic records that are of
# severity error. "Warning" will fail the build on Warning and Error diagnostic records.
# "Any" will fail the build on any diagnostic record, regardless of severity.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
[ValidateSet('Error', 'Warning', 'Any', 'None')]
$ScriptAnalysisFailBuildOnSeverityLevel = 'Error'
# Path to the PSScriptAnalyzer settings file.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$ScriptAnalyzerSettingsPath = Join-Path -Path $PSScriptRoot -ChildPath 'ScriptAnalyzerSettings.psd1'
# ------------------- Script signing properties ---------------------------
# Set to $true if you want to sign your scripts. You will need to have a code-signing certificate.
# You can specify the certificate's subject name below. If not specified, you will be prompted to
# provide either a subject name or path to a PFX file. After this one time prompt, the value will
# saved for future use and you will no longer be prompted.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$ScriptSigningEnabled = $false
# Specify the Subject Name of the certificate used to sign your scripts. Leave it as $null and the
# first time you build, you will be prompted to enter your code-signing certificate's Subject Name.
# This variable is used only if $SignScripts is set to $true.
#
# This does require the code-signing certificate to be installed to your certificate store. If you
# have a code-signing certificate in a PFX file, install the certificate to your certificate store
# with the command below. You may be prompted for the certificate's password.
#
# Import-PfxCertificate -FilePath .\myCodeSigingCert.pfx -CertStoreLocation Cert:\CurrentUser\My
#
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$CertSubjectName = $null
# Certificate store path.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$CertPath = "Cert:\"
# -------------------- File catalog properties ----------------------------
# Enable/disable generation of a catalog (.cat) file for the module.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$CatalogGenerationEnabled = $true
# Select the hash version to use for the catalog file: 1 for SHA1 (compat with Windows 7 and
# Windows Server 2008 R2), 2 for SHA2 to support only newer Windows versions.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$CatalogVersion = 2
# ---------------------- Testing properties -------------------------------
# Enable/disable Pester code coverage reporting.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$CodeCoverageEnabled = $true
# CodeCoverageFiles specifies the files to perform code coverage analysis on. This property
# acts as a direct input to the Pester -CodeCoverage parameter, so will support constructions
# like the ones found here: https://github.com/pester/Pester/wiki/Code-Coverage.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$CodeCoverageFiles = (Join-Path -Path $SrcRootDir -ChildPath '*.ps1'), (Join-Path -Path $SrcRootDir -ChildPath '*.psm1')
# -------------------- Publishing properties ------------------------------
# Your NuGet API key for the PSGallery. Leave it as $null and the first time you publish,
# you will be prompted to enter your API key. The build will store the key encrypted in the
# settings file, so that on subsequent publishes you will no longer be prompted for the API key.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$NuGetApiKey = $null
# Name of the repository you wish to publish to. If $null is specified the default repo (PowerShellGallery) is used.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$PublishRepository = $null
# Path to the release notes file. Set to $null if the release notes reside in the manifest file.
# The contents of this file are used during publishing for the ReleaseNotes parameter.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$ReleaseNotesPath = Join-Path -Path $PSScriptRoot -ChildPath 'ReleaseNotes.md'
# ----------------------- Misc properties ---------------------------------
# In addition, PFX certificates are supported in an interactive scenario only,
# as a way to import a certificate into the user personal store for later use.
# This can be provided using the CertPfxPath parameter. PFX passwords will not be stored.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$SettingsPath = [IO.Path]::Combine($env:LOCALAPPDATA,'Plaster','NewModuleTemplate','SecuredBuildSettings.clixml')
# Specifies an output file path to send to Invoke-Pester's -OutputFile parameter.
# This is typically used to write out test results so that they can be sent to a CI
# system like AppVeyor.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$TestOutputFile = $null
# Specifies the test output format to use when the TestOutputFile property is given
# a path. This parameter is passed through to Invoke-Pester's -OutputFormat parameter.
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
$TestOutputFormat = "NUnitXml"
}
###############################################################################
# Customize these tasks for performing operations before and/or after file staging.
###############################################################################
# Executes before the StageFiles task.
Task BeforeStageFiles {
}
# Executes after the StageFiles task.
Task AfterStageFiles {
}
###############################################################################
# Customize these tasks for performing operations before and/or after Build.
###############################################################################
# Executes before the BeforeStageFiles phase of the Build task.
Task BeforeBuild {
}
# Executes after the Build task.
Task AfterBuild {
}
###############################################################################
# Customize these tasks for performing operations before and/or after BuildHelp.
###############################################################################
# Executes before the BuildHelp task.
Task BeforeBuildHelp {
}
# Executes after the BuildHelp task.
Task AfterBuildHelp {
}
###############################################################################
# Customize these tasks for performing operations before and/or after BuildUpdatableHelp.
###############################################################################
# Executes before the BuildUpdatableHelp task.
Task BeforeBuildUpdatableHelp {
}
# Executes after the BuildUpdatableHelp task.
Task AfterBuildUpdatableHelp {
}
###############################################################################
# Customize these tasks for performing operations before and/or after GenerateFileCatalog.
###############################################################################
# Executes before the GenerateFileCatalog task.
Task BeforeGenerateFileCatalog {
}
# Executes after the GenerateFileCatalog task.
Task AfterGenerateFileCatalog {
}
###############################################################################
# Customize these tasks for performing operations before and/or after Install.
###############################################################################
# Executes before the Install task.
Task BeforeInstall {
}
# Executes after the Install task.
Task AfterInstall {
}
###############################################################################
# Customize these tasks for performing operations before and/or after Publish.
###############################################################################
# Executes before the Publish task.
Task BeforePublish {
}
# Executes after the Publish task.
Task AfterPublish {
}