Updated dobuild.ps1

This commit is contained in:
unknown
2021-05-24 15:42:34 -07:00
parent be08036a24
commit f48ffbcc11
+21 -17
View File
@@ -13,34 +13,38 @@ Implement build and packaging of the package and place the output $OutDirectory/
function DoBuild
{
Write-Verbose -Verbose -Message "Starting DoBuild"
Write-Verbose -Verbose -Message "Copying module files to '${OutDirectory}/${ModuleName}'"
# copy psm1 and psd1 files
copy-item "${SrcPath}/*" "${OutDirectory}/${ModuleName}" -Recurse
#
# copy help
Write-Verbose -Verbose -Message "Copying help files to '${OutDirectory}/${ModuleName}'"
copy-item -Recurse "${HelpPath}/${Culture}" "${OutDirectory}/${ModuleName}"
# Write-Verbose -Verbose -Message "Copying help files to '${OutDirectory}/${ModuleName}'"
# copy-item -Recurse "${HelpPath}/${Culture}" "${OutDirectory}/${ModuleName}"
if ( Test-Path "${SrcPath}/code" ) {
$subsystemCodePath = Resolve-Path "${SrcPath}\..\DscSubsystem"
$subsystemBinPath = "bin/Debug/net6.0/publish/Microsoft.PowerShell.DscSubsystem.dll"
Write-Verbose -Verbose -Message "Subsystem code path ${subsystemCodePath}"
if ( Test-Path $subsystemCodePath )
{
Write-Verbose -Verbose -Message "Building assembly and copying to '${OutDirectory}/${ModuleName}'"
# build code and place it in the staging location
try {
Push-Location "${SrcPath}/code"
$result = dotnet publish
copy-item "bin/Debug/netstandard2.0/publish/${ModuleName}.dll" "${OutDirectory}/${ModuleName}"
Push-Location $subsystemCodePath
$result = dotnet publish
if (Test-Path $subsystemBinPath)
{
Copy-Item $subsystemBinPath "${OutDirectory}/${ModuleName}"
}
catch {
$result | ForEach-Object { Write-Warning $_ }
Write-Error "dotnet build failed"
}
finally {
Pop-Location
else
{
Write-Error "dotnet build failed - $subsystemBinPath not found - $result"
}
Pop-Location
}
else {
Write-Verbose -Verbose -Message "No code to build in '${SrcPath}/code'"
Write-Verbose -Verbose -Message "No code to build in '$subsystemCodePath'"
}
## Add build and packaging here