Skip to content

Commit

Permalink
Windows Builds: add $ErrorActionPreference = "Stop" to power shell sc…
Browse files Browse the repository at this point in the history
…ripts

Windows Power Shell default is to ignore errors, and continue, so we
miss things, if there were problems. Change this feature to exit on
error.

Also check the result of the build, and if it didn't work - throw an
error

Signed-off-by: Robin Getz <[email protected]>
  • Loading branch information
rgetz authored and pcercuei committed Feb 21, 2022
1 parent b370c44 commit 56910cb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CI/build_win.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.2#erroractionpreference
$ErrorActionPreference = "Stop"
$ErrorView = "NormalView"

$COMPILER=$Env:COMPILER
$ARCH=$Env:ARCH
Expand All @@ -12,6 +15,9 @@ if ($ARCH -eq "Win32") {

cmake -G "$COMPILER" -A "$ARCH" -DCMAKE_SYSTEM_PREFIX_PATH="C:" -DENABLE_IPV6=OFF -DWITH_USB_BACKEND=ON -DWITH_SERIAL_BACKEND=ON -DPYTHON_BINDINGS=ON -DCSHARP_BINDINGS:BOOL=ON -DLIBXML2_LIBRARIES="C:\\libs\\32\\libxml2.lib" -DLIBUSB_LIBRARIES="C:\\libs\\32\\libusb-1.0.lib" -DLIBSERIALPORT_LIBRARIES="C:\\libs\\32\\libserialport.dll.a" -DLIBUSB_INCLUDE_DIR="C:\\include\\libusb-1.0" -DLIBXML2_INCLUDE_DIR="C:\\include\\libxml2" ..
cmake --build . --config Release
if ( $LASTEXITCODE -ne 0 ) {
throw "[*] cmake build failure"
}
cp .\libiio.iss $env:BUILD_ARTIFACTSTAGINGDIRECTORY

cd ../bindings/python
Expand All @@ -27,6 +33,9 @@ if ($ARCH -eq "Win32") {

cmake -G "$COMPILER" -A "$ARCH" -DCMAKE_SYSTEM_PREFIX_PATH="C:" -DENABLE_IPV6=OFF -DWITH_USB_BACKEND=ON -DWITH_SERIAL_BACKEND=ON -DPYTHON_BINDINGS=ON -DCSHARP_BINDINGS:BOOL=ON -DLIBXML2_LIBRARIES="C:\\libs\\64\\libxml2.lib" -DLIBUSB_LIBRARIES="C:\\libs\\64\\libusb-1.0.lib" -DLIBSERIALPORT_LIBRARIES="C:\\libs\\64\\libserialport.dll.a" -DLIBUSB_INCLUDE_DIR="C:\\include\\libusb-1.0" -DLIBXML2_INCLUDE_DIR="C:\\include\\libxml2" ..
cmake --build . --config Release
if ( $LASTEXITCODE -ne 0 ) {
throw "[*] cmake build failure"
}
cp .\libiio.iss $env:BUILD_ARTIFACTSTAGINGDIRECTORY

cd ../bindings/python
Expand Down
4 changes: 4 additions & 0 deletions CI/generate_exe.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.2#erroractionpreference
$ErrorActionPreference = "Stop"
$ErrorView = "NormalView"

SET PATH=packages\Tools.InnoSetup.5.6.1\tools
iscc $env:BUILD_ARTIFACTSTAGINGDIRECTORY\Windows-VS-16-2019-Win32\libiio.iss

Expand Down
3 changes: 3 additions & 0 deletions CI/install_deps_win.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.2#erroractionpreference
$ErrorActionPreference = "Stop"
$ErrorView = "NormalView"

$ARCH=$Env:ARCH

Expand Down
3 changes: 3 additions & 0 deletions CI/publish_deps.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.2#erroractionpreference
$ErrorActionPreference = "Stop"
$ErrorView = "NormalView"

$src_dir=$pwd

Expand Down

0 comments on commit 56910cb

Please sign in to comment.