@@ -169,23 +169,23 @@ function Build-Module {
169
169
170
170
# Ensure the OutputDirectory (exists for build, or is cleaned otherwise)
171
171
$OutputDirectory = $ModuleInfo | ResolveOutputFolder
172
- if ($Target -notmatch " Build" ) {
172
+ if ($ModuleInfo . Target -notmatch " Build" ) {
173
173
return
174
174
}
175
175
$RootModule = Join-Path $OutputDirectory " $ ( $ModuleInfo.Name ) .psm1"
176
176
$OutputManifest = Join-Path $OutputDirectory " $ ( $ModuleInfo.Name ) .psd1"
177
177
Write-Verbose " Output to: $OutputDirectory "
178
178
179
179
# Skip the build if it's up to date already
180
- Write-Verbose " Target $Target "
180
+ Write-Verbose " Target $ ( $ModuleInfo . Target) "
181
181
$NewestBuild = (Get-Item $RootModule - ErrorAction SilentlyContinue).LastWriteTime
182
182
$IsNew = Get-ChildItem $ModuleInfo.ModuleBase - Recurse |
183
183
Where-Object LastWriteTime -gt $NewestBuild |
184
184
Select-Object - First 1 - ExpandProperty LastWriteTime
185
185
186
186
if ($null -eq $IsNew ) {
187
187
# This is mostly for testing ...
188
- if ($Passthru ) {
188
+ if ($ModuleInfo . Passthru ) {
189
189
Get-Module $OutputManifest - ListAvailable
190
190
}
191
191
return # Skip the build
@@ -240,31 +240,31 @@ function Build-Module {
240
240
}
241
241
242
242
try {
243
- if ($Version ) {
244
- Write-Verbose " Update Manifest at $OutputManifest with version: $Version "
245
- Update-Metadata - Path $OutputManifest - PropertyName ModuleVersion - Value $Version
243
+ if ($ModuleInfo . Version ) {
244
+ Write-Verbose " Update Manifest at $OutputManifest with version: $ ( $ModuleInfo . Version) "
245
+ Update-Metadata - Path $OutputManifest - PropertyName ModuleVersion - Value $ModuleInfo . Version
246
246
}
247
247
} catch {
248
- Write-Warning " Failed to update version to $Version . $_ "
248
+ Write-Warning " Failed to update version to $ ( $ModuleInfo . Version) . $_ "
249
249
}
250
250
251
251
if ($null -ne (Get-Metadata - Path $OutputManifest - PropertyName PrivateData.PSData.Prerelease - ErrorAction SilentlyContinue)) {
252
- if ($Prerelease ) {
253
- Write-Verbose " Update Manifest at $OutputManifest with Prerelease: $Prerelease "
254
- Update-Metadata - Path $OutputManifest - PropertyName PrivateData.PSData.Prerelease - Value $Prerelease
252
+ if ($ModuleInfo . Prerelease ) {
253
+ Write-Verbose " Update Manifest at $OutputManifest with Prerelease: $ ( $ModuleInfo . Prerelease) "
254
+ Update-Metadata - Path $OutputManifest - PropertyName PrivateData.PSData.Prerelease - Value $ModuleInfo . Prerelease
255
255
} elseif ($PSCmdlet.ParameterSetName -eq " SemanticVersion" -or $PSBoundParameters.ContainsKey (" Prerelease" )) {
256
256
Update-Metadata - Path $OutputManifest - PropertyName PrivateData.PSData.Prerelease - Value " "
257
257
}
258
- } elseif ( $ Prerelease ) {
258
+ } elseif ( $ModuleInfo . Prerelease ) {
259
259
Write-Warning (" Cannot set Prerelease in module manifest. Add an empty Prerelease to your module manifest, like:`n " +
260
260
' PrivateData = @{ PSData = @{ Prerelease = "" } }' )
261
261
}
262
262
263
- if ($BuildMetadata ) {
264
- Write-Verbose " Update Manifest at $OutputManifest with metadata: $BuildMetadata from $SemVer "
263
+ if ($ModuleInfo . BuildMetadata ) {
264
+ Write-Verbose " Update Manifest at $OutputManifest with metadata: $ ( $ModuleInfo . BuildMetadata) from $ ( $ModuleInfo . SemVer) "
265
265
$RelNote = Get-Metadata - Path $OutputManifest - PropertyName PrivateData.PSData.ReleaseNotes - ErrorAction SilentlyContinue
266
266
if ($null -ne $RelNote ) {
267
- $Line = " $ ( $ModuleInfo.Name ) v$ ( $SemVer ) "
267
+ $Line = " $ ( $ModuleInfo.Name ) v$ ( $ ( $ModuleInfo . SemVer) ) "
268
268
if ([string ]::IsNullOrWhiteSpace($RelNote )) {
269
269
Write-Verbose " New ReleaseNotes:`n $Line "
270
270
Update-Metadata - Path $OutputManifest - PropertyName PrivateData.PSData.ReleaseNotes - Value $Line
@@ -284,7 +284,7 @@ function Build-Module {
284
284
}
285
285
286
286
# This is mostly for testing ...
287
- if ($Passthru ) {
287
+ if ($ModuleInfo . Passthru ) {
288
288
Get-Module $OutputManifest - ListAvailable
289
289
}
290
290
} finally {
0 commit comments