This repository has been archived by the owner on Sep 2, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
make.bat
executable file
·88 lines (73 loc) · 1.83 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
@echo off
set TARGET={PACKAGE}
if "%1"=="help" goto usage
if "%1"=="--help" goto usage
where stable > nul
if errorlevel 1 goto nostable
where ponyc > nul
if errorlevel 1 goto noponyc
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
)
shift
shift
)
set BUILDDIR=build\%CONFIG%
if "%GOTOCLEAN%"=="true" goto clean
if "%1"=="test" goto test
if "%1"=="fetch" goto fetch
:build
if not exist "%BUILDDIR%" mkdir "%BUILDDIR%""
if not exist "VERSION" goto noversion
if not exist %TARGET%\version.pony.in goto noversion
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 %TARGET%\version.pony.in ^& break ^> %TARGET%\version.pony') do (
set "line=%%i"
setlocal enabledelayedexpansion
>>%TARGET%\version.pony echo(!line:%%%%VERSION%%%%=%VERSION%!
endlocal
)
:noversion
stable env ponyc %DEBUG% -o %BUILDDIR% %TARGET%
if errorlevel 1 goto error
goto done
:fetch
stable fetch
if errorlevel 1 goto error
goto done
:test
if not exist %BUILDDIR%\%TARGET%.exe (
stable fetch
stable env ponyc %DEBUG% -o %BUILDDIR% %TARGET%
)
if errorlevel 1 goto error
%BUILDDIR%\%TARGET%.exe --sequential
if errorlevel 1 goto error
goto done
:clean
if exist %BUILDDIR% rmdir /s /q %BUILDDIR%
goto done
:usage
echo Usage: make (help^|clean^|build^|test) [config=debug^|release]
goto done
:nostable
echo You need "stable.exe" (from https://github.com/ponylang/pony-stable) in your PATH.
goto error
:noponyc
echo You need "ponyc.exe" (from https://github.com/ponylang/ponyc) in your PATH.
goto error
:error
%COMSPEC% /c exit 1
:done