Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions Build/build-functions.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,22 @@ function Remove-ArtifactsDir {

function Update-GeneratedCode {
# Regenerate source code since it occasionally happens that merged pull requests did not include all the regenerated code
write-host -foreground blue "Generate code...`n---"
write-host "$root\UnitsNet\Scripts\GenerateUnits.ps1"
$genScriptDotNet = "$root/UnitsNet/Scripts/GenerateUnits.ps1"
$genScriptWrc = "$root/UnitsNet.WindowsRuntimeComponent/Scripts/GenerateUnits.ps1"

& "$root\UnitsNet\Scripts\GenerateUnits.ps1"
write-host -foreground blue "Generate code for .NET...`n---"
write-host $genScriptDotNet
& $genScriptDotNet
if ($lastexitcode -ne 0) { exit 1 }

if (-not $IncludeWindowsRuntimeComponent) {
write-host -foreground yellow "Skipping WindowsRuntimeComponent code regen."
} else {
& "$root\UnitsNet.WindowsRuntimeComponent\Scripts\GenerateUnits.ps1"
if ($lastexitcode -ne 0) { exit 1 }
}
# Regenerate WRC code even if we are not building that target.
# The reason is that build.bat will skip WRC build since most people don't have that dependency installed.
# AppVeyor build server would still regen and build WRC regardless, but this way we also get the changes
# into pull requests so they are visible and master branch is kept up-to-date.
write-host -foreground blue "Generate code for Windows Runtime Component...`n---"
write-host $genScriptWrc
& $genScriptWrc
if ($lastexitcode -ne 0) { exit 1 }

write-host -foreground blue "Generate code...END`n"
}
Expand Down
5 changes: 2 additions & 3 deletions generate-code.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@echo off
SET scriptdir=%~dp0
pushd "%scriptdir%UnitsNet\Scripts\
powershell -ExecutionPolicy Bypass -NoProfile -File ".\GenerateUnits.ps1"
popd
powershell -ExecutionPolicy Bypass -NoProfile -File "%scriptdir%UnitsNet/Scripts/GenerateUnits.ps1"
powershell -ExecutionPolicy Bypass -NoProfile -File "%scriptdir%UnitsNet.WindowsRuntimeComponent./Scripts/GenerateUnits.ps1"