Revert "lists: Add list literal doc example."
[factor.git] / build.cmd
blob6d964ec6604f12dc2dbff9265bd739f7a813c94a
1 @echo off
2 setlocal
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 (
7 set GIT_BRANCH=master
10 if "%1"=="/?" (
11 goto usage
12 ) else if "%1"=="" (
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
20 ) else goto usage
22 if not exist Nmakefile goto wrongdir
24 call cl 2>&1 | find "x86" >nul
25 if not errorlevel 1 (
26 echo x86-32 cl.exe detected.
27 set _target=x86-32
28 set _bootimage=boot.windows-x86.32.image
29 ) else (
30 call cl 2>&1 | find "x64" >nul
31 if not errorlevel 1 (
32 echo x86-64 cl.exe detected.
33 set _target=x86-64
34 set _bootimage=boot.windows-x86.64.image
35 ) else goto nocl
38 echo Deleting staging images from temp/...
39 del temp\staging.*.image
41 echo Updating working copy from %GIT_BRANCH%...
42 call git pull git://factorcode.org/git/factor.git %GIT_BRANCH%
43 if errorlevel 1 goto fail
45 echo Building vm...
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
58 echo Bootstrapping...
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
66 echo Build complete.
67 goto :EOF
69 :fail
70 echo Build failed.
71 goto :EOF
73 :wrongdir
74 echo build.cmd must be run from the root of the Factor source tree.
75 goto :EOF
77 :nocl
78 echo Unable to detect cl.exe target platform.
79 echo Make sure you're running within the Visual Studio or Windows SDK environment.
80 goto :EOF
82 :usage
83 echo Usage: build.cmd
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.
87 goto :EOF