anchor.diff:  @echo off
   setlocal enableextensions enabledelayedexpansion
   
  -REM **************************************************************************
  -REM Build Windows docker image containing tools to build RStudio IDE
  -REM **************************************************************************
  -REM Currently this goes as far as creating an image, but doesn't 
  -REM run the build itself. See TODO's at end of this file.
  -REM **************************************************************************
  -REM Build this image and run the build using it on Windows Server 2016,
  -REM where Docker can be run in process-isolation mode. Building RStudio in
  -REM a container using Hyper-V will not work due to:
  -REM     https://github.com/docker/for-win/issues/829
  -REM **************************************************************************
  +:: Script to build RStudio Desktop for Windows using Docker
  +:: 
  +:: Requires a Windows machine, with Docker installed and set to use Windows
  +:: containers, and the RStudio repo cloned onto the machine. Then simply execute
  +:: this script from a command prompt in rstudio\docker directory.
  +::
  +:: For best reproduction of an official build use a pristine repo containing no 
  +:: previous local builds or installed dependencies. For example you could use
  +:: git clean -ffdx.
  +::
  +:: Reason: The entire repo is copied into the container on each run (see comment
  +:: later in this script on why this is).
   
   set IMAGE=windows
   set FLAVOR=desktop
  
positive.code: set BUILD_ID=local
  
  REM infer make parallelism
  set "MAKEFLAGS=-j%NUMBER_OF_PROCESSORS%
  
  REM remove previous image if it exists
  set CONTAINER_ID=build-%REPO%-%IMAGE%
  echo Cleaning up container %CONTAINER_ID% if it exists...
  docker rm %CONTAINER_ID%
  
  REM Startup the container. To build, run "install-dependencies.cmd" then "make-package" inside 
  REM it as you would on a Windows dev box.
  for %%A in ("%cd%") do set HOSTPATH=%%~sA
  docker run -it --isolation process --name %CONTAINER_ID% -v %HOSTPATH%:c:/src %REPO%:%IMAGE%
  
  REM extract logs to get filename (should be on the last line)
  REM TODO
  REM PKG_FILENAME=$(docker logs --tail 1 "$CONTAINER_ID")
  
  REM report name of produced package
  REM TODO
  
  REM stop the container
  REM TODO
  REM docker stop %CONTAINER_ID%
  REM echo Container image saved in %CONTAINER_ID%.
  
  
  
negative.code: REM rebuild the image if necessary
  docker build --tag %REPO%:%IMAGE% --file docker\jenkins\Dockerfile.%IMAGE% %BUILD_ARGS% -m 2GB .\docker\jenkins
  
  REM set up build flags
  git rev-parse HEAD > %TEMPFILE%
  set /p GIT_COMMIT= < %TEMPFILE%
  