mirror of
https://github.com/PowerShell/PSDesiredStateConfiguration
synced 2026-06-21 13:45:25 +00:00
Updated dobuild.ps1
This commit is contained in:
+21
-17
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user