forked from pharo-project/pharo5-vm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.cmd
62 lines (54 loc) · 1.8 KB
/
setup.cmd
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
::##############################################################################
:: written by Max Leske
:: 2015-07-20
::##############################################################################
@ECHO off
setlocal enabledelayedexpansion
:: if this script is being run from the cloned repository we need to do
:: things a little different
set scriptDirectory=%~dp0
cd | findstr /C:"pharo-vm" > nul
if %errorlevel% equ 0 (
call:cdToBuildDirectory
set buildDirectory=cd
) else (
:: create build directory
set buildDirectory=%cd%\vm-build
echo !buildDirectory!
if not exist !buildDirectory! mkdir vm-build
cd !buildDirectory!
)
set pharoDirectory=%buildDirectory%\pharo-vm
set log=%buildDirectory%\build-setup.log
:: clone repository, set windows specific configuration and checkout
if not exist %pharoDirectory% (
git clone --depth=1 --no-checkout https://github.com/pharo-project/pharo-vm.git
cd pharo-vm
git config --add core.text auto
git checkout -f HEAD
cd %buildDirectory%
)
:: setup build environment (no bash yet)
echo Setting up build environment...
cscript.exe /Nologo %pharoDirectory%\scripts\windows\init-environment.js %buildDirectory%
:: PATH may have been modified. If so, update it
:: only set the path in the process environment, not globally
if exist %buildDirectory%\newpath (
for /f "tokens=*" %%i IN (%buildDirectory%\newpath) DO set PATH=%%i
del %buildDirectory%\newpath
)
:: do the rest in bash
echo Starting build...
bash.exe %pharoDirectory%\scripts\windows\start-build.sh %buildDirectory% > %log% 2>&1
echo Done.
:: cd back to original directory
cd %scriptDirectory%
goto :eof
:: functions
:cdToBuildDirectory
rem if pharo-vm is on the path, cd to its parent directory
cd | findstr /C:"pharo-vm" > nul
if %errorlevel% equ 0 (
cd ..
goto :cdToBuildDirectory
)