Skip to content

Commit 6c5da58

Browse files
committed
[MERGE chakra-core#716] Change GenByteCode.cmd to allow generating bytecodes from alternately-named binaries in different locations.
Merge pull request chakra-core#716 from dilijev:regen
2 parents d287c1f + 869b8fa commit 6c5da58

1 file changed

Lines changed: 43 additions & 15 deletions

File tree

lib/Runtime/Library/InJavascript/GenByteCode.cmd

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,58 @@
66
@echo off
77
setlocal
88
set _HASERROR=0
9+
set _binary=ch.exe
910

10-
if "%1"=="-nojit" (
11-
set _suffix=.nojit
12-
shift
11+
if "%_FILE%" == "" (
12+
set "_FILE=%~dp0*.js"
1313
)
1414

15-
:: This script will expect ch.exe to be built for x86_debug and x64_debug
16-
set _BinLocation=%~dp0..\..\..\..\Build\VcBuild%_suffix%\bin
17-
if "%OutBaseDir%" NEQ "" (
18-
set _BinLocation=%OutBaseDir%\Chakra.Core%_suffix%\bin
15+
:ContinueArgParse
16+
if not [%1]==[] (
17+
if [%1]==[-nojit] (
18+
set _suffix=.nojit
19+
goto :ContinueArgParseEnd
20+
)
21+
if [%1]==[-binary] (
22+
if [%2]==[] (
23+
echo Error: no argument supplied to -binary. Exiting ...
24+
exit /b 1
25+
)
26+
set _binary=%2
27+
shift
28+
goto :ContinueArgParseEnd
29+
)
30+
if [%1]==[-bindir] (
31+
if [%2]==[] (
32+
echo Error: no argument supplied to -bindir. Exiting ...
33+
exit /b 1
34+
)
35+
set _BinLocation=%2
36+
shift
37+
goto :ContinueArgParseEnd
38+
)
39+
40+
:ContinueArgParseEnd
41+
shift
42+
goto :ContinueArgParse
1943
)
2044

21-
if not exist %_BinLocation%\x86_debug\ch.exe (
22-
echo Error: %_BinLocation%\x86_debug\ch.exe not found, please build sources. Exiting ...
23-
exit /b 1
45+
:: This script will expect %_binary% to be built for x86_debug and x64_debug
46+
47+
if "%_BinLocation%"=="" (
48+
set _BinLocation=%~dp0..\..\..\..\Build\VcBuild%_suffix%\bin
49+
) else if "%OutBaseDir%" NEQ "" (
50+
set _BinLocation=%OutBaseDir%\Chakra.Core%_suffix%\bin
2451
)
2552

26-
if not exist %_BinLocation%\x64_debug\ch.exe (
27-
echo Error: %_BinLocation%\x64_debug\ch.exe not found, please build sources. Exiting ...
53+
if not exist %_BinLocation%\x86_debug\%_binary% (
54+
echo Error: %_BinLocation%\x86_debug\%_binary% not found, please build sources. Exiting ...
2855
exit /b 1
2956
)
3057

31-
if "%_FILE%" == "" (
32-
set "_FILE=%~dp0*.js"
58+
if not exist %_BinLocation%\x64_debug\%_binary% (
59+
echo Error: %_BinLocation%\x64_debug\%_binary% not found, please build sources. Exiting ...
60+
exit /b 1
3361
)
3462

3563
for %%i in (%_FILE%) do (
@@ -46,7 +74,7 @@ call :Generate %1 %_BinLocation%\x64_debug %1%_suffix%.bc.64b.h
4674
exit /B 0
4775

4876
:Generate
49-
%2\ch.exe -GenerateLibraryByteCodeHeader:%3 -Intl %1
77+
%2\%_binary% -GenerateLibraryByteCodeHeader:%3 -Intl %1
5078
if "%errorlevel%" NEQ "0" (
5179
echo %1: Error generating bytecode file. Ensure %3 writable.
5280
set _HASERROR=1

0 commit comments

Comments
 (0)