4 : Check which branch we are on, or just assume master if we are not in a git repository
5 for /f %%z in ('git rev-parse --abbrev-ref HEAD') do set GIT_BRANCH=%%z
6 if not defined GIT_BRANCH (
13 set _bootimage_version=%GIT_BRANCH%
14 ) else if "%1"=="latest" (
15 set _bootimage_version=%GIT_BRANCH%
16 ) else if "%1"=="update" (
17 set _bootimage_version=%GIT_BRANCH%
18 ) else if "%1"=="clean" (
19 set _bootimage_version=clean
22 if not exist Nmakefile goto wrongdir
24 call cl 2>&1 | find "x86" >nul
26 echo x86-32 cl.exe detected.
28 set _bootimage=boot.windows-x86.32.image
30 call cl 2>&1 | find "x64" >nul
32 echo x86-64 cl.exe detected.
34 set _bootimage=boot.windows-x86.64.image
38 echo Deleting staging images from temp/...
39 del temp\staging.*.image
41 echo Updating working copy from %GIT_BRANCH%...
42 call git pull https://github.com/factor/factor %GIT_BRANCH%
43 if errorlevel 1 goto fail
46 nmake /nologo /f Nmakefile clean
47 if errorlevel 1 goto fail
49 nmake /nologo /f Nmakefile %_target%
50 if errorlevel 1 goto fail
52 echo Fetching %_bootimage_version% boot image...
53 set boot_image_url=http://downloads.factorcode.org/images/%GIT_BRANCH%/%_bootimage% %_bootimage%
54 echo URL: %boot_image_url%
55 cscript /nologo misc\http-get.vbs %boot_image_url% %_bootimage%
56 if errorlevel 1 goto fail
59 .\factor.com -i=%_bootimage%
60 if errorlevel 1 goto fail
62 echo Copying fresh factor.image to factor.image.fresh.
63 copy factor.image factor.image.fresh
64 if errorlevel 1 goto fail
74 echo build.cmd must be run from the root of the Factor source tree.
78 echo Unable to detect cl.exe target platform.
79 echo Make sure you're running within the Visual Studio or Windows SDK environment.
84 echo Updates the working copy, cleans and builds the vm using nmake,
85 echo fetches a boot image, and bootstraps factor.
86 echo The branch that bootstraps is the one that is checked out locally.