build: Add no-sync to update_ext_srcs batch file

Complete support for cygwin environment by adding --no-sync support
to update_external_sources.bat. Also change command line parsing for
the the .bat script to be similar to the .sh script.

Change-Id: Ie813938654e7f4bb9575eef2587f36ca2933f30c
diff --git a/BUILD.md b/BUILD.md
index d88eb9a..ae13fa9 100644
--- a/BUILD.md
+++ b/BUILD.md
@@ -212,7 +212,7 @@
 Build all Windows targets after installing required software and cloning the Loader and Validation Layer repo as described above by completing the following steps in a "Developer Command Prompt for VS2013" window (Note that the update\_external\_sources script used below builds external tools into predefined locations. See **Loader and Validation Layer Dependencies** for more information and other options):
 ```
 cd Vulkan-LoaderAndValidationLayers  # cd to the root of the cloned git repository
-update_external_sources.bat --all
+update_external_sources.bat
 build_windows_targets.bat
 ```
 
@@ -225,14 +225,19 @@
 This specification describes both how ICDs and layers should be properly
 packaged, and how developers can point to ICDs and layers within their builds.
 
-### Cygwin
+### Using Cygwin Git
 
-If you are using Cygwin git instead of win32-native git, you can use Cygwin's git to sync external sources:
+If you are using Cygwin git instead of win32-native git, you can use the *sh* script to sync using Cygwin's git (but not also build), then use the *bat* script to build (but not also sync).
+
+In a cygwin shell do this:
 ```
 ./update_external_sources.sh --no-build
 ```
 
-Unfortunately, "update\_external\_sources.bat" does not have a --no-sync option. To build the external sources you have to modify "update\_external\_sources.bat" to skip the sync portions of the script.
+Then in a Visual Studio Developer Command Prompt shell do this:
+```
+update_external_sources.bat --no-sync
+```
 
 ## Android Build
 Install the required tools for Linux and Windows covered above, then add the following.
diff --git a/update_external_sources.bat b/update_external_sources.bat
index c0b41a2..739ce53 100644
--- a/update_external_sources.bat
+++ b/update_external_sources.bat
@@ -20,16 +20,94 @@
 
 REM // ======== Parameter parsing ======== //
 
-   if "%1" == "" (
+   set arg-use-implicit-component-list=1
+   set arg-do-glslang=0
+   set arg-do-spirv-tools=0
+   set arg-no-sync=0
+   set arg-no-build=0
+
+   :parameterLoop
+
+      if "%1"=="" goto:parameterContinue
+
+      if "%1" == "--glslang" (
+         set arg-do-glslang=1
+         set arg-use-implicit-component-list=0
+         echo Building glslang ^(%1^)
+         shift
+         goto:parameterLoop
+      )
+
+      if "%1" == "-g" (
+         set arg-do-glslang=1
+         set arg-use-implicit-component-list=0
+         echo Building glslang ^(%1^)
+         shift
+         goto:parameterLoop
+      )
+
+      if "%1" == "--spirv-tools" (
+         set arg-do-spirv-tools=1
+         set arg-use-implicit-component-list=0
+         echo Building spirv-tools ^(%1^)
+         shift
+         goto:parameterLoop
+      )
+
+      if "%1" == "-s" (
+         set arg-do-spirv-tools=1
+         set arg-use-implicit-component-list=0
+         echo Building spirv-tools ^(%1^)
+         shift
+         goto:parameterLoop
+      )
+
+      if "%1" == "--all" (
+         set arg-do-glslang=1
+         set arg-do-spirv-tools=1
+         set arg-use-implicit-component-list=0
+         echo Building glslang, spirv-tools ^(%1^)
+         shift
+         goto:parameterLoop
+      )
+
+      if "%1" == "--no-sync" (
+         set arg-no-sync=1
+         echo Skipping sync ^(%1^)
+         shift
+         goto:parameterLoop
+      )
+
+      if "%1" == "--no-build" (
+         set arg-no-build=1
+         echo Skipping build ^(%1^)
+         shift
+         goto:parameterLoop
+      )
+
+      echo.
+      echo Unrecognized option "%1"
+      echo.
       echo usage: update_external_sources.bat [options]
       echo.
-      echo Available options:
-      echo   --sync-glslang      just pull glslang_revision
-      echo   --sync-spirv-tools  just pull spirv-tools_revision
-      echo   --build-glslang     pulls glslang_revision, configures CMake, builds Release and Debug
-      echo   --build-spirv-tools pulls spirv-tools_revision, configures CMake, builds Release and Debug
-      echo   --all               sync and build glslang, spirv-tools
-      goto:finish
+      echo   Available options:
+      echo     -g ^| --glslang      enable glslang component
+      echo     -s ^| --spirv-tools  enable spirv-tools component
+      echo     --all               enable all components
+      echo     --no-sync           skip sync from git
+      echo     --no-build          skip build
+      echo.
+      echo   Sync uses git to pull a specific revision.
+      echo   Build configures CMake, builds Release and Debug.
+
+      goto:error
+
+   :parameterContinue
+
+   if %arg-use-implicit-component-list% equ 1 (
+      echo Building glslang, spirv-tools
+      set arg-do-glslang=1
+      set arg-do-spirv-tools=1
    )
 
    set sync-glslang=0
@@ -38,53 +116,37 @@
    set build-spirv-tools=0
    set check-glslang-build-dependencies=0
 
-   :parameterLoop
-
-      if "%1"=="" goto:parameterContinue
-
-      if "%1" == "--sync-glslang" (
+   if %arg-do-glslang% equ 1 (
+      if %arg-no-sync% equ 0 (
          set sync-glslang=1
-         shift
-         goto:parameterLoop
       )
-
-      if "%1" == "--sync-spirv-tools" (
-         set sync-spirv-tools=1
-         shift
-         goto:parameterLoop
-      )
-
-      if "%1" == "--build-glslang" (
-         set sync-glslang=1
+      if %arg-no-build% equ 0 (
          set check-glslang-build-dependencies=1
          set build-glslang=1
-         shift
-         goto:parameterLoop
       )
+   )
 
-      if "%1" == "--build-spirv-tools" (
+   if %arg-do-spirv-tools% equ 1 (
+      if %arg-no-sync% equ 0 (
          set sync-spirv-tools=1
-         REM glslang has the same needs as spirv-tools
+      )
+      if %arg-no-build% equ 0 (
+         REM glslang has the same dependencies as spirv-tools
          set check-glslang-build-dependencies=1
          set build-spirv-tools=1
-         shift
-         goto:parameterLoop
       )
+   )
 
-      if "%1" == "--all" (
-         set sync-glslang=1
-         set sync-spirv-tools=1
-         set build-glslang=1
-         set build-spirv-tools=1
-         set check-glslang-build-dependencies=1
-         shift
-         goto:parameterLoop
-      )
-
-      echo Unrecognized options "%1"
+   REM this is a debugging aid that can be enabled while debugging command-line parsing
+   if 0 equ 1 (
+      set arg
+      set sync-glslang
+      set sync-spirv-tools
+      set build-glslang
+      set build-spirv-tools
+      set check-glslang-build-dependencies
       goto:error
-
-   :parameterContinue
+   )
 
 REM // ======== end Parameter parsing ======== //