aboutsummaryrefslogtreecommitdiff
path: root/build-msvc.bat
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-10-19 11:06:26 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-10-19 11:14:01 +0200
commit3712018cdfca06dbdf58514d6f238922c11ac8de (patch)
tree6422d7a7eacac77e83d7a5c3cb0ca2445b3eb5d3 /build-msvc.bat
parent1558209fdb2fe5fc33293c2510483cfbc5154ad3 (diff)
Implement network timeout option (--timeout) in build script/batch files
Diffstat (limited to 'build-msvc.bat')
-rw-r--r--build-msvc.bat37
1 files changed, 32 insertions, 5 deletions
diff --git a/build-msvc.bat b/build-msvc.bat
index e129ede..477950d 100644
--- a/build-msvc.bat
+++ b/build-msvc.bat
@@ -9,7 +9,9 @@ goto start
:usage
echo.
-echo Usage: %0 [/?] [^<install-dir^>] [^<trust^>]
+echo Usage: %0 [/?] [^<options^>] [^<install-dir^>] [^<trust^>]
+echo Options:
+echo --timeout ^<sec^> Network operations timeout in seconds.
echo.
echo By default the batch file will install into C:\build2. It also expects
echo to find the base utilities in the bin\ subdirectory of the installation
@@ -31,8 +33,6 @@ goto end
set "owd=%CD%"
-if "_%1_" == "_/?_" goto usage
-
rem Package repository URL (or path).
rem
if "_%BUILD2_REPO%_" == "__" (
@@ -46,6 +46,33 @@ rem
set "cver=0.7-a.0"
set "cdir=build2-toolchain-%cver%"
+rem Parse options.
+rem
+set "timeout="
+
+:options
+if "_%~1_" == "_/?_" goto usage
+if "_%~1_" == "_-h_" goto usage
+if "_%~1_" == "_--help_" goto usage
+
+if "_%~1_" == "_--timeout_" (
+ if "_%~2_" == "__" (
+ echo error: value in seconds expected after --timeout
+ goto error
+ )
+ set "timeout=%~2"
+ shift
+ shift
+ goto options
+)
+if "_%~1_" == "_--_" shift
+
+rem Validate options and arguments.
+rem
+if not "_%timeout%_" == "__" (
+ set "timeout=--fetch-timeout %timeout%"
+)
+
rem Installation directory.
rem
if "_%1_" == "__" (
@@ -167,10 +194,10 @@ bpkg-stage create^
bpkg-stage add %BUILD2_REPO%
@if errorlevel 1 goto error
-bpkg-stage fetch %trust%
+bpkg-stage fetch %timeout% %trust%
@if errorlevel 1 goto error
-bpkg-stage build --yes build2 bpkg
+bpkg-stage build %timeout% --yes build2 bpkg
@if errorlevel 1 goto error
bpkg-stage install build2 bpkg