Changeset 16754
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk merged: 16221,16223-16224,16381,16624
- Property svn:mergeinfo changed
-
stable/Build.cmd
r7594 r16754 1 1 @ECHO OFF 2 3 SET CLEANBEFOREBUILD= 4 5 SET SELECTED= 6 SET CONFIGURATION= 7 SET PLATFORM= 8 9 IF "%~1"=="" GOTO :prompt_solution 10 11 SET SELECTED=%1 12 IF NOT EXIST %SELECTED% ( 13 ECHO Solution file %SELECTED% could not be found. 14 GOTO :end 15 ) 16 ECHO Building solution %SELECTED% ... 17 GOTO :config_selection 18 19 :prompt_solution 20 SET /A COUNT=0 21 FOR /F "tokens=*" %%A IN ('dir /B *.sln') DO ( 22 CALL :forloopbody "%%A" 23 ) 24 25 IF "%COUNT%"=="1" ( 26 SET SELECTED=%SOLUTIONS.1% 27 ECHO Building %SOLUTIONS.1% as it is the only solution that was found ... 28 GOTO :config_selection 29 ) 30 31 ECHO Found the following solutions: 32 FOR /F "tokens=2* delims=.=" %%A IN ('SET SOLUTIONS.') DO ECHO %%A = %%B 33 ECHO. 34 SET /P SOLUTIONINDEX=Which solution to build? Type the number: 35 36 SET SELECTED="" 37 FOR /F "tokens=2* delims=.=" %%A IN ('SET SOLUTIONS.') DO ( 38 IF "%%A"=="%SOLUTIONINDEX%" SET SELECTED=%%B 39 ) 40 41 IF %SELECTED%=="" GOTO :eof 42 43 :config_selection 44 IF "%~2"=="" GOTO :prompt_config 45 46 SET CONFIGURATION=%~2 47 ECHO Building configuration %CONFIGURATION% ... 48 GOTO :platform_selection 49 50 :prompt_config 51 SET /P CONFIGURATION=Which configuration to build [Release]: 52 IF "%CONFIGURATION%"=="" SET CONFIGURATION=Release 53 54 :platform_selection 55 IF "%~3"=="" GOTO :prompt_platform 56 57 SET PLATFORM=%~3 58 ECHO Building platform %PLATFORM% ... 59 GOTO :clean 60 61 :prompt_platform 62 SET /P PLATFORM=Which platform to build [Any CPU]: 63 IF "%PLATFORM%"=="" SET PLATFORM=Any CPU 64 65 :clean 66 IF "%~4"=="" GOTO :prompt_clean 67 68 SET CLEANBEFOREBUILD=%~4 69 GOTO :main 70 71 :prompt_clean 72 SET /P CLEANBEFOREBUILD=Would you like to clean before building [n]: 73 IF "%CLEANBEFOREBUILD%"=="" SET CLEANBEFOREBUILD=n 74 75 :main 76 REM First find the path to the msbuild.exe by performing a registry query 77 FOR /F "tokens=1,3 delims= " %%A IN ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0"') DO ( 78 IF "%%A"=="MSBuildToolsPath" SET MSBUILDPATH=%%B) 79 80 REM Then execute msbuild to clean and build the solution 81 REM Disable that msbuild creates a cache file of the solution 82 SET MSBuildUseNoSolutionCache=1 83 REM Run msbuild to clean and then build 84 IF "%CLEANBEFOREBUILD%" NEQ "n" ( 85 ECHO Cleaning ... 86 %MSBUILDPATH%msbuild.exe %SELECTED% /target:Clean /p:Configuration="%CONFIGURATION%",Platform="%PLATFORM%" /m:2 /nologo /verbosity:q /clp:ErrorsOnly 87 ) 88 ECHO Building ... 89 %MSBUILDPATH%msbuild.exe %SELECTED% /target:Build /p:Configuration="%CONFIGURATION%",Platform="%PLATFORM%" /m:2 /nologo /verbosity:q /clp:ErrorsOnly 90 91 ECHO. 92 ECHO DONE. 93 94 :end 95 96 PAUSE 97 98 GOTO :eof 99 100 REM This workaround is necessary so that COUNT gets reevaluated 101 :forloopbody 102 SET /A COUNT+=1 103 SET SOLUTIONS.%COUNT%=%1 104 GOTO :eof 2 powershell.exe .\Build.ps1 -
stable/Build.ps1
r16221 r16754 19 19 } 20 20 21 if ($msBuildPath -eq $undefined) { 22 "Could not locate MSBuild, ABORTING ..." 23 } else { 21 Try { 22 If ($msBuildPath -eq $undefined) { 23 "Could not locate MSBuild, ABORTING ..." 24 Return 25 } 26 24 27 $curPath = $MyInvocation.MyCommand.Path 25 28 $curDir = Split-Path $curPath … … 27 30 $slnFiles = Get-ChildItem $curDir -Filter *.sln 28 31 29 "Found the following solutions:" 32 If ($slnFiles.Count -le 0) { 33 "No solutions found, ABORTING ..." 34 Return 35 } 30 36 31 ""37 $slnIndices = @() 32 38 33 $slnFiles | % { $i = 0 } { (" {0}. `"{1}`"" -f ($i + 1), $_.Name); $i++ } 39 If ($slnFiles.Count -eq 1) { 40 "Selecting the only solution found: `"{0}`"" -f $slnFiles[0].Name 41 $slnIndices += 0 42 } Else { 43 "Found the following solutions:" 34 44 35 ""45 "" 36 46 37 $success = $false47 $slnFiles | % { $i = 0 } { (" {0}. `"{1}`"" -f ($i + 1), $_.Name); $i++ } 38 48 39 # query solution to build 40 $slnIndex = -1 41 $slnIndices = @() 42 Do { 43 $input = Read-Host "Which solution(s) to build? {1..$($slnFiles.Count)}" 44 $inputParts = $input -Split " " 49 "" 45 50 46 Foreach ($part in $inputParts) { 47 If ($part -eq "") { Continue } 51 $success = $false 48 52 49 $success = [int]::TryParse($part, [ref]$slnIndex) -and ($slnIndex -gt 0) -and ($slnIndex -le $slnFiles.Count) 53 # query solution to build 54 $slnIndex = -1 55 Do { 56 $input = Read-Host "Which solution(s) to build? (e.g.: 1 2 3) { 1..$($slnFiles.Count) }" 57 $inputParts = $input -Split " " 50 58 51 If ($success) { 52 $slnIndices += $slnIndex - 1 53 } Else { 54 $slnIndices = @() 55 Break 59 Foreach ($part in $inputParts) { 60 If ($part -eq "") { Continue } 61 62 $success = [int]::TryParse($part, [ref]$slnIndex) -and ($slnIndex -gt 0) -and ($slnIndex -le $slnFiles.Count) 63 64 If ($success) { 65 $slnIndices += $slnIndex - 1 66 } Else { 67 $slnIndices = @() 68 Break 69 } 56 70 } 57 } 58 } While (-Not $success) 71 } While (-Not $success) 59 72 60 $slnIndices = $slnIndices | Select-Object -Unique 73 $slnIndices = $slnIndices | Select-Object -Unique 74 } 75 61 76 62 77 # query configuration to build … … 80 95 "" 81 96 82 if ($clean) {97 If ($clean) { 83 98 Foreach ($slnIndex in $slnIndices) { 84 99 $solution = $slnFiles[$slnIndex] … … 87 102 $solution.FullName, 88 103 "/t:Clean", 89 "/p:Configuration=`"$config`",Platform=`"$ ([uri]::EscapeDataString($platform))`"",104 "/p:Configuration=`"$config`",Platform=`"$platform`"", 90 105 "/m", "/nologo", "/verbosity:q", "/clp:ErrorsOnly" 91 106 ) … … 97 112 Foreach ($slnIndex in $slnIndices) { 98 113 $solution = $slnFiles[$slnIndex] 99 "Building `"$($solution.Name)`" ..."114 "Building `"$($solution.Name)`" ($config|$platform) ..." 100 115 $args = @( 101 116 $solution.FullName, 102 "/t: Build",103 "/p:Configuration=`"$config`",Platform=`"$ ([uri]::EscapeDataString($platform))`"",117 "/t:Restore,Build", 118 "/p:Configuration=`"$config`",Platform=`"$platform`"", 104 119 "/m", "/nologo", "/verbosity:q", "/clp:ErrorsOnly" 105 120 ) … … 107 122 "===== BUILD FINISHED =====" 108 123 } 124 } Finally { 125 "" 126 127 Write-Host -NoNewline "Press any key to continue ... " 128 129 [void][System.Console]::ReadKey($true) 109 130 } 110 111 ""112 113 Write-Host -NoNewline "Press any key to continue ... "114 [void][System.Console]::ReadKey($true)
Note: See TracChangeset
for help on using the changeset viewer.