forked from ponylang/pony-stable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.bat
57 lines (47 loc) · 1.22 KB
/
make.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
@echo off
if "%1"=="--help" goto help
if "%1"=="help" goto help
set GOTOCLEAN=false
if "%1"=="clean" (
set GOTOCLEAN=true
shift
)
set CONFIG=release
set DEBUG=
if "%1"=="config" (
if "%2"=="debug" (
set CONFIG=debug
set DEBUG=--debug
)
)
set BUILDDIR=build\%CONFIG%
if "%GOTOCLEAN%"=="true" goto clean
where ponyc > nul
if errorlevel 1 goto noponyc
:build
if not exist "%BUILDDIR%" mkdir "%BUILDDIR%""
echo Compiling: ponyc stable -o %BUILDDIR% %DEBUG%
set /p VERSION=<VERSION
if exist ".git" for /f %%i in ('git rev-parse --short HEAD') do set "VERSION=%VERSION%-%%i [%CONFIG%]"
if not exist ".git" set "VERSION=%VERSION% [%CONFIG%]"
setlocal enableextensions disabledelayedexpansion
for /f "delims=" %%i in ('type stable\version.pony.in ^& break ^> stable\version.pony') do (
set "line=%%i"
setlocal enabledelayedexpansion
>>stable\version.pony echo(!line:%%%%VERSION%%%%=%VERSION%!
endlocal
)
ponyc stable -o %BUILDDIR% %DEBUG%
goto done
:clean
if not exist "%BUILDDIR%" goto done
echo Removing "%BUILDDIR%"
rmdir /s /q "%BUILDDIR%"
goto done
:help
echo usage: make.bat [clean] [config=release|debug]
goto done
:noponyc
echo You need "ponyc.exe" (from https://github.com/ponylang/ponyc) in your PATH.
goto done
:done