Overview
Features
Download
Documentation
Community
Add-Ons & Services

Windows build does not fail

A general discussion forum.

Windows build does not fail

Postby ParagDoke » 29 Apr 2013, 11:49

Hi.
From a builders perspective, if I run buildwin.cmd with an appropriate set of arguments ... and if PocoFoundation*.lib fails to build (say because some pocomsg.h file was read-only), then buildwin.cmd does not exit, but continues to try the downstream build actions.

Was this a planned behaviour? If not, what would be a good way to attempt to fix it ?
Thanks in advance,
Parag Doke
ParagDoke
 
Posts: 2
Joined: 29 Apr 2013, 11:43

Re: Windows build does not fail

Postby alex » 29 Apr 2013, 14:03

ParagDoke wrote:what would be a good way to attempt to fix it ?

To check the return value and abort the script if build fails. Allegedly, there is some difference between devenv.exe and devenv.com in that regard. Perhaps switching to msbuild would be the best thing to do. If you can contribute some work towards that goal, let us know.
alex
 
Posts: 1086
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Windows build does not fail

Postby ParagDoke » 30 Apr 2013, 06:32

Thanks for your reply Alex. I have an untested version of the modified buildwin.cmd pasted below (don't know how to test all combinations).

However, if I understand correctly, you mentioned using msbuild. Does that mean picking up arguments passed to buildwin.cmd and passing them to msbuild as properties (and msbuild in turn does all the conditional processing and invokes child msbuild instances to build solutions) ... is the right way to go. If yes, I think I can contribute. Will look around on the site to understand how code changes are proposed, reviewed and submitted.

Regards,
Parag Doke

Code: Select all
@echo off
setlocal

rem
rem buildwin.cmd
rem
rem POCO C++ Libraries command-line build script
rem for MS Visual Studio 2003 to 2012
rem
rem $Id: //poco/1.4/dist/buildwin.cmd#7 $
rem
rem Copyright (c) 2006-2013 by Applied Informatics Software Engineering GmbH
rem and Contributors.
rem
rem Original version by Aleksandar Fabijanic.
rem Modified by Guenter Obiltschnig.
rem
rem Usage:
rem ------
rem buildwin VS_VERSION [ACTION] [LINKMODE] [CONFIGURATION] [PLATFORM] [SAMPLES] [TOOL]
rem VS_VERSION:    71|80|90|100|110
rem ACTION:        build|rebuild|clean
rem LINKMODE:      static_mt|static_md|shared|all
rem CONFIGURATION: release|debug|both
rem PLATFORM:      Win32|x64|WinCE
rem SAMPLES:       samples|nosamples
rem TOOL:          devenv|vcexpress|msbuild
rem
rem VS_VERSION is required argument. Default is build all.

if not defined VCINSTALLDIR (
echo Error: No Visual C++ environment found.
echo Please run this script from a Visual Studio Command Prompt
echo or run "%%VSnnCOMNTOOLS%%\vcvars32.bat" first.
goto :EOF)

rem Change OPENSSL_DIR to match your setup
set OPENSSL_DIR=c:\OpenSSL
set OPENSSL_INCLUDE=%OPENSSL_DIR%\include
set OPENSSL_LIB=%OPENSSL_DIR%\lib\VC
set INCLUDE=%INCLUDE%;%OPENSSL_INCLUDE%
set LIB=%LIB%;%OPENSSL_LIB%

set POCO_BASE=%CD%
set PATH=%POCO_BASE%\bin64;%POCO_BASE%\bin;%PATH%

rem VS version {71|80|90|100|110}
if "%1"=="" goto usage
set VS_VERSION=vs%1

if "%7"=="" goto use_devenv
set BUILD_TOOL=%7
goto use_custom

:use_devenv
set BUILD_TOOL=devenv
if "%VS_VERSION%"=="vs100" (set BUILD_TOOL=msbuild)
if "%VS_VERSION%"=="vs110" (set BUILD_TOOL=msbuild)

:use_custom
if not "%BUILD_TOOL%"=="msbuild" (set USEENV=/useenv)
if "%BUILD_TOOL%"=="msbuild" (
set ACTIONSW=/t:
set CONFIGSW=/p:Configuration=
set EXTRASW=/m
set USEENV=/p:UseEnv=true
)
if not "%BUILD_TOOL%"=="msbuild" (set ACTIONSW=/)

if "%VS_VERSION%"=="vs100" (goto msbuildok)
if "%VS_VERSION%"=="vs110" (goto msbuildok)
if "%BUILD_TOOL%"=="msbuild" (
echo "Cannot use msbuild with Visual Studio 2008 or earlier."
exit
)
:msbuildok

rem Action [build|rebuild|clean]
set ACTION=%2
if not "%ACTION%"=="build" (
if not "%ACTION%"=="rebuild" (
if not "%ACTION%"=="" (
if not "%ACTION%"=="clean" goto usage)))

if "%ACTION%"=="" (set ACTION="build")

rem Link mode [static|shared|both]
set LINK_MODE=%3
if not "%LINK_MODE%"=="static_mt" (
if not "%LINK_MODE%"=="static_md" (
if not "%LINK_MODE%"=="shared" (
if not "%LINK_MODE%"=="" (
if not "%LINK_MODE%"=="all" goto usage))))

rem Configuration [release|debug|both]
set CONFIGURATION=%4
if not "%CONFIGURATION%"=="release" (
if not "%CONFIGURATION%"=="debug" (
if not "%CONFIGURATION%"=="" (
if not "%CONFIGURATION%"=="both" goto usage)))

rem Platform [Win32|x64|WinCE]
set PLATFORM=%5%
if not "%PLATFORM%"=="" (
if not "%PLATFORM%"=="Win32" (
if not "%PLATFORM%"=="x64" (
if not "%PLATFORM%"=="WinCE" goto usage)))

if "%PLATFORM%"=="" (set PLATFORM_SUFFIX=) else (
if "%PLATFORM%"=="Win32" (set PLATFORM_SUFFIX=) else (
if "%PLATFORM%"=="x64" (set PLATFORM_SUFFIX=_x64) else (
if "%PLATFORM%"=="WinCE" (set PLATFORM_SUFFIX=_CE))))

rem Samples [samples|nosamples]
set SAMPLES=%6
if "%SAMPLES%"=="" (set SAMPLES=samples)

set DEBUG_SHARED=0
set RELEASE_SHARED=0
set DEBUG_STATIC_MT=0
set RELEASE_STATIC_MT=0
set DEBUG_STATIC_MD=0
set RELEASE_STATIC_MD=0

if "%LINK_MODE%"=="shared" (
if "%CONFIGURATION%"=="release" (set RELEASE_SHARED=1) else (
if "%CONFIGURATION%"=="both" (set RELEASE_SHARED=1) else (
if "%CONFIGURATION%"=="" (set RELEASE_SHARED=1))))

if "%LINK_MODE%"=="shared" (
if "%CONFIGURATION%"=="debug" (set DEBUG_SHARED=1) else (
if "%CONFIGURATION%"=="both" (set DEBUG_SHARED=1) else (
if "%CONFIGURATION%"=="" (set DEBUG_SHARED=1))))

if "%LINK_MODE%"=="static_mt" (
if "%CONFIGURATION%"=="release" (set RELEASE_STATIC_MT=1) else (
if "%CONFIGURATION%"=="both" (set RELEASE_STATIC_MT=1) else (
if "%CONFIGURATION%"=="" (set RELEASE_STATIC_MT=1))))

if "%LINK_MODE%"=="static_md" (
if "%CONFIGURATION%"=="release" (set RELEASE_STATIC_MD=1) else (
if "%CONFIGURATION%"=="both" (set RELEASE_STATIC_MD=1) else (
if "%CONFIGURATION%"=="" (set RELEASE_STATIC_MD=1))))

if "%LINK_MODE%"=="static_mt" (
if "%CONFIGURATION%"=="debug" (set DEBUG_STATIC_MT=1) else (
if "%CONFIGURATION%"=="both" (set DEBUG_STATIC_MT=1) else (
if "%CONFIGURATION%"=="" (set DEBUG_STATIC_MT=1))))

if "%LINK_MODE%"=="static_md" (
if "%CONFIGURATION%"=="debug" (set DEBUG_STATIC_MD=1) else (
if "%CONFIGURATION%"=="both" (set DEBUG_STATIC_MD=1) else (
if "%CONFIGURATION%"=="" (set DEBUG_STATIC_MD=1))))

if "%LINK_MODE%"=="all" (
if "%CONFIGURATION%"=="debug" (
set DEBUG_STATIC_MT=1
set DEBUG_STATIC_MD=1
set DEBUG_SHARED=1) else (
if "%CONFIGURATION%"=="release" (
set RELEASE_STATIC_MT=1
set RELEASE_STATIC_MD=1
set RELEASE_SHARED=1) else (
if "%CONFIGURATION%"=="both" (
set DEBUG_STATIC_MT=1
set DEBUG_STATIC_MD=1
set DEBUG_SHARED=1
set RELEASE_STATIC_MT=1
set RELEASE_STATIC_MD=1
set RELEASE_SHARED=1) else (
if "%CONFIGURATION%"=="" (
set DEBUG_STATIC_MT=1
set DEBUG_STATIC_MD=1
set DEBUG_SHARED=1
set RELEASE_STATIC_MT=1
set RELEASE_STATIC_MD=1
set RELEASE_SHARED=1)))))

if "%LINK_MODE%"=="" (
if "%CONFIGURATION%"=="debug" (
set DEBUG_STATIC_MT=1
set DEBUG_STATIC_MD=1
set DEBUG_SHARED=1) else (
if "%CONFIGURATION%"=="release" (
set RELEASE_STATIC_MT=1
set RELEASE_STATIC_MD=1
set RELEASE_SHARED=1) else (
if "%CONFIGURATION%"=="both" (
set DEBUG_STATIC_MT=1
set DEBUG_STATIC_MD=1
set DEBUG_SHARED=1
set RELEASE_STATIC_MT=1
set RELEASE_STATIC_MD=1
set RELEASE_SHARED=1) else (
if "%CONFIGURATION%"=="" (
set DEBUG_STATIC_MT=1
set DEBUG_STATIC_MD=1
set DEBUG_SHARED=1
set RELEASE_STATIC_MT=1
set RELEASE_STATIC_MD=1
set RELEASE_SHARED=1)))))

echo.
echo.
echo ########################################################################
echo ####
echo #### STARTING VISUAL STUDIO BUILD (%VS_VERSION%, %PLATFORM%)
echo ####
echo ########################################################################
echo.
echo.
echo The following configurations will be built:

if %DEBUG_SHARED%==1      (echo debug_shared)
if %RELEASE_SHARED%==1    (echo release_shared)
if %DEBUG_STATIC_MT%==1   (echo debug_static_mt)
if %DEBUG_STATIC_MD%==1   (echo debug_static_md)
if %RELEASE_STATIC_MT%==1 (echo release_static_mt)
if %RELEASE_STATIC_MD%==1 (echo release_static_md)

rem build for up to 4 levels deep
for /f %%G in ('findstr /R "." components') do (
 if exist %%G (
  cd %%G
  for /f "tokens=1,2,3,4 delims=/" %%Q in ("%%G") do (
   if exist %%Q%PLATFORM_SUFFIX%_%VS_VERSION%.sln call :BuildCombinations %%G %%Q%PLATFORM_SUFFIX%_%VS_VERSION%.sln
   if exist %%R%PLATFORM_SUFFIX%_%VS_VERSION%.sln call :BuildCombinations %%G %%R%PLATFORM_SUFFIX%_%VS_VERSION%.sln
   if exist %%S%PLATFORM_SUFFIX%_%VS_VERSION%.sln call :BuildCombinations %%G %%S%PLATFORM_SUFFIX%_%VS_VERSION%.sln
   if exist %%T%PLATFORM_SUFFIX%_%VS_VERSION%.sln call :BuildCombinations %%G %%T%PLATFORM_SUFFIX%_%VS_VERSION%.sln

  )
  cd %POCO_BASE%
 )
)

if "%SAMPLES%"=="no" goto :EOF
if "%SAMPLES%"=="nosamples" goto :EOF

rem root level component samples
for /f %%G in ('findstr /R "." components') do (
 if exist %%G\samples\samples%PLATFORM_SUFFIX%_%VS_VERSION%.sln (
  cd %%G\samples 
  call :BuildCombinations %%G/samples samples%PLATFORM_SUFFIX%_%VS_VERSION%.sln
  cd %POCO_BASE%
 )
)

goto :EOF

:usage
echo Usage:
echo ------
echo buildwin VS_VERSION [ACTION] [LINKMODE] [CONFIGURATION] [PLATFORM] [SAMPLES] [TOOL]
echo VS_VERSION:    "71|80|90|100|110"
echo ACTION:        "build|rebuild|clean"
echo LINKMODE:      "static_mt|static_md|shared|all"
echo CONFIGURATION: "release|debug|both"
echo PLATFORM:      "Win32|x64|WinCE"
echo SAMPLES:       "samples|nosamples"
echo TOOL:          "devenv|vcexpress|msbuild"
echo.
echo Default is build all.
endlocal
goto EOF

:BuildSolution SolutionName BuildMode
REM Assuming all other variables are already set, only the solution name and build mode vary from 1 call of this procedure to another
REM The tilde removes surrounding quotes. The set "variable=value" style rules out confusion if the value has whitespace.
set "SolutionName=%~1"
set "BuildMode=%~2"
%BUILD_TOOL% %USEENV% %EXTRASW% %ACTIONSW%%ACTION% %CONFIGSW%%BuildMode% "%SolutionName%"
if %errorlevel% NEQ 0 (
   echo Building %SolutionName% in mode %BuildMode% failed!
   REM exit /b will only exit the batch file, it will not exit the cmd instance (which is desirable).
   exit /b %errorlevel%
)
REM This line simply runs echo. thrice
for /l %%i in (1,1,3) do echo.
goto EOF

:BuildCombinations ComponentName SolutionName
set "ComponentName=%~1"
set "SolutionName=%~2"
echo.
echo.
echo ########################################################################
echo ####
echo #### Building %ComponentName%
echo ####
echo ########################################################################
echo.
if %DEBUG_SHARED%==1      call :BuildSolution %SolutionName% debug_shared
if %RELEASE_SHARED%==1       call :BuildSolution %SolutionName% release_shared
if %DEBUG_STATIC_MT%==1      call :BuildSolution %SolutionName% debug_static_mt
if %RELEASE_STATIC_MT%==1    call :BuildSolution %SolutionName% release_static_mt
if %DEBUG_STATIC_MD%==1      call :BuildSolution %SolutionName% debug_static_md
if %RELEASE_STATIC_MD%==1    call :BuildSolution %SolutionName% release_static_md

goto EOF

:EOF
ParagDoke
 
Posts: 2
Joined: 29 Apr 2013, 11:43

Re: Windows build does not fail

Postby alex » 30 Apr 2013, 14:18

ParagDoke wrote:don't know how to test all combinations

one way would be to create a parent script calling all build combinations. In fact, since we are in the process of building a CI environment, we will need something like that real soon.

ParagDoke wrote:you mentioned using msbuild. Does that mean picking up arguments passed to buildwin.cmd and passing them to msbuild as properties (and msbuild in turn does all the conditional processing and invokes child msbuild instances to build solutions) ... is the right way to go. If yes, I think I can contribute


Yes, there is somewhat of msbuild support in the script already but it needs testing. See this post for more details and links to previous discussions. In particular, VCExpress builds are asked for but we (core developers) do not have time to address that (it is not our pressing need and it would require some code #ifdefing to remove dependencies on MFC imposed bu TestSuite GUI).

ParagDoke wrote:Will look around on the site to understand how code changes are proposed, reviewed and submitted.

When you do the work and test it, send us pull request on github. We'll test your contribution and integrate it. If you need more details or guidance, you can contact me directly at(alex, dot(pocoproject, org)). Here's Getting Started and Coding Style Guide.
alex
 
Posts: 1086
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron