@echo off
set ORIGINAL_WORKING_DIRECTORY=%cd%
set PROJECT_ROOT=%cd%
set BUCK_BIN_DIRECTORY=%~dp0
cd %BUCK_BIN_DIRECTORY%\..
set BUCK_DIRECTORY=%cd%

set BUCKD_DIR=%PROJECT_ROOT%\.buckd
set BUCKD_LOG_FILE=%PROJECT_ROOT%\buckd.log
set BUCKD_PID_FILE=%PROJECT_ROOT%\buckd.pid
set BUCKD_PORT_FILE=%PROJECT_ROOT%\buckd.port
set BUCKD_RUNNING=0
rem kill -0 `cat "$BUCKD_PID_FILE" 2> /dev/null` &> /dev/null || BUCKD_RUNNING=1

if not exist %PROJECT_ROOT%\.buckversion goto SET_BUCK_REQUIRED_VERSION_END
  if exist %PROJECT_ROOT%\.nobuckcheck goto SET_BUCK_REQUIRED_VERSION_END
  set /p BUCK_REQUIRED_VERSION=<%PROJECT_ROOT%\.buckversion
  rem TODO checkout the required version
:SET_BUCK_REQUIRED_VERSION_END

set BUCK_REPOSITORY_DIRTY=0
set BUCK_CURRENT_VERSION=N/A
set BUCK_VERSION_TIMESTAMP=-1
if not exist .git goto GET_BUCK_VERSION_END
  git rev-parse HEAD >%TEMP%\BUCK_CURRENT_VERSION
  set /p BUCK_CURRENT_VERSION=<%TEMP%\BUCK_CURRENT_VERSION
  git log --pretty=format:%%ct -1 HEAD >%TEMP%\BUCK_VERSION_TIMESTAMP
  set /p BUCK_VERSION_TIMESTAMP=<%TEMP%\BUCK_VERSION_TIMESTAMP
:GET_BUCK_VERSION_END

set BUCK_VERSION_UID=N/A

set DEFAULT_PYTHON_INTERP=python
set PYTHON_INTERP=%DEFAULT_PYTHON_INTERP%

set RELATIVE_PATH_TO_BUCK_PY=src/com/facebook/buck/parser/buck.py
set PATH_TO_BUCK_PY=%BUCK_DIRECTORY%\%RELATIVE_PATH_TO_BUCK_PY%

set BUCK_JAVA_ARGS=^
-XX:MaxPermSize=256m ^
-Xmx1000m ^
-Djava.awt.headless=true ^
-Dbuck.testrunner_classes=%BUCK_DIRECTORY%\build\testrunner\classes ^
-Dbuck.abi_processor_classes=%BUCK_DIRECTORY%\build\abi_processor\classes ^
-Dbuck.path_to_emma_jar=%BUCK_DIRECTORY%\third-party\java\emma-2.0.5312\out\emma-2.0.5312.jar ^
-Dbuck.test_util_no_tests_dir=true ^
-Dbuck.path_to_python_interp=%PYTHON_INTERP% ^
-Dbuck.path_to_buck_py=%PATH_TO_BUCK_PY% ^
-Dbuck.path_to_intellij_py=%BUCK_DIRECTORY%\src\com\facebook\buck\command\intellij.py ^
-Dbuck.git_commit=%BUCK_CURRENT_VERSION% ^
-Dbuck.git_commit_timestamp=%BUCK_VERSION_TIMESTAMP% ^
-Dbuck.git_dirty=%BUCK_REPOSITORY_DIRTY% ^
-Dbuck.version_uid=%BUCK_VERSION_UID% ^
-Dbuck.buckd_dir=%BUCKD_DIR% ^
-Dlog4j.configuration=file:%BUCK_DIRECTORY%\config\log4j.properties

set BUCK_JAVA_CLASSPATH=^
%BUCK_DIRECTORY%\src;^
%BUCK_DIRECTORY%\build\classes;^
%BUCK_DIRECTORY%\lib\args4j.jar;^
%BUCK_DIRECTORY%\lib\guava-14.0.1.jar;^
%BUCK_DIRECTORY%\lib\ini4j-0.5.2.jar;^
%BUCK_DIRECTORY%\lib\jackson-annotations-2.0.5.jar;^
%BUCK_DIRECTORY%\lib\jackson-core-2.0.5.jar;^
%BUCK_DIRECTORY%\lib\jackson-databind-2.0.5.jar;^
%BUCK_DIRECTORY%\lib\jsr305.jar;^
%BUCK_DIRECTORY%\lib\sdklib.jar;^
%BUCK_DIRECTORY%\lib\ddmlib-r21.jar;^
%BUCK_DIRECTORY%\lib\sdklib.jar;^
%BUCK_DIRECTORY%\third-party\java\astyanax\astyanax-cassandra-1.56.38.jar;^
%BUCK_DIRECTORY%\third-party\java\astyanax\astyanax-core-1.56.38.jar;^
%BUCK_DIRECTORY%\third-party\java\astyanax\astyanax-thrift-1.56.38.jar;^
%BUCK_DIRECTORY%\third-party\java\astyanax\cassandra-1.2.3.jar;^
%BUCK_DIRECTORY%\third-party\java\astyanax\cassandra-thrift-1.2.3.jar;^
%BUCK_DIRECTORY%\third-party\java\astyanax\commons-cli-1.1.jar;^
%BUCK_DIRECTORY%\third-party\java\astyanax\commons-codec-1.2.jar;^
%BUCK_DIRECTORY%\third-party\java\astyanax\commons-lang-2.6.jar;^
%BUCK_DIRECTORY%\third-party\java\astyanax\high-scale-lib-1.1.2.jar;^
%BUCK_DIRECTORY%\third-party\java\astyanax\joda-time-2.2.jar;^
%BUCK_DIRECTORY%\third-party\java\astyanax\libthrift-0.7.0.jar;^
%BUCK_DIRECTORY%\third-party\java\astyanax\log4j-1.2.16.jar;^
%BUCK_DIRECTORY%\third-party\java\astyanax\slf4j-api-1.7.2.jar;^
%BUCK_DIRECTORY%\third-party\java\astyanax\slf4j-log4j12-1.7.2.jar;^
%BUCK_DIRECTORY%\third-party\java\xz-java-1.3\xz-1.3.jar

java ^
  -classpath %BUCK_JAVA_CLASSPATH% ^
  %BUCK_JAVA_ARGS% ^
  -Dbuck.daemon=false ^
  com.facebook.buck.cli.Main ^
  %*

cd %ORIGINAL_WORKING_DIRECTORY%

Migrate buck and buck_common to Windows batch.

Summary: bin/buck is written in bash and not compatible with Windows.
In order to get it working, I translated the minimal part of bin/buck into bin/buck.cmd.

Test Plan: Run bin\buck.cmd -V on Windows.


@if "%DEBUG%" == "" @echo off
setlocal
Setlocal EnableDelayedExpansion

set SOURCE_DIR=%CD%
set ZLIB_ZIP=%CD%\cppbuild\zlib1211.zip
set BUILD_DIR=%CD%\cppbuild\Release
set ZLIB_BUILD_DIR=%BUILD_DIR%\zlib-build
set ZLIB_INSTALL_DIR=%BUILD_DIR%\zlib64

for %%o in (%*) do (

    set PROCESSED=0

    if "%%o"=="--help" (
	    echo cppbuild.cmd [--c-warnings-as-errors] [--cxx-warnings-as-errors] [--build-aeron-driver]
		exit /b
	)

	if "%%o"=="--c-warnings-as-errors" (
	    set EXTRA_CMAKE_ARGS=!EXTRA_CMAKE_ARGS! -DC_WARNINGS_AS_ERRORS=ON
		set PROCESSED=1
	)

    if "%%o"=="--cxx-warnings-as-errors" (
	    set EXTRA_CMAKE_ARGS=!EXTRA_CMAKE_ARGS! -DCXX_WARNINGS_AS_ERRORS=ON
		set PROCESSED=1
    )

    if "%%o"=="--build-aeron-driver" (
        set EXTRA_CMAKE_ARGS=!EXTRA_CMAKE_ARGS! -DBUILD_AERON_DRIVER=ON
	    set PROCESSED=1
	)
)

if EXIST %BUILD_DIR% rd /S /Q %BUILD_DIR%

md %BUILD_DIR%
pushd %BUILD_DIR%
md %ZLIB_BUILD_DIR%
pushd %ZLIB_BUILD_DIR%
7z x %ZLIB_ZIP%
pushd zlib-1.2.11
md build
pushd build

cmake -G "Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX=%ZLIB_INSTALL_DIR% ..
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

cmake --build . --target install
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

pushd %BUILD_DIR%
cmake -G "Visual Studio 16 2019" %EXTRA_CMAKE_ARGS% %SOURCE_DIR%
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

cmake --build . --config Release
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

ctest -C Release --output-on-failure
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

@if "%DEBUG%" == "" @echo off
setlocal
Setlocal EnableDelayedExpansion

set SOURCE_DIR=%CD%
set ZLIB_ZIP=%CD%\cppbuild\zlib1211.zip
set BUILD_DIR=%CD%\cppbuild\Release
set ZLIB_BUILD_DIR=%BUILD_DIR%\zlib-build
set ZLIB_INSTALL_DIR=%BUILD_DIR%\zlib64
set EXTRA_CMAKE_ARGS=-DAERON_SYSTEM_TESTS=OFF

for %%o in (%*) do (

    set PROCESSED=0

    if "%%o"=="--help" (
	    echo cppbuild.cmd [--c-warnings-as-errors] [--cxx-warnings-as-errors] [--build-aeron-driver]
		exit /b
	)

	if "%%o"=="--c-warnings-as-errors" (
	    set EXTRA_CMAKE_ARGS=!EXTRA_CMAKE_ARGS! -DC_WARNINGS_AS_ERRORS=ON
		set PROCESSED=1
	)

    if "%%o"=="--cxx-warnings-as-errors" (
	    set EXTRA_CMAKE_ARGS=!EXTRA_CMAKE_ARGS! -DCXX_WARNINGS_AS_ERRORS=ON
		set PROCESSED=1
    )

    if "%%o"=="--build-aeron-driver" (
        set EXTRA_CMAKE_ARGS=!EXTRA_CMAKE_ARGS! -DBUILD_AERON_DRIVER=ON
	    set PROCESSED=1
	)
)

if EXIST %BUILD_DIR% rd /S /Q %BUILD_DIR%

md %BUILD_DIR%
pushd %BUILD_DIR%
md %ZLIB_BUILD_DIR%
pushd %ZLIB_BUILD_DIR%
7z x %ZLIB_ZIP%
pushd zlib-1.2.11
md build
pushd build

cmake -G "Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX=%ZLIB_INSTALL_DIR% ..
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

cmake --build . --target install
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

pushd %BUILD_DIR%
cmake -G "Visual Studio 16 2019" %EXTRA_CMAKE_ARGS% %SOURCE_DIR%
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

cmake --build . --config Release
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

ctest -C Release --output-on-failure
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

Disable system tests for Windows build.

[C] Disable system tests for Windows build.


Fix start daemon script if there is already forever log files


%~d0
cd %~p0
chcp 65001
set _JAVA_OPTIONS="-Dfile.encoding=UTF-8"
pause
play debug run

Create mnc-batch_run.bat

Create mnc-batch_run.bat


@echo off

rem   Licensed to the Apache Software Foundation (ASF) under one or more
rem   contributor license agreements.  See the NOTICE file distributed with
rem   this work for additional information regarding copyright ownership.
rem   The ASF licenses this file to You under the Apache License, Version 2.0
rem   (the "License"); you may not use this file except in compliance with
rem   the License.  You may obtain a copy of the License at
rem
rem       http://www.apache.org/licenses/LICENSE-2.0
rem
rem   Unless required by applicable law or agreed to in writing, software
rem   distributed under the License is distributed on an "AS IS" BASIS,
rem   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem   See the License for the specific language governing permissions and
rem   limitations under the License.

rem   =====================================================
rem   Environment variables that can be defined externally:
rem
rem   JMETER_BIN - JMeter bin directory (must end in \)
rem   JM_LAUNCH - java.exe (default) or javaw.exe
rem   JVM_ARGS - additional java options, e.g. -Dprop=val
rem
rem   =====================================================

if .%JM_LAUNCH% == . set JM_LAUNCH=java.exe

if not "%OS%"=="Windows_NT" goto win9xStart
:winNTStart
@setlocal

rem Need to check if we are using the 4NT shell...
if "%eval[2+2]" == "4" goto setup4NT

if exist jmeter.bat goto winNT1
if .%JMETER_BIN% == . set JMETER_BIN=%~dp0

:winNT1
rem On NT/2K grab all arguments at once
set JMETER_CMD_LINE_ARGS=%*
goto doneStart

:setup4NT
set JMETER_CMD_LINE_ARGS=%$
goto doneStart

:win9xStart
rem Slurp the command line arguments.  This loop allows for an unlimited number of
rem arguments (up to the command line limit, anyway).

set JMETER_CMD_LINE_ARGS=

:setupArgs
if %1a==a goto doneStart
set JMETER_CMD_LINE_ARGS=%JMETER_CMD_LINE_ARGS% %1
shift
goto setupArgs

:doneStart
rem This label provides a place for the argument list loop to break out
rem and for NT handling to skip to.

rem The following link describes the -XX options:
rem http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp
rem http://java.sun.com/developer/TechTips/2000/tt1222.html has some more descriptions

rem See the unix startup file for the rationale of the following parameters,
rem including some tuning recommendations
set HEAP=-Xms512m -Xmx512m
set NEW=-XX:NewSize=128m -XX:MaxNewSize=128m
set SURVIVOR=-XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=50%
set TENURING=-XX:MaxTenuringThreshold=2
set EVACUATION=-XX:MaxLiveObjectEvacuationRatio=20%
set RMIGC=-Dsun.rmi.dgc.client.gcInterval=600000 -Dsun.rmi.dgc.server.gcInterval=600000
set PERM=-XX:PermSize=64m -XX:MaxPermSize=64m
rem set DEBUG=-verbose:gc -XX:+PrintTenuringDistribution

rem Always dump on OOM (does not cost anything unless triggered)
set DUMP=-XX:+HeapDumpOnOutOfMemoryError

rem Additional settings that might help improve GUI performance on some platforms
rem See: http://java.sun.com/products/java-media/2D/perf_graphics.html

set DDRAW=
rem  Setting this flag to true turns off DirectDraw usage, which sometimes helps to get rid of a lot of rendering problems on Win32.
rem set DDRAW=%DDRAW% -Dsun.java2d.noddraw=true

rem  Setting this flag to false turns off DirectDraw offscreen surfaces acceleration by forcing all createVolatileImage calls to become createImage calls, and disables hidden acceleration performed on surfaces created with createImage .
rem set DDRAW=%DDRAW% -Dsun.java2d.ddoffscreen=false

rem Setting this flag to true enables hardware-accelerated scaling.
rem set DDRAW=%DDRAW% -Dsun.java2d.ddscale=true

rem Server mode
rem Collect the settings defined above
set ARGS=%DUMP% %HEAP% %NEW% %SURVIVOR% %TENURING% %EVACUATION% %RMIGC% %PERM% %DDRAW%

%JM_START% %JM_LAUNCH% %ARGS% %JVM_ARGS% -jar "%JMETER_BIN%ApacheJMeter.jar" %JMETER_CMD_LINE_ARGS%

rem If the errorlevel is not zero, then display it and pause

if NOT errorlevel 0 goto pause
if errorlevel 1 goto pause

goto end

:pause
echo errorlevel=%ERRORLEVEL%
pause

:end

@echo off

rem   Licensed to the Apache Software Foundation (ASF) under one or more
rem   contributor license agreements.  See the NOTICE file distributed with
rem   this work for additional information regarding copyright ownership.
rem   The ASF licenses this file to You under the Apache License, Version 2.0
rem   (the "License"); you may not use this file except in compliance with
rem   the License.  You may obtain a copy of the License at
rem
rem       http://www.apache.org/licenses/LICENSE-2.0
rem
rem   Unless required by applicable law or agreed to in writing, software
rem   distributed under the License is distributed on an "AS IS" BASIS,
rem   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem   See the License for the specific language governing permissions and
rem   limitations under the License.

rem   =====================================================
rem   Environment variables that can be defined externally:
rem
rem   JMETER_BIN - JMeter bin directory (must end in \)
rem   JM_LAUNCH - java.exe (default) or javaw.exe
rem   JVM_ARGS - additional java options, e.g. -Dprop=val
rem
rem   =====================================================

if .%JM_LAUNCH% == . set JM_LAUNCH=java.exe

if not "%OS%"=="Windows_NT" goto win9xStart
:winNTStart
@setlocal

rem Need to check if we are using the 4NT shell...
if "%eval[2+2]" == "4" goto setup4NT

if exist jmeter.bat goto winNT1
if .%JMETER_BIN% == . set JMETER_BIN=%~dp0

:winNT1
rem On NT/2K grab all arguments at once
set JMETER_CMD_LINE_ARGS=%*
goto doneStart

:setup4NT
set JMETER_CMD_LINE_ARGS=%$
goto doneStart

:win9xStart
rem Slurp the command line arguments.  This loop allows for an unlimited number of
rem arguments (up to the command line limit, anyway).

set JMETER_CMD_LINE_ARGS=

:setupArgs
if %1a==a goto doneStart
set JMETER_CMD_LINE_ARGS=%JMETER_CMD_LINE_ARGS% %1
shift
goto setupArgs

:doneStart
rem This label provides a place for the argument list loop to break out
rem and for NT handling to skip to.

rem The following link describes the -XX options:
rem http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
rem http://java.sun.com/developer/TechTips/2000/tt1222.html has some more descriptions
rem Unfortunately TechTips no longer seem to be available

rem See the unix startup file for the rationale of the following parameters,
rem including some tuning recommendations
set HEAP=-Xms512m -Xmx512m
set NEW=-XX:NewSize=128m -XX:MaxNewSize=128m
set SURVIVOR=-XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=50%
set TENURING=-XX:MaxTenuringThreshold=2
set EVACUATION=-XX:MaxLiveObjectEvacuationRatio=20%
set RMIGC=-Dsun.rmi.dgc.client.gcInterval=600000 -Dsun.rmi.dgc.server.gcInterval=600000
set PERM=-XX:PermSize=64m -XX:MaxPermSize=64m
rem set DEBUG=-verbose:gc -XX:+PrintTenuringDistribution

rem Always dump on OOM (does not cost anything unless triggered)
set DUMP=-XX:+HeapDumpOnOutOfMemoryError

rem Additional settings that might help improve GUI performance on some platforms
rem See: http://java.sun.com/products/java-media/2D/perf_graphics.html

set DDRAW=
rem  Setting this flag to true turns off DirectDraw usage, which sometimes helps to get rid of a lot of rendering problems on Win32.
rem set DDRAW=%DDRAW% -Dsun.java2d.noddraw=true

rem  Setting this flag to false turns off DirectDraw offscreen surfaces acceleration by forcing all createVolatileImage calls to become createImage calls, and disables hidden acceleration performed on surfaces created with createImage .
rem set DDRAW=%DDRAW% -Dsun.java2d.ddoffscreen=false

rem Setting this flag to true enables hardware-accelerated scaling.
rem set DDRAW=%DDRAW% -Dsun.java2d.ddscale=true

rem Server mode
rem Collect the settings defined above
set ARGS=%DUMP% %HEAP% %NEW% %SURVIVOR% %TENURING% %EVACUATION% %RMIGC% %PERM% %DDRAW%

%JM_START% %JM_LAUNCH% %ARGS% %JVM_ARGS% -jar "%JMETER_BIN%ApacheJMeter.jar" %JMETER_CMD_LINE_ARGS%

rem If the errorlevel is not zero, then display it and pause

if NOT errorlevel 0 goto pause
if errorlevel 1 goto pause

goto end

:pause
echo errorlevel=%ERRORLEVEL%
pause

:end

Fix a Java=>Oracle URL

Fix a Java=>Oracle URL

git-svn-id: 7c053b8fbd1fb5868f764c6f9536fc6a9bbe7da9@1125926 13f79535-47bb-0310-9956-ffa450edef68


if not exist tmp\ mkdir tmp

cl -c -Zm200 -O2 -MT -EHsc -GR -W0 -wd4710 -I"." -I"..\..\include" -I"..\..\include\loki" -Fotmp\ SmallObjBench.cpp

link /NOLOGO /SUBSYSTEM:CONSOLE /incremental:no /OUT:"main-msvc.exe" tmp\SmallObjBench.obj ..\..\lib\SmallObj.obj ..\..\lib\Singleton.obj

if not exist tmp\ mkdir tmp

cl -c -DNDEBUG -Zm200 -O2 -MT -EHsc -GR -W0 -wd4710 -I"." -I"..\..\include" -I"..\..\include\loki" -Fotmp\ SmallObjBench.cpp ..\..\src\SmallObj.cpp

link /NOLOGO /SUBSYSTEM:CONSOLE /incremental:no /OUT:"main-msvc.exe" tmp\SmallObjBench.obj tmp\SmallObj.obj

fix typing mistake which kills ALL speedup

git-svn-id: e2e1a767b54e5f731ad8ac18fa5089ee37d5625a@240 7ec92016-0320-0410-acc4-a06ded1c099a


rmdir /S /Q %~dp0packages
msbuild %~dp0src\PaketTestApp\PaketTestApp.csproj

@rem If the assembly is signed then the targets file from the StrongNamer package was included correctly
sn -T %~dp0src\PaketTestApp\bin\Debug\Octokit.dll

Add batch file to test if imports from packages work with package restore


nuget install OpenCover -Version 4.6.519 -OutputDirectory tools
nuget install coveralls.net -Version 0.412.0 -OutputDirectory tools

.\tools\OpenCover.4.6.519\tools\OpenCover.Console.exe -target:"vstest.console.exe" -filter:"+[*]* -[*.*Tests]*" -excludebyfile:"*.g.cs" -targetargs:".\tests\Konves.TextGraph.UnitTests\bin\Release\Konves.TextGraph.UnitTests.dll .\tests\Konves.TextGraph.UnitTests\bin\Release\Konves.TextGraph.HtmlParser.UnitTests.dll .\tests\Konves.TextGraph.UnitTests\bin\Release\Konves.TextGraph.MarkdownParser.UnitTests.dll" -register:user
.\tools\coveralls.net.0.412\tools\csmacnz.Coveralls.exe --opencover -i .\results.xml

nuget install OpenCover -Version 4.6.519 -OutputDirectory tools
nuget install coveralls.net -Version 0.412.0 -OutputDirectory tools

.\tools\OpenCover.4.6.519\tools\OpenCover.Console.exe -target:"vstest.console.exe" -filter:"+[*]* -[*.*Tests]*" -excludebyfile:"*.g.cs" -targetargs:".\tests\Konves.TextGraph.UnitTests\bin\Release\Konves.TextGraph.UnitTests.dll .\tests\Konves.TextGraph.HtmlParser.UnitTests\bin\Release\Konves.TextGraph.HtmlParser.UnitTests.dll .\tests\Konves.TextGraph.MarkdownParser.UnitTests\bin\Release\Konves.TextGraph.MarkdownParser.UnitTests.dll" -register:user
.\tools\coveralls.net.0.412\tools\csmacnz.Coveralls.exe --opencover -i .\results.xml

Fix coverage script

Fix coverage script


@echo off

set batchdir=%~dp0
set buildtool=mingw

%batchdir%invoke_%buildtool% %*

@echo off

set batchdir=%~dp0
set buildtool=mingw

call %batchdir%invoke_%buildtool% %*

use call

use call


set APP_NAME=myTest2

set ANT_HOME=C:\phonegapmain\ant
set ANDROID_HOME=C:\phonegapmain\androidDec2013\sdk
set ANDROID_SDK_HOME=%USERPROFILE%
set GIT_HOME=C:\Progra~1\Git
set JAVA_HOME=C:\phonegapmain\java
set NODE_HOME=C:\Users\myComp\Documents\myFolder\nodejs\node
set NPM_HOME=c:\users\myComp\AppData\Roaming\npm

set PATH=C:\Windows;C:\Windows\System32;%ANT_HOME%\bin;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;%GIT_HOME%\bin;%GIT_HOME%\cmd;%JAVA_HOME%\bin;%NODE_HOME%;%NPM_HOME%;

set CLASSPATH=

phonegap create %APP_NAME% com.mysite.&APP_NAME% %APP_NAME% > xoutput.txt  2>&1

Create d-androidCreate.cmd

Create d-androidCreate.cmd


@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat x64"
SET PATH=%PROJECT_PATH%\3rdparty\bin;%MYSQL_CONNECTOR_PATH%\lib;%MYSQL_PATH%\bin;%PYTHON_PATH%\Scripts;%PATH%

cp "%MYSQL_CONNECTOR_PATH%\lib\libmysql.dll" "%PROJECT_PATH%\build\bin\"

cmake -GNinja -D%CONFIGURATION%=TRUE -DCMAKE_BUILD_TYPE=%CONFIGURATION% ..
cmake --build . --config %CONFIGURATION%

@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" x64
SET PATH=%PROJECT_PATH%\3rdparty\bin;%MYSQL_CONNECTOR_PATH%\lib;%MYSQL_PATH%\bin;%PYTHON_PATH%\Scripts;%PATH%

cp "%MYSQL_CONNECTOR_PATH%\lib\libmysql.dll" "%PROJECT_PATH%\build\bin\"

cmake -GNinja -D%CONFIGURATION%=TRUE -DCMAKE_BUILD_TYPE=%CONFIGURATION% ..
cmake --build . --config %CONFIGURATION%

Fix borked script file

Fix borked script file


@echo off
REM ---------------------------------------------------------------------------
REM
REM    Copyright 2015 Concur Technologies, Inc.
REM
REM    Licensed under the Apache License, Version 2.0 (the "License");
REM    you may not use this file except in compliance with the License.
REM    You may obtain a copy of the License at
REM
REM        http://www.apache.org/licenses/LICENSE-2.0
REM
REM    Unless required by applicable law or agreed to in writing, software
REM    distributed under the License is distributed on an "AS IS" BASIS,
REM    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM    See the License for the specific language governing permissions and
REM    limitations under the License.
REM
REM ---------------------------------------------------------------------------

REM Either run this from Vistual Studio command line, or set correct environment path for Gacutil first
REM If you do not have Gacutil tool, you can download it as part of Winsows SDK

echo on

Gacutil.exe /i ..\Couchbase.ComClient\bin\Release\Common.Logging.dll
Gacutil.exe /i ..\Couchbase.ComClient\bin\Release\Common.Logging.Core.dll
Gacutil.exe /i ..\Couchbase.ComClient\bin\Release\Common.Logging.NLog31.dll
Gacutil.exe /i ..\Couchbase.ComClient\bin\Release\NLog.dll
Gacutil.exe /i ..\Couchbase.ComClient\bin\Release\Newtonsoft.Json.dll
Gacutil.exe /i ..\Couchbase.ComClient\bin\Release\Couchbase.NetClient.dll
Gacutil.exe /i ..\Couchbase.ComClient\bin\Release\Couchbase.ComClient.dll

@REM Note that there are 2 versions of RegAsm tool. We need to run both to get the COM objects registered for 32 and 64 bit.

%windir%\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe /verbose ..\Couchbase.ComClient\bin\Release\Couchbase.ComClient.dll
%windir%\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe /verbose ..\Couchbase.ComClient\bin\Release\Couchbase.ComClient.dll

@echo off
REM ---------------------------------------------------------------------------
REM
REM    Copyright 2015 Concur Technologies, Inc.
REM
REM    Licensed under the Apache License, Version 2.0 (the "License");
REM    you may not use this file except in compliance with the License.
REM    You may obtain a copy of the License at
REM
REM        http://www.apache.org/licenses/LICENSE-2.0
REM
REM    Unless required by applicable law or agreed to in writing, software
REM    distributed under the License is distributed on an "AS IS" BASIS,
REM    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM    See the License for the specific language governing permissions and
REM    limitations under the License.
REM
REM ---------------------------------------------------------------------------

REM Either run this from Vistual Studio command line, or set correct environment path for Gacutil and MSBuild tools first
REM If you do not have Gacutil tool, you can download it as part of Winsows SDK

IF NOT EXIST ..\Couchbase.ComClient\bin\Release\Couchbase.ComClient.dll (
    MSBuild.exe ..\Couchbase.ComClient\Couchbase.ComClient.csproj /t:Rebuild /p:Configuration=Release
)

echo on

Gacutil.exe /i ..\Couchbase.ComClient\bin\Release\Common.Logging.dll
Gacutil.exe /i ..\Couchbase.ComClient\bin\Release\Common.Logging.Core.dll
Gacutil.exe /i ..\Couchbase.ComClient\bin\Release\Common.Logging.NLog31.dll
Gacutil.exe /i ..\Couchbase.ComClient\bin\Release\NLog.dll
Gacutil.exe /i ..\Couchbase.ComClient\bin\Release\Newtonsoft.Json.dll
Gacutil.exe /i ..\Couchbase.ComClient\bin\Release\Couchbase.NetClient.dll
Gacutil.exe /i ..\Couchbase.ComClient\bin\Release\Couchbase.ComClient.dll

@REM Note that there are 2 versions of RegAsm tool. We need to run both to get the COM objects registered for 32 and 64 bit.

%windir%\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe /verbose ..\Couchbase.ComClient\bin\Release\Couchbase.ComClient.dll
%windir%\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe /verbose ..\Couchbase.ComClient\bin\Release\Couchbase.ComClient.dll

Rebuild the solution if needed for com registration

com-register script now checks for existence of the dll file and
rebuilds the project if needed


@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem      https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem  Gradle startup script for Windows
@rem  (Modified for the purposes of building Byte Buddy)
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:execute

@rem Use legacy Gradle if Java 6 or 7 is used to build (Byte Buddy edit)
set WRAPPER_LOCATION=wrapper-legacy
set GRADLE_ADDITIONAL_OPTS="--build-file=build.legacy.gradle"
for /f tokens^=2-5^ delims^=.-_^" %%j in ('%JAVA_HOME%\bin\java -fullversion 2^>^&1') do set "JAVA_VERSION_STRING=%%j.%%k"
IF NOT "%JAVA_VERSION_STRING:~0,3%"=="1.6" (
  IF NOT "%JAVA_VERSION_STRING:~0,3%"=="1.7" (
    set WRAPPER_LOCATION=wrapper
    set GRADLE_ADDITIONAL_OPTS=""
  )
)

@rem Extension to allow automatically downloading the Gradle binary from Gradle's repository
@rem This is implemented similarly to the Maven Wrapper's download routine.
SET DISTRIBUTION_LOCATION=""
SET DISTRIBUTION_URL=""
for /f "usebackq tokens=1,2 delims==" %%A in ("%APP_HOME%\gradle\%WRAPPER_LOCATION%\gradle-wrapper.properties") do (
    if "%%A"=="distributionRepo" SET DISTRIBUTION_LOCATION=%%B
    if "%%A"=="distributionUrl" SET DISTRIBUTION_URL=%%B
)
if not %DISTRIBUTION_LOCATION%=="" (
    SET DISTRIBUTION_SOURCE=%DISTRIBUTION_LOCATION%/%DISTRIBUTION_URL%
    SET DISTRIBUTION_TARGET=%APP_HOME%\gradle\%WRAPPER_LOCATION%\%DISTRIBUTION_URL%
    if exist "%DISTRIBUTION_TARGET%" (
        if "%GRADLEW_VERBOSE%" == "true" (
            echo Found %DISTRIBUTION_TARGET%
        )
    ) else (
        if "%GRADLEW_VERBOSE%" == "true" (
            echo Couldn't find %DISTRIBUTION_TARGET%, downloading it ...
            echo Downloading from: %DISTRIBUTION_SOURCE%
        )

        powershell -Command "&{"^
            "$webclient = new-object System.Net.WebClient;"^
            "if (-not ([string]::IsNullOrEmpty('%GRADLEW_USERNAME%') -and [string]::IsNullOrEmpty('%GRADLEW_PASSWORD%'))) {"^
            "$webclient.Credentials = new-object System.Net.NetworkCredential('%GRADLEW_USERNAME%', '%GRADLEW_PASSWORD%');"^
            "}"^
            "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DISTRIBUTION_SOURCE%', '%DISTRIBUTION_TARGET%')"^
            "}"
        if "%GRADLEW_VERBOSE%" == "true" (
            echo Finished downloading %DISTRIBUTION_TARGET%
        )
    )
)
@rem End of extension

@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\%WRAPPER_LOCATION%\gradle-wrapper.jar

@REM Download and validate the Gradle wrapper (Byte Buddy edit)
SET WRAPPER_URL=""
SET WRAPPER_HASH=""
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%APP_HOME%\gradle\%WRAPPER_LOCATION%\gradle-wrapper.properties") DO (
    IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
    IF "%%A"=="wrapperHash" SET WRAPPER_HASH=%%B
)
if not %WRAPPER_URL%=="" (
    SET WRAPPER_TARGET=%APP_HOME%\gradle\%WRAPPER_LOCATION%\gradle-wrapper.jar
    if exist "%WRAPPER_URL%" (
        if "%GRADLEW_VERBOSE%" == "true" (
            echo Found %WRAPPER_URL%
        )
    ) else (
        if "%GRADLEW_VERBOSE%" == "true" (
            echo Couldn't find %WRAPPER_URL%, downloading it ...
            echo Downloading from: %WRAPPER_URL%
        )

        powershell -Command "&{"^
            "$webclient = new-object System.Net.WebClient;"^
            "if (-not ([string]::IsNullOrEmpty('%GRADLEW_USERNAME%') -and [string]::IsNullOrEmpty('%GRADLEW_PASSWORD%'))) {"^
            "$webclient.Credentials = new-object System.Net.NetworkCredential('%GRADLEW_USERNAME%', '%GRADLEW_PASSWORD%');"^
            "}"^
            "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_TARGET%')"^
            "}"
        if "%GRADLEW_VERBOSE%" == "true" (
            echo Finished downloading %WRAPPER_TARGET%
        )
    )
)
IF NOT %WRAPPER_HASH%=="" (
    FOR /F "usebackq tokens=*" %%A in ('certUtil -hashfile "%APP_HOME%\gradle\%WRAPPER_LOCATION%\gradle-wrapper.jar" SHA256') do (
        echo %%A | findstr /C:"hash" 1>nul || (
            IF NOT %%A==%WRAPPER_HASH% (
                echo Could not validate hash of gradle-wrapper.jar, was %%A
                goto error
            )
        )
    )
)

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %GRADLE_ADDITIONAL_OPTS% *

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega

@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem      https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@echo on
@rem ##########################################################################
@rem
@rem  Gradle startup script for Windows
@rem  (Modified for the purposes of building Byte Buddy)
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:execute

@rem Use legacy Gradle if Java 6 or 7 is used to build (Byte Buddy edit)
set WRAPPER_LOCATION=wrapper-legacy
set GRADLE_ADDITIONAL_OPTS="--build-file=build.legacy.gradle"
for /f tokens^=2-5^ delims^=.-_^" %%j in ('%JAVA_HOME%\bin\java -fullversion 2^>^&1') do set "JAVA_VERSION_STRING=%%j.%%k"
IF NOT "%JAVA_VERSION_STRING:~0,3%"=="1.6" (
  IF NOT "%JAVA_VERSION_STRING:~0,3%"=="1.7" (
    set WRAPPER_LOCATION=wrapper
    set GRADLE_ADDITIONAL_OPTS=""
  )
)

@rem Extension to allow automatically downloading the Gradle binary from Gradle's repository
@rem This is implemented similarly to the Maven Wrapper's download routine.
SET DISTRIBUTION_LOCATION=""
SET DISTRIBUTION_URL=""
for /f "usebackq tokens=1,2 delims==" %%A in ("%APP_HOME%\gradle\%WRAPPER_LOCATION%\gradle-wrapper.properties") do (
    if "%%A"=="distributionRepo" SET DISTRIBUTION_LOCATION=%%B
    if "%%A"=="distributionUrl" SET DISTRIBUTION_URL=%%B
)
if not %DISTRIBUTION_LOCATION%=="" (
    SET DISTRIBUTION_SOURCE=%DISTRIBUTION_LOCATION%/%DISTRIBUTION_URL%
    SET DISTRIBUTION_TARGET=%APP_HOME%\gradle\%WRAPPER_LOCATION%\%DISTRIBUTION_URL%
    if exist "%DISTRIBUTION_TARGET%" (
        if "%GRADLEW_VERBOSE%" == "true" (
            echo Found %DISTRIBUTION_TARGET%
        )
    ) else (
        if "%GRADLEW_VERBOSE%" == "true" (
            echo Couldn't find %DISTRIBUTION_TARGET%, downloading it ...
            echo Downloading from: %DISTRIBUTION_SOURCE%
        )

        powershell -Command "&{"^
            "$webclient = new-object System.Net.WebClient;"^
            "if (-not ([string]::IsNullOrEmpty('%GRADLEW_USERNAME%') -and [string]::IsNullOrEmpty('%GRADLEW_PASSWORD%'))) {"^
            "$webclient.Credentials = new-object System.Net.NetworkCredential('%GRADLEW_USERNAME%', '%GRADLEW_PASSWORD%');"^
            "}"^
            "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DISTRIBUTION_SOURCE%', '%DISTRIBUTION_TARGET%')"^
            "}"
        if "%GRADLEW_VERBOSE%" == "true" (
            echo Finished downloading %DISTRIBUTION_TARGET%
        )
    )
)
@rem End of extension

@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\%WRAPPER_LOCATION%\gradle-wrapper.jar

@REM Download and validate the Gradle wrapper (Byte Buddy edit)
SET WRAPPER_URL=""
SET WRAPPER_HASH=""
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%APP_HOME%\gradle\%WRAPPER_LOCATION%\gradle-wrapper.properties") DO (
    IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
    IF "%%A"=="wrapperHash" SET WRAPPER_HASH=%%B
)
if not %WRAPPER_URL%=="" (
    SET WRAPPER_TARGET=%APP_HOME%\gradle\%WRAPPER_LOCATION%\gradle-wrapper.jar
    if exist "%WRAPPER_URL%" (
        if "%GRADLEW_VERBOSE%" == "true" (
            echo Found %WRAPPER_URL%
        )
    ) else (
        if "%GRADLEW_VERBOSE%" == "true" (
            echo Couldn't find %WRAPPER_TARGET%, downloading it ...
            echo Downloading from: %WRAPPER_URL%
        )

        powershell -Command "&{"^
            "$webclient = new-object System.Net.WebClient;"^
            "if (-not ([string]::IsNullOrEmpty('%GRADLEW_USERNAME%') -and [string]::IsNullOrEmpty('%GRADLEW_PASSWORD%'))) {"^
            "$webclient.Credentials = new-object System.Net.NetworkCredential('%GRADLEW_USERNAME%', '%GRADLEW_PASSWORD%');"^
            "}"^
            "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_TARGET%')"^
            "}"
        if "%GRADLEW_VERBOSE%" == "true" (
            echo Finished downloading %WRAPPER_TARGET%
        )
    )
)
IF NOT %WRAPPER_HASH%=="" (
    FOR /F "usebackq tokens=*" %%A in ('certUtil -hashfile "%APP_HOME%\gradle\%WRAPPER_LOCATION%\gradle-wrapper.jar" SHA256') do (
        echo %%A | findstr /C:"hash" 1>nul || (
            IF NOT %%A==%WRAPPER_HASH% (
                echo Could not validate hash of gradle-wrapper.jar, was %%A
                goto error
            )
        )
    )
)

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %GRADLE_ADDITIONAL_OPTS% *

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega

Enable echo for Gradle to debug.

Enable echo for Gradle to debug.


@echo off

setlocal EnableDelayedExpansion

set registryRoot=HKCU\Software\Classes
set key=Vim

reg add "%registryRoot%\*\shell\%key%" /v LegacyDisable /t REG_SZ /f

Add context-menu-disable-vim.bat

Add context-menu-disable-vim.bat


@set dbcl_build_folder=%appveyor_build_folder%
@if "%dbcl_build_folder%" == "" set dbcl_build_folder=%cd%

@set dbcl_artifacts_folder=%dbcl_build_folder%\reports
@if exist %dbcl_artifacts_folder%\. (del /Q %dbcl_artifacts_folder%\*) else (md %dbcl_artifacts_folder%)
@set dbcl_packages_folder=%dbcl_build_folder%\packages

@set dbcl_nunit_runner_console=%dbcl_packages_folder%\NUnit.Runners.Net4.2.6.4\tools\nunit-console-x86.exe
@set dbcl_nunit_runner_options=/nologo /noshadow /work:%dbcl_artifacts_folder%

@set dbcl_zip_console=%dbcl_packages_folder%\7-Zip.CommandLine.9.20.0\tools\7za.exe

@set dbcl_coveralls_console=%dbcl_packages_folder%\coveralls.io.1.3.4\tools\coveralls.net.exe
@set dbcl_coveralls_options=--opencover %dbcl_artifacts_folder%\OpenCover.*.xml --repo-token "%coveralls_repo_token%"

@set dbcl_report_generator_console=%dbcl_packages_folder%\ReportGenerator.2.3.5.0\tools\ReportGenerator.exe
@set dbcl_report_generator_options=-targetdir:%dbcl_artifacts_folder% -reports:%dbcl_artifacts_folder%\OpenCover.*.xml

@Rem OpenCover Debug Build
@set OpenCoverDebugBuild="E:\GitHub\opencover\main\bin\Debug\OpenCover.Console.exe"

@Rem OpenCover Release Build
@set OpenCoverReleaseBuild="E:\GitHub\opencover\main\bin\Release\OpenCover.Console.exe"

@Rem OpenCover MSI Installed
@set OpenCoverMsiInstalled="C:\Program Files (x86)\OpenCover\OpenCover.Console.exe"

@Rem OpenCover Nuget Package
@Rem set OpenCoverNugetPackage=".\packages\OpenCover.4.6.166\tools\OpenCover.Console.exe"
@set OpenCoverNugetPackage=".\packages\OpenCover.4.6.434-rc\tools\OpenCover.Console.exe"

@Rem OpenCover Command
@set OpenCoverCommand=%OpenCoverNugetPackage%

@if "%appveyor%" == "True" goto start-opencover

@rem use OpenCover release build for local build and coverage reports
@set OpenCoverCommand=%OpenCoverReleaseBuild%

@rem copy OpenCover release build into SharpDevelop bin
@del /Q /S E:\GitHub\SharpDevelop\bin\Tools\OpenCover\*
@del /Q /S E:\GitHub\SharpDevelop\src\Tools\OpenCover\*
@xcopy E:\GitHub\opencover\main\bin\Release\* E:\GitHub\SharpDevelop\src\Tools\OpenCover\ /S
@xcopy E:\GitHub\opencover\main\bin\Release\* E:\GitHub\SharpDevelop\bin\Tools\OpenCover\ /S

@Rem Local Build?
@if not exist "C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" goto start-opencover
@"C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" DBCL.sln /t:Clean,Build
@Rem if not exist "E:\cov-analysis-win64-7.7.0.4\bin\cov-build.exe" goto start-opencover
@Rem E:\cov-analysis-win64-7.7.0.4\bin\cov-build --dir cov-int "C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" DBCL.sln /t:Clean,Build

:start-opencover

@Rem OpenCover Options
@set OpenCoverOptions=-register:user -threshold:1 -mergebyhash -hideskipped:All

@Rem OpenCover command
@set OpenCoverCommandAndOptions=%OpenCoverCommand% %OpenCoverOptions%

@echo AppVeyor env.variable: %appveyor%
@echo AppVeyor Build Folder: %appveyor_build_folder%
@echo Current        Folder: %cd%
@echo dbcl Artifacts Folder: %dbcl_artifacts_folder%
@echo dbcl     Build Folder: %dbcl_build_folder%
@echo NUnit         Options: %dbcl_nunit_runner_options%
@echo OpenCover     Command: %OpenCoverCommand%
@echo OpenCover     Options: %OpenCoverOptions%
@%OpenCoverCommand% -version
@echo.

:run-all-tests
@call :run-single-test "BitSetArray" "+[DBCL]DD.Collections.BitSetArray*"
@call :run-single-test "ICodeSet"    "+[DBCL]DD.Collections.ICodeSet*"
@call :run-single-test "Extensions"  "+[DBCL]DD.Extends*"
@call :run-single-test "Text"        "+[DBCL]DD.Text* -[DBCL]DD.Text.UniCode*"
@exit /b

:run-single-test
@echo assembly  name: %1
@echo filter applied: %2
@%OpenCoverCommandAndOptions% ^
-output:"%dbcl_artifacts_folder%\OpenCover.%1.xml" ^
-filter:%2 ^
-target:"%dbcl_nunit_runner_console%" ^
-targetdir:".\Source\Test\NUnit.%1\bin\Debug" ^
-targetargs:"NUnit.%1.dll /result:\"NUnit.%1.xml\" %dbcl_nunit_runner_options%"
@echo -------------------------------------
@echo.
@echo %date%
@echo %time%
@if "%appveyor%" == "True" exit /b
@if exist ".\Source\Test\NUnit.%1\OpenCover" copy /Y "%dbcl_artifacts_folder%\OpenCover.%1.xml" ".\Source\Test\NUnit.%1\OpenCover\coverage.xml"
@if "%pause%" == "True" pause
@exit /b

@set dbcl_build_folder=%appveyor_build_folder%
@if "%dbcl_build_folder%" == "" set dbcl_build_folder=%cd%

@set dbcl_artifacts_folder=%dbcl_build_folder%\reports
@if exist %dbcl_artifacts_folder%\. (del /Q %dbcl_artifacts_folder%\*) else (md %dbcl_artifacts_folder%)
@set dbcl_packages_folder=%dbcl_build_folder%\packages

@set dbcl_nunit_runner_console=%dbcl_packages_folder%\NUnit.Runners.Net4.2.6.4\tools\nunit-console-x86.exe
@set dbcl_nunit_runner_options=/nologo /noshadow /work:%dbcl_artifacts_folder%

@set dbcl_zip_console=%dbcl_packages_folder%\7-Zip.CommandLine.9.20.0\tools\7za.exe

@set dbcl_coveralls_console=%dbcl_packages_folder%\coveralls.io.1.3.4\tools\coveralls.net.exe
@set dbcl_coveralls_options=--opencover %dbcl_artifacts_folder%\OpenCover.*.xml --repo-token "%coveralls_repo_token%"

@set dbcl_report_generator_console=%dbcl_packages_folder%\ReportGenerator.2.3.5.0\tools\ReportGenerator.exe
@set dbcl_report_generator_options=-targetdir:%dbcl_artifacts_folder% -reports:%dbcl_artifacts_folder%\OpenCover.*.xml

@Rem OpenCover Debug Build
@set OpenCoverDebugBuild="E:\GitHub\opencover\main\bin\Debug\OpenCover.Console.exe"

@Rem OpenCover Release Build
@set OpenCoverReleaseBuild="E:\GitHub\opencover\main\bin\Release\OpenCover.Console.exe"

@Rem OpenCover MSI Installed
@set OpenCoverMsiInstalled="C:\Program Files (x86)\OpenCover\OpenCover.Console.exe"

@Rem OpenCover Nuget Package
@Rem set OpenCoverNugetPackage=".\packages\OpenCover.4.6.166\tools\OpenCover.Console.exe"
@set OpenCoverNugetPackage=".\packages\OpenCover.4.6.515-rc\tools\OpenCover.Console.exe"

@Rem OpenCover Command
@set OpenCoverCommand=%OpenCoverNugetPackage%

@if "%appveyor%" == "True" goto start-opencover

@rem use OpenCover release build for local build and coverage reports
@set OpenCoverCommand=%OpenCoverReleaseBuild%

@rem copy OpenCover release build into SharpDevelop bin
@del /Q /S E:\GitHub\SharpDevelop\bin\Tools\OpenCover\*
@del /Q /S E:\GitHub\SharpDevelop\src\Tools\OpenCover\*
@xcopy E:\GitHub\opencover\main\bin\Release\* E:\GitHub\SharpDevelop\src\Tools\OpenCover\ /S
@xcopy E:\GitHub\opencover\main\bin\Release\* E:\GitHub\SharpDevelop\bin\Tools\OpenCover\ /S

@Rem Local Build?
@if not exist "C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" goto start-opencover
@"C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" DBCL.sln /t:Clean,Build
@Rem if not exist "E:\cov-analysis-win64-7.7.0.4\bin\cov-build.exe" goto start-opencover
@Rem E:\cov-analysis-win64-7.7.0.4\bin\cov-build --dir cov-int "C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" DBCL.sln /t:Clean,Build

:start-opencover

@Rem OpenCover Options
@set OpenCoverOptions=-register:user -threshold:1 -mergebyhash -hideskipped:All

@Rem OpenCover command
@set OpenCoverCommandAndOptions=%OpenCoverCommand% %OpenCoverOptions%

@echo AppVeyor env.variable: %appveyor%
@echo AppVeyor Build Folder: %appveyor_build_folder%
@echo Current        Folder: %cd%
@echo dbcl Artifacts Folder: %dbcl_artifacts_folder%
@echo dbcl     Build Folder: %dbcl_build_folder%
@echo NUnit         Options: %dbcl_nunit_runner_options%
@echo OpenCover     Command: %OpenCoverCommand%
@echo OpenCover     Options: %OpenCoverOptions%
@%OpenCoverCommand% -version
@echo.

:run-all-tests
@call :run-single-test "BitSetArray" "+[DBCL]DD.Collections.BitSetArray*"
@call :run-single-test "ICodeSet"    "+[DBCL]DD.Collections.ICodeSet*"
@call :run-single-test "Extensions"  "+[DBCL]DD.Extends*"
@call :run-single-test "Text"        "+[DBCL]DD.Text* -[DBCL]DD.Text.UniCode*"
@exit /b

:run-single-test
@echo assembly  name: %1
@echo filter applied: %2
@%OpenCoverCommandAndOptions% ^
-output:"%dbcl_artifacts_folder%\OpenCover.%1.xml" ^
-filter:%2 ^
-target:"%dbcl_nunit_runner_console%" ^
-targetdir:".\Source\Test\NUnit.%1\bin\Debug" ^
-targetargs:"NUnit.%1.dll /result:\"NUnit.%1.xml\" %dbcl_nunit_runner_options%"
@echo -------------------------------------
@echo.
@echo %date%
@echo %time%
@if "%appveyor%" == "True" exit /b
@if exist ".\Source\Test\NUnit.%1\OpenCover" copy /Y "%dbcl_artifacts_folder%\OpenCover.%1.xml" ".\Source\Test\NUnit.%1\OpenCover\coverage.xml"
@if "%pause%" == "True" pause
@exit /b

Upgrade build script

Upgrade build script


rem build twice - this is not a typo
rem first time is to build using old version
rem second time is to build using new version
rem both build ensure compatibility on version update

@echo off
setlocal

call :bootstrapbuild || goto :ko
call :build %1 || goto :ko
call :test || goto :ko
goto :ok

:bootstrapbuild
call build-bootstrap.cmd || goto :ko
goto :eof

:build
call build.cmd %1 || goto :ko
call publish.cmd %1 || goto :ko
goto :eof

:test
call test.cmd || goto :ko
goto :eof

:ok
exit /b 0

:ko
echo BUILD FAILURE
exit /b 5

rem build twice - this is not a typo
rem first time is to build using old version
rem second time is to build using new version
rem both build ensure compatibility on version update

@echo off
setlocal

call :bootstrapbuild || goto :ko
call :build %1 || goto :ko
call :test || goto :ko
goto :ok

:bootstrapbuild
call build-bootstrap.cmd || goto :ko
goto :eof

:build
call build.cmd %1 || goto :ko
call publish.cmd %1 %2 || goto :ko
goto :eof

:test
call test.cmd || goto :ko
goto :eof

:ok
exit /b 0

:ko
echo BUILD FAILURE
exit /b 5

set ver status

set ver status


:: Copyright 2015 Viktor Szakats <https://github.com/vszakats>
:: See LICENSE.md

@echo off

set _NAM=%~n0
set _NAM=%_NAM:~3%
set _VER=%1
set _CPU=%2

setlocal
pushd "%_NAM%"

:: Build

set INC=-I../../openssl/include -I../../zlib
if "%_CPU%" == "win32" set XCFLAGS=-m32
if "%_CPU%" == "win64" set XCFLAGS=-m64
if "%_CPU%" == "win32" set XLDFLAGS=-m32 -L../../openssl -L../../zlib
if "%_CPU%" == "win64" set XLDFLAGS=-m64 -L../../openssl -L../../zlib
set LDFLAGS=%XLDFLAGS%
mingw32-make SYS=mingw SODEF_yes=

:: Make steps for determinism

if exist librtmp\*.a   strip -p --enable-deterministic-archives -g librtmp\*.a
if exist librtmp\*.lib strip -p --enable-deterministic-archives -g librtmp\*.lib

python ..\peclean.py *.exe
python ..\peclean.py librtmp\*.dll

touch -c librtmp/*.exe -r ChangeLog
touch -c librtmp/*.dll -r ChangeLog
touch -c librtmp/*.a   -r ChangeLog
touch -c librtmp/*.lib -r ChangeLog

popd
endlocal

:: Copyright 2015 Viktor Szakats <https://github.com/vszakats>
:: See LICENSE.md

@echo off

set _NAM=%~n0
set _NAM=%_NAM:~3%
set _VER=%1
set _CPU=%2

setlocal
pushd "%_NAM%"

:: Build

set INC=-I../../openssl/include -I../../zlib
if "%_CPU%" == "win32" (
   set XCFLAGS=-m32
   set XLDFLAGS=-m32 -L../openssl -L../zlib
   set  LDFLAGS=-m32 -L../../openssl -L../../zlib
) else (
   set XCFLAGS=-m64
   set XLDFLAGS=-m64 -L../openssl -L../zlib
   set  LDFLAGS=-m64 -L../../openssl -L../../zlib
)
del /s *.o *.a *.dll *.so *.exe >> nul 2>&1
mingw32-make SYS=mingw SODEF_yes=

:: Make steps for determinism

if exist librtmp\*.a   strip -p --enable-deterministic-archives -g librtmp\*.a
if exist librtmp\*.lib strip -p --enable-deterministic-archives -g librtmp\*.lib

python ..\peclean.py *.exe
python ..\peclean.py librtmp\*.dll

touch -c librtmp/*.exe -r ChangeLog
touch -c librtmp/*.dll -r ChangeLog
touch -c librtmp/*.a   -r ChangeLog
touch -c librtmp/*.lib -r ChangeLog

popd
endlocal

fix to build rtmp exes, fix to clean

mk-librtmp.bat: fix to build rtmp exes, fix to clean


doctrine-module orm:convert-mapping annotation module/Blog/src --namespace="Blog\Entity\\" --from-database
<!--doctrine-module orm:generate-entities /module/Blog/src/ --generate-annotations=true-->

add 1.bat

add 1.bat


"%R%" CMD INSTALL --build . %R_ARGS%
IF %ERRORLEVEL% NEQ 0 exit /B 1

Update bld.bat

Update bld.bat


@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
call "%~DP0\setenv.bat"
set PYTHONDLL=%PYTHONHOME%
set PYTHONHOME=
set PYTHONPATH=%PYTHONPATH%;C:\Software\PyScripter\Lib
REM start "PyScripter MetaGETA" /B "C:\Software\PyScripter\PyScripter.exe" --PYTHON27  --PYTHONDLLPATH "%PYTHONDLL%" --newinstance %1 %2 %3 %4 %5
CALL "C:\Software\PyScripter\PyScripter.exe" --PYTHON27  --PYTHONDLLPATH "%PYTHONDLL%" --newinstance %1 %2 %3 %4 %5
PAUSE
ENDLOCAL

Add pyscripter batch file

Add pyscripter batch file


if not exist "C:\Windows\Temp\7z920-x64.msi" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi

if "%PACKER_BUILDER_TYPE%" equ "parallels-iso" goto :parallels
if "%PACKER_BUILDER_TYPE%" equ "virtualbox-iso" goto :virtualbox
if "%PACKER_BUILDER_TYPE%" equ "vmware-iso" goto :vmware

rem default is vmware
rem rem goto :done

:vmware

if exist "C:\Users\vagrant\windows.iso" (
    move /Y C:\Users\vagrant\windows.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\windows.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.5.1/4542065/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
    cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.tar -oC:\Windows\Temp"
    FOR /r "C:\Windows\Temp" %%a in (VMware-tools-windows-*.iso) DO REN "%%~a" "windows.iso"
    rd /S /Q "C:\Program Files (x86)\VMWare"
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\windows.iso" -oC:\Windows\Temp\VMWare"
cmd /c C:\Windows\Temp\VMWare\setup.exe /S /v"/qn REBOOT=R\"

goto :done

:virtualbox

:: There needs to be Oracle CA (Certificate Authority) certificates installed in order
:: to prevent user intervention popups which will undermine a silent installation.
cmd /c certutil -addstore -f "TrustedPublisher" A:\oracle-cert.cer

if exist "C:\Users\vagrant\VBoxGuestAdditions.iso" (
    move /Y C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\VBoxGuestAdditions.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.virtualbox.org/virtualbox/5.1.8/VBoxGuestAdditions_5.1.8.iso', 'C:\Windows\Temp\VBoxGuestAdditions.iso')" <NUL
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
rd /S /Q "C:\Windows\Temp\virtualbox"
goto :done

:parallels
if exist "C:\Users\vagrant\prl-tools-win.iso" (
	move /Y C:\Users\vagrant\prl-tools-win.iso C:\Windows\Temp
	cmd /C "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\prl-tools-win.iso -oC:\Windows\Temp\parallels
	cmd /C C:\Windows\Temp\parallels\PTAgent.exe /install_silent
	rd /S /Q "C:\Windows\Temp\parallels"
)

:done
msiexec /qb /x C:\Windows\Temp\7z920-x64.msi

if not exist "C:\Windows\Temp\7z920-x64.msi" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL
)
msiexec /qb /i C:\Windows\Temp\7z920-x64.msi

if "%PACKER_BUILDER_TYPE%" equ "vmware-iso" goto :vmware
if "%PACKER_BUILDER_TYPE%" equ "virtualbox-iso" goto :virtualbox
if "%PACKER_BUILDER_TYPE%" equ "parallels-iso" goto :parallels
goto :done

:vmware

if exist "C:\Users\vagrant\windows.iso" (
    move /Y C:\Users\vagrant\windows.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\windows.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.5.5/5234757/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
    cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.tar -oC:\Windows\Temp"
    FOR /r "C:\Windows\Temp" %%a in (VMware-tools-windows-*.iso) DO REN "%%~a" "windows.iso"
    rd /S /Q "C:\Program Files (x86)\VMWare"
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\windows.iso" -oC:\Windows\Temp\VMWare"
cmd /c C:\Windows\Temp\VMWare\setup.exe /S /v"/qn REBOOT=R\"

rd /Q "C:\Windows\Temp\vmware-tools.tar"
rd /Q "C:\Windows\Temp\windows.iso"
rd /S /Q "C:\Windows\Temp\VMware"
goto :done

:virtualbox

:: There needs to be Oracle CA (Certificate Authority) certificates installed in order
:: to prevent user intervention popups which will undermine a silent installation.
cmd /c certutil -addstore -f "TrustedPublisher" A:\oracle-cert.cer

if exist "C:\Users\vagrant\VBoxGuestAdditions.iso" (
    move /Y C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp
)

if not exist "C:\Windows\Temp\VBoxGuestAdditions.iso" (
    powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.virtualbox.org/virtualbox/5.1.20/VBoxGuestAdditions_5.1.20.iso', 'C:\Windows\Temp\VBoxGuestAdditions.iso')" <NUL
)

cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
certutil -addstore -f "TrustedPublisher" C:\Windows\Temp\virtualbox\cert\vbox-sha256-r3.cer
certutil -addstore -f "TrustedPublisher" C:\Windows\Temp\virtualbox\cert\vbox-sha256.cer
certutil -addstore -f "TrustedPublisher" C:\Windows\Temp\virtualbox\cert\vbox-sha1.cer
cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
rd /S /Q "C:\Windows\Temp\virtualbox"
goto :done

:parallels
if exist "C:\Users\vagrant\prl-tools-win.iso" (
	move /Y C:\Users\vagrant\prl-tools-win.iso C:\Windows\Temp
	cmd /C "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\prl-tools-win.iso -oC:\Windows\Temp\parallels
	cmd /C C:\Windows\Temp\parallels\PTAgent.exe /install_silent
	rd /S /Q "C:\Windows\Temp\parallels"
)

:done
msiexec /qb /x C:\Windows\Temp\7z920-x64.msi

Update VMware tools and VBoxAdditions

Update VMware tools and VBoxAdditions


set SOURCE_DIR=%CD%
set BUILD_DIR=../build-sqlitewrapper
set CMAKE_COMMAND=cmake.exe
set MAKE_COMMAND=C:\Qt\Tools\QtCreator\bin\jom.exe /J 2

call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat"

python projectfiles_unchanged.py
if %ERRORLEVEL% NEQ 0 (
  RMDIR /S /Q "%BUILD_DIR%"
)

if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%"
cd "%BUILD_DIR%" || goto error
%CMAKE_COMMAND% -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" "%SOURCE_DIR%" || goto error
%MAKE_COMMAND% || goto error

cd "%SOURCE_DIR%"
exit /b 0

:error
cd "%SOURCE_DIR%"
exit /b 1

set SOURCE_DIR=%CD%
set BUILD_DIR=../build-sqlitewrapper
set CMAKE_COMMAND=cmake.exe
set MAKE_COMMAND=C:\Qt-Installation\Tools\QtCreator\bin\jom.exe /J 2

call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat"

python projectfiles_unchanged.py
if %ERRORLEVEL% NEQ 0 (
  RMDIR /S /Q "%BUILD_DIR%"
)

if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%"
cd "%BUILD_DIR%" || goto error
%CMAKE_COMMAND% -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" "%SOURCE_DIR%" || goto error
%MAKE_COMMAND% || goto error

cd "%SOURCE_DIR%"
goto :EOF

:error
cd "%SOURCE_DIR%"
exit /b 1

Fix JOM path

Windows: Fix JOM path


@REM @file
@REM   Windows batch file to build BIOS ROM
@REM
@REM Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
@REM This program and the accompanying materials
@REM are licensed and made available under the terms and conditions of the BSD License
@REM which accompanies this distribution.  The full text of the license may be found at
@REM http://opensource.org/licenses/bsd-license.php
@REM
@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@REM

@echo off
setlocal EnableDelayedExpansion EnableExtensions
echo.
echo %date%  %time%
echo.

::**********************************************************************
:: Initial Setup
::**********************************************************************
set WORKSPACE=%CD%
if %WORKSPACE:~-1%==\ set WORKSPACE=%WORKSPACE:~0,-1%
set /a build_threads=1
set "Build_Flags= "
set exitCode=0
set Arch=X64
set Source=0

:: Clean up previous build files.
if exist %WORKSPACE%\edk2.log del %WORKSPACE%\edk2.log
if exist %WORKSPACE%\unitool.log del %WORKSPACE%\unitool.log
if exist %WORKSPACE%\Conf\target.txt del %WORKSPACE%\Conf\target.txt
if exist %WORKSPACE%\Conf\tools_def.txt del %WORKSPACE%\Conf\tools_def.txt
if exist %WORKSPACE%\Conf\build_rule.txt del %WORKSPACE%\Conf\build_rule.txt
if exist %WORKSPACE%\Conf\FrameworkDatabase.db del %WORKSPACE%\Conf\FrameworkDatabase.db
if exist conf\.cache rmdir /q/s conf\.cache

:: Setup EDK environment. Edksetup puts new copies of target.txt, tools_def.txt, build_rule.txt in WorkSpace\Conf
:: Also run edksetup as soon as possible to avoid it from changing environment variables we're overriding
call edksetup.bat > nul
@echo off

:: Define platform specific environment variables.
set PLATFORM_PACKAGE=Vlv2TbltDevicePkg
set config_file=.\%PLATFORM_PACKAGE%\PlatformPkgConfig.dsc
set auto_config_inc=.\%PLATFORM_PACKAGE%\AutoPlatformCFG.txt

set EDK_SOURCE=%WORKSPACE%\EdkCompatibilityPkg

::create new AutoPlatformCFG.txt file
copy /y nul %auto_config_inc% >nul

::**********************************************************************
:: Parse command line arguments
::**********************************************************************

:: Optional arguments
:OptLoop
if /i "%~1"=="/?" goto Usage

if /i "%~1"=="/l" (
    set Build_Flags=%Build_Flags% -j EDK2.log
    shift
    goto OptLoop
)
if /i "%~1" == "/c" (
    echo Removing previous build files ...
    if exist build (
        del /f/s/q build > null
        rmdir /s/q build
    )
    if exist conf\.cache (
        del /f/s/q conf\.cache > null
        rmdir /s/q conf\.cache
    )
    echo.
    shift
    goto OptLoop
)

if /i "%~1"=="/x64" (
    set Arch=X64
    shift
    goto OptLoop
)
if /i "%~1"=="/IA32" (
    set Arch=IA32
    shift
    goto OptLoop
)

:: Required argument(s)
if "%~1"=="" goto Usage

::Remove the values for Platform_Type and Build_Target from BiosIdX.env and stage in Conf\
if "%Arch%"=="IA32" (
    findstr /b /v "BOARD_ID  BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdR.env > Conf\BiosId.env
    echo DEFINE X64_CONFIG = FALSE  >> %auto_config_inc%
) else if "%Arch%"=="X64" (
    findstr /b /v "BOARD_ID  BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdx64R.env > Conf\BiosId.env
    echo DEFINE X64_CONFIG = TRUE  >> %auto_config_inc%
)

:: -- Build flags settings for each Platform --
echo Setting  %1  platform configuration and BIOS ID...
if /i "%~1" == "MNW2" (
    echo BOARD_ID = MNW2MAX >> %Conf\BiosId.env
    echo DEFINE ENBDT_PF_BUILD = TRUE   >> %auto_config_inc%

) else (
    echo Error - Unsupported PlatformType: %1
    goto Usage
)
set Platform_Type=%~1

if /i "%~2" == "RELEASE" (
    set target=RELEASE
    echo BUILD_TYPE = R >> Conf\BiosId.env
) else (
    set target=DEBUG
    echo BUILD_TYPE = D >> Conf\BiosId.env
)

::**********************************************************************
:: Additional EDK Build Setup/Configuration
::**********************************************************************
echo.
echo Setting the Build environment for VS2008/VS2010/VS2012/VS2013...
if defined VS90COMNTOOLS (
   if not defined VSINSTALLDIR call "%VS90COMNTOOLS%\vsvars32.bat"
   if /I "%VS90COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\" (
      set TOOL_CHAIN_TAG=VS2008
   ) else (
      set TOOL_CHAIN_TAG=VS2008x86
   )
 ) else if defined VS100COMNTOOLS (
  if not defined VSINSTALLDIR call "%VS100COMNTOOLS%\vsvars32.bat"
  if /I "%VS100COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\" (
    set TOOL_CHAIN_TAG=VS2010
  ) else (
    set TOOL_CHAIN_TAG=VS2010x86
  )
) else if defined VS110COMNTOOLS (
  if not defined VSINSTALLDIR call "%VS110COMNTOOLS%\vsvars32.bat"
  if /I "%VS110COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 11.0\Common7\Tools\" (
    set TOOL_CHAIN_TAG=VS2012
  ) else (
    set TOOL_CHAIN_TAG=VS2012x86
  )
) else if defined VS120COMNTOOLS (
  if not defined VSINSTALLDIR call "%VS120COMNTOOLS%\vsvars32.bat"
  if /I "%VS120COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 12.0\Common7\Tools\" (
    set TOOL_CHAIN_TAG=VS2013
  ) else (
    set TOOL_CHAIN_TAG=VS2013x86
  )
) else (
  echo  --ERROR: VS2008/VS2010/VS2012/VS2013 not installed correctly. VS90COMNTOOLS/VS100COMNTOOLS/VS110COMNTOOLS/VS120COMNTOOLS not defined ^^!
  echo.
  goto :BldFail
)

echo Ensuring correct build directory is present for GenBiosId...
set BUILD_PATH=Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%

echo Modifing Conf files for this build...
:: Remove lines with these tags from target.txt
findstr /V "TARGET  TARGET_ARCH  TOOL_CHAIN_TAG  BUILD_RULE_CONF  ACTIVE_PLATFORM  MAX_CONCURRENT_THREAD_NUMBER" Conf\target.txt > Conf\target.txt.tmp

echo TARGET          = %TARGET%                                  >> Conf\target.txt.tmp
if "%Arch%"=="IA32" (
    echo TARGET_ARCH = IA32                                      >> Conf\target.txt.tmp
) else if "%Arch%"=="X64" (
    echo TARGET_ARCH = IA32 X64                                  >> Conf\target.txt.tmp
)
echo TOOL_CHAIN_TAG  = %TOOL_CHAIN_TAG%                                  >> Conf\target.txt.tmp
echo BUILD_RULE_CONF = Conf/build_rule.txt                               >> Conf\target.txt.tmp
if %Source% == 0 (
  echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%.dsc        >> Conf\target.txt.tmp
) else (
  echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%Source.dsc  >> Conf\target.txt.tmp
)
echo MAX_CONCURRENT_THREAD_NUMBER = %build_threads%                      >> Conf\target.txt.tmp

move /Y Conf\target.txt.tmp Conf\target.txt >nul

::**********************************************************************
:: Build BIOS
::**********************************************************************

echo Creating BiosId...
pushd %PLATFORM_PACKAGE%
if not exist ..\%BUILD_PATH%\IA32  mkdir ..\%BUILD_PATH%\IA32
  GenBiosId.exe -i ..\Conf\BiosId.env -o ..\%BUILD_PATH%\IA32\BiosId.bin -ob ..\Conf\BiosId.bat
if "%Arch%"=="X64" (
   if not exist ..\%BUILD_PATH%\X64  mkdir ..\%BUILD_PATH%\X64
   GenBiosId.exe -i ..\Conf\BiosId.env -o ..\%BUILD_PATH%\X64\BiosId.bin -ob ..\Conf\BiosId.bat
)
popd

if %ERRORLEVEL% NEQ 0 goto BldFail

echo.
echo Invoking EDK2 build...
build %Build_Flags%

if %ERRORLEVEL% NEQ 0 goto BldFail

::**********************************************************************
:: Post Build processing and cleanup
::**********************************************************************

echo Running fce...

pushd %PLATFORM_PACKAGE%
:: Extract Hii data from build and store in HiiDefaultData.txt
fce read -i ..\%BUILD_PATH%\FV\Vlv.fd > ..\%BUILD_PATH%\FV\HiiDefaultData.txt

:: save changes to VlvXXX.fd
fce update -i ..\%BUILD_PATH%\FV\Vlv.fd -s ..\%BUILD_PATH%\FV\HiiDefaultData.txt -o ..\%BUILD_PATH%\FV\Vlv%Arch%.fd

popd

if %ERRORLEVEL% NEQ 0 goto BldFail
::echo FD successfully updated with default Hii values.

:: Set the Board_Id, Build_Type, Version_Major, and Version_Minor environment variables
find /v "#" Conf\BiosId.env > ver_strings
for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j
del /f/q ver_strings >nul

set BIOS_Name=%BOARD_ID%_%Arch%_%BUILD_TYPE%_%VERSION_MAJOR%_%VERSION_MINOR%.ROM
copy /y/b %BUILD_PATH%\FV\Vlv%Arch%.fd  %WORKSPACE%\%BIOS_Name% >nul

echo.
echo Build location:     %BUILD_PATH%
echo BIOS ROM Created:   %BIOS_Name%
echo.
echo -------------------- The EDKII BIOS build has successfully completed. --------------------
echo.
goto Exit

:Usage
echo.
echo ***************************************************************************
echo Build BIOS rom for VLV platforms.
echo.
echo Usage: bld_vlv.bat [options] PlatformType [Build Target]
echo.
echo    /c    CleanAll before building
echo    /IA32 Set Arch to IA32 (default: X64)
echo    /X64  Set Arch to X64 (default: X64)
echo.
echo        Platform Types:  MNW2
echo        Build Targets:   Debug, Release  (default: Debug)
echo.
echo Examples:
echo    bld_vlv.bat MNW2                 : X64 Debug build for MinnowMax
echo    bld_vlv.bat /IA32 MNW2 release   : IA32 Release build for MinnowMax
echo.
echo ***************************************************************************
set exitCode=1
goto Exit

:BldFail
set exitCode=1
echo  -- Error:  EDKII BIOS Build has failed!
echo See EDK2.log for more details

:Exit
echo %date%  %time%
exit /b %exitCode%

EndLocal

@REM @file
@REM   Windows batch file to build BIOS ROM
@REM
@REM Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
@REM This program and the accompanying materials
@REM are licensed and made available under the terms and conditions of the BSD License
@REM which accompanies this distribution.  The full text of the license may be found at
@REM http://opensource.org/licenses/bsd-license.php
@REM
@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@REM

@echo off
setlocal EnableDelayedExpansion EnableExtensions
echo.
echo %date%  %time%
echo.

::**********************************************************************
:: Initial Setup
::**********************************************************************
set WORKSPACE=%CD%
if %WORKSPACE:~-1%==\ set WORKSPACE=%WORKSPACE:~0,-1%
set /a build_threads=1
set "Build_Flags= "
set exitCode=0
set Arch=X64
set Source=0

:: Clean up previous build files.
if exist %WORKSPACE%\edk2.log del %WORKSPACE%\edk2.log
if exist %WORKSPACE%\unitool.log del %WORKSPACE%\unitool.log
if exist %WORKSPACE%\Conf\target.txt del %WORKSPACE%\Conf\target.txt
if exist %WORKSPACE%\Conf\tools_def.txt del %WORKSPACE%\Conf\tools_def.txt
if exist %WORKSPACE%\Conf\build_rule.txt del %WORKSPACE%\Conf\build_rule.txt
if exist %WORKSPACE%\Conf\FrameworkDatabase.db del %WORKSPACE%\Conf\FrameworkDatabase.db
if exist conf\.cache rmdir /q/s conf\.cache

:: Setup EDK environment. Edksetup puts new copies of target.txt, tools_def.txt, build_rule.txt in WorkSpace\Conf
:: Also run edksetup as soon as possible to avoid it from changing environment variables we're overriding
call edksetup.bat > nul
@echo off

:: Define platform specific environment variables.
set PLATFORM_PACKAGE=Vlv2TbltDevicePkg
set config_file=.\%PLATFORM_PACKAGE%\PlatformPkgConfig.dsc
set auto_config_inc=.\%PLATFORM_PACKAGE%\AutoPlatformCFG.txt

set EDK_SOURCE=%WORKSPACE%\EdkCompatibilityPkg

::create new AutoPlatformCFG.txt file
copy /y nul %auto_config_inc% >nul

::**********************************************************************
:: Parse command line arguments
::**********************************************************************

:: Optional arguments
:OptLoop
if /i "%~1"=="/?" goto Usage

if /i "%~1"=="/l" (
    set Build_Flags=%Build_Flags% -j EDK2.log
    shift
    goto OptLoop
)
if /i "%~1" == "/c" (
    echo Removing previous build files ...
    if exist build (
        del /f/s/q build > null
        rmdir /s/q build
    )
    if exist conf\.cache (
        del /f/s/q conf\.cache > null
        rmdir /s/q conf\.cache
    )
    echo.
    shift
    goto OptLoop
)

if /i "%~1"=="/x64" (
    set Arch=X64
    shift
    goto OptLoop
)
if /i "%~1"=="/IA32" (
    set Arch=IA32
    shift
    goto OptLoop
)

:: Required argument(s)
if "%~1"=="" goto Usage

::Remove the values for Platform_Type and Build_Target from BiosIdX.env and stage in Conf\
if "%Arch%"=="IA32" (
    findstr /b /v "BOARD_ID  BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdR.env > Conf\BiosId.env
    echo DEFINE X64_CONFIG = FALSE  >> %auto_config_inc%
) else if "%Arch%"=="X64" (
    findstr /b /v "BOARD_ID  BUILD_TYPE" %PLATFORM_PACKAGE%\BiosIdx64R.env > Conf\BiosId.env
    echo DEFINE X64_CONFIG = TRUE  >> %auto_config_inc%
)

:: -- Build flags settings for each Platform --
echo Setting  %1  platform configuration and BIOS ID...
if /i "%~1" == "MNW2" (
    echo BOARD_ID = MNW2MAX >> %Conf\BiosId.env
    echo DEFINE ENBDT_PF_BUILD = TRUE   >> %auto_config_inc%

) else (
    echo Error - Unsupported PlatformType: %1
    goto Usage
)
set Platform_Type=%~1

if /i "%~2" == "RELEASE" (
    set target=RELEASE
    echo BUILD_TYPE = R >> Conf\BiosId.env
) else (
    set target=DEBUG
    echo BUILD_TYPE = D >> Conf\BiosId.env
)

::**********************************************************************
:: Additional EDK Build Setup/Configuration
::**********************************************************************
echo.
echo Setting the Build environment for VS2008/VS2010/VS2012/VS2013...
if defined VS90COMNTOOLS (
   if not defined VSINSTALLDIR call "%VS90COMNTOOLS%\vsvars32.bat"
   if /I "%VS90COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\" (
      set TOOL_CHAIN_TAG=VS2008
   ) else (
      set TOOL_CHAIN_TAG=VS2008x86
   )
 ) else if defined VS100COMNTOOLS (
  if not defined VSINSTALLDIR call "%VS100COMNTOOLS%\vsvars32.bat"
  if /I "%VS100COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\" (
    set TOOL_CHAIN_TAG=VS2010
  ) else (
    set TOOL_CHAIN_TAG=VS2010x86
  )
) else if defined VS110COMNTOOLS (
  if not defined VSINSTALLDIR call "%VS110COMNTOOLS%\vsvars32.bat"
  if /I "%VS110COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 11.0\Common7\Tools\" (
    set TOOL_CHAIN_TAG=VS2012
  ) else (
    set TOOL_CHAIN_TAG=VS2012x86
  )
) else if defined VS120COMNTOOLS (
  if not defined VSINSTALLDIR call "%VS120COMNTOOLS%\vsvars32.bat"
  if /I "%VS120COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 12.0\Common7\Tools\" (
    set TOOL_CHAIN_TAG=VS2013
  ) else (
    set TOOL_CHAIN_TAG=VS2013x86
  )
) else (
  echo  --ERROR: VS2008/VS2010/VS2012/VS2013 not installed correctly. VS90COMNTOOLS/VS100COMNTOOLS/VS110COMNTOOLS/VS120COMNTOOLS not defined ^^!
  echo.
  goto :BldFail
)

echo Ensuring correct build directory is present for GenBiosId...
set BUILD_PATH=Build\%PLATFORM_PACKAGE%\%TARGET%_%TOOL_CHAIN_TAG%

echo Modifing Conf files for this build...
:: Remove lines with these tags from target.txt
findstr /V "TARGET  TARGET_ARCH  TOOL_CHAIN_TAG  BUILD_RULE_CONF  ACTIVE_PLATFORM  MAX_CONCURRENT_THREAD_NUMBER" Conf\target.txt > Conf\target.txt.tmp

echo TARGET          = %TARGET%                                  >> Conf\target.txt.tmp
if "%Arch%"=="IA32" (
    echo TARGET_ARCH = IA32                                      >> Conf\target.txt.tmp
) else if "%Arch%"=="X64" (
    echo TARGET_ARCH = IA32 X64                                  >> Conf\target.txt.tmp
)
echo TOOL_CHAIN_TAG  = %TOOL_CHAIN_TAG%                                  >> Conf\target.txt.tmp
echo BUILD_RULE_CONF = Conf/build_rule.txt                               >> Conf\target.txt.tmp
if %Source% == 0 (
  echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%.dsc        >> Conf\target.txt.tmp
) else (
  echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%Source.dsc  >> Conf\target.txt.tmp
)
echo MAX_CONCURRENT_THREAD_NUMBER = %build_threads%                      >> Conf\target.txt.tmp

move /Y Conf\target.txt.tmp Conf\target.txt >nul

::**********************************************************************
:: Build BIOS
::**********************************************************************

echo Creating BiosId...
pushd %PLATFORM_PACKAGE%
if not exist ..\%BUILD_PATH%\IA32  mkdir ..\%BUILD_PATH%\IA32
  GenBiosId.exe -i ..\Conf\BiosId.env -o ..\%BUILD_PATH%\IA32\BiosId.bin -ob ..\Conf\BiosId.bat
if "%Arch%"=="X64" (
   if not exist ..\%BUILD_PATH%\X64  mkdir ..\%BUILD_PATH%\X64
   GenBiosId.exe -i ..\Conf\BiosId.env -o ..\%BUILD_PATH%\X64\BiosId.bin -ob ..\Conf\BiosId.bat
)
popd

if %ERRORLEVEL% NEQ 0 goto BldFail

echo.
echo Invoking EDK2 build...
build %Build_Flags%

if %ERRORLEVEL% NEQ 0 goto BldFail

::**********************************************************************
:: Post Build processing and cleanup
::**********************************************************************

echo Running fce...

pushd %PLATFORM_PACKAGE%
:: Extract Hii data from build and store in HiiDefaultData.txt
fce read -i ..\%BUILD_PATH%\FV\Vlv.fd > ..\%BUILD_PATH%\FV\HiiDefaultData.txt

:: save changes to VlvXXX.fd
fce update -i ..\%BUILD_PATH%\FV\Vlv.fd -s ..\%BUILD_PATH%\FV\HiiDefaultData.txt -o ..\%BUILD_PATH%\FV\Vlv%Arch%.fd

popd

if %ERRORLEVEL% NEQ 0 goto BldFail
::echo FD successfully updated with default Hii values.

:: Set the Board_Id, Build_Type, Version_Major, and Version_Minor environment variables
find /v "#" Conf\BiosId.env > ver_strings
for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j
del /f/q ver_strings >nul

set BIOS_Name=%BOARD_ID%_%Arch%_%BUILD_TYPE%_%VERSION_MAJOR%_%VERSION_MINOR%.ROM
copy /y/b %BUILD_PATH%\FV\Vlv%Arch%.fd  %WORKSPACE%\%BIOS_Name% >nul
copy /y/b %BUILD_PATH%\FV\Vlv%Arch%.fd  %BUILD_PATH%\FV\Vlv.ROM >nul

echo.
echo Build location:     %BUILD_PATH%
echo BIOS ROM Created:   %BIOS_Name%
echo.
echo -------------------- The EDKII BIOS build has successfully completed. --------------------
echo.

@REM build capsule here
if "%openssl_path%" == "" goto Exit
echo > %BUILD_PATH%\FV\SYSTEMFIRMWAREUPDATECARGO.Fv
build -p %PLATFORM_PACKAGE%\PlatformCapsule.dsc

goto Exit

:Usage
echo.
echo ***************************************************************************
echo Build BIOS rom for VLV platforms.
echo.
echo Usage: bld_vlv.bat [options] PlatformType [Build Target]
echo.
echo    /c    CleanAll before building
echo    /IA32 Set Arch to IA32 (default: X64)
echo    /X64  Set Arch to X64 (default: X64)
echo.
echo        Platform Types:  MNW2
echo        Build Targets:   Debug, Release  (default: Debug)
echo.
echo Examples:
echo    bld_vlv.bat MNW2                 : X64 Debug build for MinnowMax
echo    bld_vlv.bat /IA32 MNW2 release   : IA32 Release build for MinnowMax
echo.
echo ***************************************************************************
set exitCode=1
goto Exit

:BldFail
set exitCode=1
echo  -- Error:  EDKII BIOS Build has failed!
echo See EDK2.log for more details

:Exit
echo %date%  %time%
exit /b %exitCode%

EndLocal

add capsule generation in bat.

Vlv2TbltDevicePkg/bat: add capsule generation in bat.

If OPENSSL_PATH is set, the build process generates capsule.

Cc: David Wei <b5f26b2a2cdf37ab487a7004176f1783629975b0@intel.com>
Cc: Feng Tian <e66bb7e9f36c82a029035c5885acf75500d07e68@intel.com>
Cc: Star Zeng <5c6bb72efe464613af94e84c05522a361b23844a@intel.com>
Cc: Michael D Kinney <fd20bc543a9f65bb633fac7d08a403c1f1c8eb6c@intel.com>
Cc: Liming Gao <6480311aeeb4b006862f6d13ebabddc03f51e507@intel.com>
Cc: Chao Zhang <fed49a7a524fbe970930fd44cd2de5a9d4952d81@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <364a90bfebd1f362ebb7b48e4bf8ec010adef203@intel.com>
Reviewed-by: David Wei <b5f26b2a2cdf37ab487a7004176f1783629975b0@intel.com>


@ECHO OFF
cd target
rem copy build-rmwebdemo-4.0.0.jar...
rem copy build-rmwebdemo-4.0.0.jar build-rmwebdemo-4.0.0-bin\build-rmwebdemo-4.0.0
cd build-rmwebdemo-4.0.0-bin\build-rmwebdemo-4.0.0
rem call :extractJar build-rmwebdemo-4.0.0

rem copy quickbundle-rmwebdemo...
xcopy /e/y/i ..\..\..\..\..\quickbundle-rmwebdemo quickbundle-rmwebdemo
cd quickbundle-rmwebdemo
call mvn clean
cd ..

rem extract plugin jars...
call :extractJar org.quickbundle.mda.gc-4.0.0
call :extractJar org.quickbundle.mda.gp-4.0.0
call :extractJar org.quickbundle.mda.libs-4.0.0
call :extractJar org.quickbundle.mda.mvm-4.0.0

rem move quickbundle-rmwebdemo...
move quickbundle-rmwebdemo org.quickbundle.mda.gp-4.0.0\t\j1

cd ..\..\
move build-rmwebdemo-4.0.0-bin eclipse
cd eclipse
move build-rmwebdemo-4.0.0 plugins

goto :EOF

:extractJar
setlocal
echo extracting %1
mkdir %1
cd %1
call jar xf ../%1.jar
cd ..
del %1.jar
endlocal&goto :EOF

:packageJar
setlocal
echo packeging %1
cd %1
call jar cf %1.jar *
move %1.jar ..
cd ..
rd /s/q %1
endlocal&goto :EOF

:packageJar1
setlocal
echo packeging %1

call jar uf %1.jar df org com

cd ..
rem rd /s/q %1
endlocal&goto :EOF

@ECHO OFF
cd target
echo copy build-rmwebdemo-4.0.0.jar...
rem copy build-rmwebdemo-4.0.0.jar build-rmwebdemo-4.0.0-bin\build-rmwebdemo-4.0.0
cd build-rmwebdemo-4.0.0-bin\build-rmwebdemo-4.0.0
rem call :extractJar build-rmwebdemo-4.0.0

echo copy quickbundle-rmwebdemo...
rem call xcopy /e/y/i/q ..\..\..\..\..\quickbundle-rmwebdemo quickbundle-rmwebdemo
cd ..\..\..\..\..\
call jar cfM build/build-rmwebdemo/target/build-rmwebdemo-4.0.0-bin/build-rmwebdemo-4.0.0/quickbundle-rmwebdemo.jar quickbundle-rmwebdemo
cd build\build-rmwebdemo\target\build-rmwebdemo-4.0.0-bin\build-rmwebdemo-4.0.0
call jar xfM ./quickbundle-rmwebdemo.jar
call del quickbundle-rmwebdemo.jar

cd quickbundle-rmwebdemo
call mvn clean
cd ..

echo extract plugin jars...
call :extractJar org.quickbundle.mda.gc-4.0.0
call :extractJar org.quickbundle.mda.gp-4.0.0
call :extractJar org.quickbundle.mda.libs-4.0.0
call :extractJar org.quickbundle.mda.mvm-4.0.0

echo move quickbundle-rmwebdemo...
move quickbundle-rmwebdemo org.quickbundle.mda.gp-4.0.0\t\j1

cd ..\..\
move build-rmwebdemo-4.0.0-bin eclipse
cd eclipse
move build-rmwebdemo-4.0.0 plugins

goto :EOF

:extractJar
setlocal
echo extracting %1
mkdir %1
cd %1
call jar xf ../%1.jar
cd ..
del %1.jar
endlocal&goto :EOF

:packageJar
setlocal
echo packeging %1
cd %1
call jar cf %1.jar *
move %1.jar ..
cd ..
rd /s/q %1
endlocal&goto :EOF

:packageJar1
setlocal
echo packeging %1

call jar uf %1.jar df org com

cd ..
rem rd /s/q %1
endlocal&goto :EOF

build rmwebdemo

build rmwebdemo


@ECHO OFF
SETLOCAL EnableDelayedExpansion

SET UPSTREAMURL=https://github.com/ShiftMediaProject
SET DEPENDENCIES=( ^
freetype2, ^
fontconfig, ^
fribidi, ^
harfbuzz, ^
libiconv ^
)

REM Get passed in list of dependencies to skip
SET PASSDEPENDENCIES=%~1

REM Check if git is installed and available
IF "%MSVC_VER%"=="" (
    git status >NUL 2>&1
    IF %ERRORLEVEL% NEQ 0 (
      ECHO A working copy of git was not found. To use this script you must first install git for windows.
      EXIT /B 1
    )
)

REM Store current directory and ensure working directory is the location of current .bat
SET CURRDIR=%CD%
cd %~dp0

cd ..\..
FOR %%I IN %DEPENDENCIES% DO (
    ECHO !PASSDEPENDENCIES! | FINDSTR /C:"%%I" >NUL 2>&1 || (
        REM Check if MSVC_VER environment variable is set
        IF "%MSVC_VER%"=="" (
            CALL :cloneOrUpdateRepo "%%I"
        ) ELSE (
            CALL :downloadLibs "%%I"
        )
    )
)
cd %CURRDIR% >NUL
GOTO exit

REM Function to clone or update a repo
REM  cloneOrUpdateRepo: RepoName
REM    RepoName = Name of the repository
:cloneOrUpdateRepo
SET REPONAME=%~1
REM Check if the repo folder already exists
IF EXIST "%REPONAME%" (
    ECHO %REPONAME%: Existing folder found. Checking for updates...
    cd %REPONAME%
    REM Check if any updates are available
    FOR /f %%J IN ('git rev-parse HEAD') do set CURRHEAD=%%J
    FOR /f %%J IN ('git ls-remote origin HEAD') do set ORIGHEAD=%%J
    IF "!CURRHEAD!"=="!ORIGHEAD!" (
        ECHO %REPONAME%: Repository up to date.
    ) ELSE (
        REM Stash any uncommited changes then update from origin
        ECHO %REPONAME%: Updates available. Updating repository...
        git checkout master --quiet
        git stash --quiet
        git pull origin master --quiet -ff
        git stash pop --quiet
    )
    cd ..\
) ELSE (
    ECHO %REPONAME%: Existing folder not found. Cloning repository...
    REM Clone from the origin repo
    SET REPOURL=%UPSTREAMURL%/%REPONAME%.git
    git clone !REPOURL! --quiet
    REM Initialise autocrlf options to fix cross platform interoperation
    REM  Once updated the repo needs to be reset to correct the local line endings
    cd %REPONAME%
    git config --local core.autocrlf false
    git rm --cached -r . --quiet
    git reset --hard --quiet
    cd ..\
)
REM Add current repo to list of already passed dependencies
SET PASSDEPENDENCIES=%PASSDEPENDENCIES% %REPONAME%
REM Check if the repo itself has required dependencies
IF EXIST "%REPONAME%\SMP\project_get_dependencies.bat" (
    ECHO %REPONAME%: Found additional dependencies...
    ECHO.
    cd %REPONAME%\SMP
    project_get_dependencies.bat "!PASSDEPENDENCIES!" || GOTO exitOnError
    cd ..\..
)
ECHO.
EXIT /B %ERRORLEVEL%

REM Function to download existing prebuilt libraries
REM  downloadLibs: RepoName
REM    RepoName = Name of the repository
:downloadLibs
SET REPONAME=%~1
REM Get latest release
ECHO %REPONAME%: Getting latest release...
SET UPSTREAMAPIURL=%UPSTREAMURL:github.com=api.github.com/repos%
powershell -nologo -noprofile -command "try { Invoke-RestMethod -Uri %UPSTREAMAPIURL%/%REPONAME%/releases/latest > latest.json } catch {exit 1}"
IF NOT %ERRORLEVEL% == 0 ( ECHO Failed getting latest %REPONAME% release & GOTO exitOnError )
REM Get tag for latest release
FOR /F "tokens=* USEBACKQ" %%F IN (`TYPE latest.json ^| FINDSTR /B "tag_name"`) DO SET TAG=%%F
FOR /F "tokens=2 delims=: " %%F in ("%TAG%") DO SET TAG=%%F
IF "%TAG%"=="" ( ECHO Failed getting latest %REPONAME% release tag information & GOTO exitOnError )
REM Get download name of latest release
FOR /F "tokens=* USEBACKQ" %%F IN (`TYPE latest.json ^| FINDSTR "name="`) DO SET LIBNAME=%%F
SET LIBNAME=%LIBNAME:*name=%
FOR /F "tokens=1 delims=_" %%F in ("%LIBNAME:~1%") DO SET LIBNAME=%%F
IF "%LIBNAME%"=="" ( ECHO Failed getting latest %REPONAME% release name information & GOTO exitOnError )
DEL /F /Q latest.json
REM Get the download location for the required tag
SET TAG2=%TAG:+=.%
SET DLURL=%UPSTREAMURL%/%REPONAME%/releases/download/%TAG%/%LIBNAME%_%TAG2%_msvc%MSVC_VER%.zip
REM Download a pre-built archive and extract
ECHO %REPONAME%: Downloading %LIBNAME%_%TAG%_msvc%MSVC_VER%.zip...
SET PREBUILTDIR=prebuilt
MKDIR %PREBUILTDIR% >NUL 2>&1
powershell -nologo -noprofile -command "try { (New-Object Net.WebClient).DownloadFile('%DLURL%', '%PREBUILTDIR%\temp.zip') } catch {exit 1}"
IF NOT %ERRORLEVEL% == 0 ( ECHO Failed downloading %DLURL% & GOTO exitOnError )
powershell -nologo -noprofile -command "try { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory('%PREBUILTDIR%\temp.zip', '%PREBUILTDIR%'); } catch [System.IO.IOException] {exit 0} catch {exit 1}"
IF NOT %ERRORLEVEL% == 0 ( ECHO Failed extracting downloaded archive & GOTO exitOnError )
DEL /F /Q %PREBUILTDIR%\\temp.zip
ECHO.
EXIT /B %ERRORLEVEL%

:exitOnError
cd %CURRDIR%

:exit
REM Directly exit if an AppVeyor build
IF NOT "%APPVEYOR%"=="" (
    GOTO return
)
REM Return the passed dependency list
(
    ENDLOCAL
    SET PASSDEPENDENCIES=%PASSDEPENDENCIES%
)

REM Check if this was launched from an existing terminal or directly from .bat
REM  If launched by executing the .bat then pause on completion
ECHO %CMDCMDLINE% | FINDSTR /L %COMSPEC% >NUL 2>&1
IF %ERRORLEVEL% == 0 IF "%~1"=="" PAUSE

:return
EXIT /B 0

@ECHO OFF
SETLOCAL EnableDelayedExpansion

SET UPSTREAMURL=https://github.com/ShiftMediaProject
SET DEPENDENCIES=( ^
freetype2, ^
fontconfig, ^
fribidi, ^
harfbuzz, ^
libiconv ^
)

REM Get passed in list of dependencies to skip
SET PASSDEPENDENCIES=%~1

REM Check if git is installed and available
IF "%MSVC_VER%"=="" (
    git status >NUL 2>&1
    IF %ERRORLEVEL% NEQ 0 (
      ECHO A working copy of git was not found. To use this script you must first install git for windows.
      EXIT /B 1
    )
)

REM Store current directory and ensure working directory is the location of current .bat
SET CURRDIR=%CD%
cd %~dp0

REM Initialise error check value
SET ERROR=0

cd ..\..
FOR %%I IN %DEPENDENCIES% DO (
    ECHO !PASSDEPENDENCIES! | FINDSTR /C:"%%I" >NUL 2>&1 || (
        REM Check if MSVC_VER environment variable is set
        IF "%MSVC_VER%"=="" (
            CALL :cloneOrUpdateRepo "%%I" || GOTO exit
        ) ELSE (
            CALL :downloadLibs "%%I" || GOTO exit
        )
    )
)
cd %CURRDIR% >NUL
GOTO exit

REM Function to clone or update a repo
REM  cloneOrUpdateRepo: RepoName
REM    RepoName = Name of the repository
:cloneOrUpdateRepo
SET REPONAME=%~1
REM Check if the repo folder already exists
IF EXIST "%REPONAME%" (
    ECHO %REPONAME%: Existing folder found. Checking for updates...
    cd %REPONAME%
    REM Check if any updates are available
    FOR /f %%J IN ('git rev-parse HEAD') do set CURRHEAD=%%J
    FOR /f %%J IN ('git ls-remote origin HEAD') do set ORIGHEAD=%%J
    IF "!CURRHEAD!"=="!ORIGHEAD!" (
        ECHO %REPONAME%: Repository up to date.
    ) ELSE (
        REM Stash any uncommited changes then update from origin
        ECHO %REPONAME%: Updates available. Updating repository...
        git checkout master --quiet
        git stash --quiet
        git pull origin master --quiet -ff
        git stash pop --quiet
    )
    cd ..\
) ELSE (
    ECHO %REPONAME%: Existing folder not found. Cloning repository...
    REM Clone from the origin repo
    SET REPOURL=%UPSTREAMURL%/%REPONAME%.git
    git clone !REPOURL! --quiet
    REM Initialise autocrlf options to fix cross platform interoperation
    REM  Once updated the repo needs to be reset to correct the local line endings
    cd %REPONAME%
    git config --local core.autocrlf false
    git rm --cached -r . --quiet
    git reset --hard --quiet
    cd ..\
)
REM Add current repo to list of already passed dependencies
SET PASSDEPENDENCIES=%PASSDEPENDENCIES% %REPONAME%
REM Check if the repo itself has required dependencies
IF EXIST "%REPONAME%\SMP\project_get_dependencies.bat" (
    ECHO %REPONAME%: Found additional dependencies...
    ECHO.
    cd %REPONAME%\SMP
    project_get_dependencies.bat "!PASSDEPENDENCIES!" || EXIT /B 1
    cd ..\..
)
ECHO.
EXIT /B %ERRORLEVEL%

REM Function to download existing prebuilt libraries
REM  downloadLibs: RepoName
REM    RepoName = Name of the repository
:downloadLibs
SET REPONAME=%~1
REM Get latest release
ECHO %REPONAME%: Getting latest release...
SET UPSTREAMAPIURL=%UPSTREAMURL:github.com=api.github.com/repos%
powershell -nologo -noprofile -command "try { Invoke-RestMethod -Uri %UPSTREAMAPIURL%/%REPONAME%/releases/latest > latest.json } catch {exit 1}"
IF NOT %ERRORLEVEL% == 0 ( ECHO Failed getting latest %REPONAME% release & EXIT /B 1 )
REM Get tag for latest release
FOR /F "tokens=* USEBACKQ" %%F IN (`TYPE latest.json ^| FINDSTR /B "tag_name"`) DO SET TAG=%%F
FOR /F "tokens=2 delims=: " %%F in ("%TAG%") DO SET TAG=%%F
IF "%TAG%"=="" ( ECHO Failed getting latest %REPONAME% release tag information & EXIT /B 1 )
REM Get download name of latest release
FOR /F "tokens=* USEBACKQ" %%F IN (`TYPE latest.json ^| FINDSTR "name="`) DO SET LIBNAME=%%F
SET LIBNAME=%LIBNAME:*name=%
FOR /F "tokens=1 delims=_" %%F in ("%LIBNAME:~1%") DO SET LIBNAME=%%F
IF "%LIBNAME%"=="" ( ECHO Failed getting latest %REPONAME% release name information & EXIT /B 1 )
DEL /F /Q latest.json
REM Get the download location for the required tag
SET TAG2=%TAG:+=.%
SET DLURL=%UPSTREAMURL%/%REPONAME%/releases/download/%TAG%/%LIBNAME%_%TAG2%_msvc%MSVC_VER%.zip
REM Download a pre-built archive and extract
ECHO %REPONAME%: Downloading %LIBNAME%_%TAG%_msvc%MSVC_VER%.zip...
SET PREBUILTDIR=prebuilt
MKDIR %PREBUILTDIR% >NUL 2>&1
powershell -nologo -noprofile -command "try { (New-Object Net.WebClient).DownloadFile('%DLURL%', '%PREBUILTDIR%\temp.zip') } catch {exit 1}"
IF NOT %ERRORLEVEL% == 0 ( ECHO Failed downloading %DLURL% & EXIT /B 1 )
powershell -nologo -noprofile -command "Add-Type -AssemblyName System.IO.Compression.FileSystem; $zip=[System.IO.Compression.ZipFile]::OpenRead('%PREBUILTDIR%\temp.zip'); foreach ($item in $zip.Entries) { try {$file=(Join-Path -Path .\%PREBUILTDIR% -ChildPath $item.FullName); $null=[System.IO.Directory]::CreateDirectory((Split-Path -Path $file)); [System.IO.Compression.ZipFileExtensions]::ExtractToFile($item,$file,$true)} catch {exit 1} }"
IF NOT %ERRORLEVEL% == 0 ( ECHO Failed extracting downloaded archive & EXIT /B 1 )
DEL /F /Q %PREBUILTDIR%\\temp.zip
ECHO.
EXIT /B %ERRORLEVEL%

:exitOnError
cd %CURRDIR%
SET ERROR=1

:exit
REM Directly exit if an AppVeyor build
IF NOT "%APPVEYOR%"=="" (
    GOTO return
)
REM Return the passed dependency list
(
    ENDLOCAL
    SET PASSDEPENDENCIES=%PASSDEPENDENCIES%
)

REM Check if this was launched from an existing terminal or directly from .bat
REM  If launched by executing the .bat then pause on completion
ECHO %CMDCMDLINE% | FINDSTR /L %COMSPEC% >NUL 2>&1
IF %ERRORLEVEL% == 0 IF "%~1"=="" PAUSE

:return
EXIT /B %ERROR%

projects: Update get deps batch file with additional error checking.


Create bld.bat

Create bld.bat


@echo off

REM This file is part of the DITA Open Toolkit project.
REM See the accompanying license.txt file for applicable licenses.

REM Derived from Apache Ant command line tool.

REM  Licensed to the Apache Software Foundation (ASF) under one or more
REM  contributor license agreements.  See the NOTICE file distributed with
REM  this work for additional information regarding copyright ownership.
REM  The ASF licenses this file to You under the Apache License, Version 2.0
REM  (the "License"); you may not use this file except in compliance with
REM  the License.  You may obtain a copy of the License at
REM
REM      http://www.apache.org/licenses/LICENSE-2.0
REM
REM  Unless required by applicable law or agreed to in writing, software
REM  distributed under the License is distributed on an "AS IS" BASIS,
REM  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM  See the License for the specific language governing permissions and
REM  limitations under the License.

if "%HOME%"=="" goto homeDrivePathPre
if exist "%HOME%\antrc_pre.bat" call "%HOME%\antrc_pre.bat"

:homeDrivePathPre
if "%HOMEDRIVE%%HOMEPATH%"=="" goto userProfilePre
if "%HOMEDRIVE%%HOMEPATH%"=="%HOME%" goto userProfilePre
if exist "%HOMEDRIVE%%HOMEPATH%\antrc_pre.bat" call "%HOMEDRIVE%%HOMEPATH%\antrc_pre.bat"

:userProfilePre
if "%USERPROFILE%"=="" goto alpha
if "%USERPROFILE%"=="%HOME%" goto alpha
if "%USERPROFILE%"=="%HOMEDRIVE%%HOMEPATH%" goto alpha
if exist "%USERPROFILE%\antrc_pre.bat" call "%USERPROFILE%\antrc_pre.bat"

:alpha

if "%OS%"=="Windows_NT" @setlocal
if "%OS%"=="WINNT" @setlocal

if "%DITA_HOME%"=="" goto setDefaultAntHome

:stripAntHome
if not _%DITA_HOME:~-1%==_\ goto checkClasspath
set DITA_HOME=%DITA_HOME:~0,-1%
goto stripAntHome

:setDefaultAntHome
rem %~dp0 is expanded pathname of the current script under NT
set DITA_HOME=%~dp0..

:checkClasspath
set _USE_CLASSPATH=yes
rem CLASSPATH must not be used if it is equal to ""
if "%CLASSPATH%"=="""" set _USE_CLASSPATH=no
if "%CLASSPATH%"=="" set _USE_CLASSPATH=no

rem Slurp the command line arguments. This loop allows for an unlimited number
rem of arguments (up to the command line limit, anyway).
set DITA_CMD_LINE_ARGS=
:setupArgs
if ""%1""=="""" goto doneStart
if ""%1""==""-noclasspath"" goto clearclasspath
set DITA_CMD_LINE_ARGS=%DITA_CMD_LINE_ARGS% %1
shift
goto setupArgs

rem here is there is a -noclasspath in the options
:clearclasspath
set _USE_CLASSPATH=no
shift
goto setupArgs

rem This label provides a place for the argument list loop to break out
rem and for NT handling to skip to.

:doneStart

if "%_USE_CLASSPATH%"=="no" goto findDitaHome

:stripClasspath
if not _%CLASSPATH:~-1%==_\ goto findDitaHome
set CLASSPATH=%CLASSPATH:~0,-1%
goto stripClasspath

:findDitaHome
rem find DITA_HOME if it does not exist due to either an invalid value passed
rem by the user or the %0 problem on Windows 9x
if exist "%DITA_HOME%\lib\ant.jar" goto checkJava

rem check for ant in Program Files
if not exist "%ProgramFiles%\ant" goto checkSystemDrive
set DITA_HOME=%ProgramFiles%\ant
goto checkJava

:checkSystemDrive
rem check for ant in root directory of system drive
if not exist %SystemDrive%\ant\lib\ant.jar goto checkCDrive
set DITA_HOME=%SystemDrive%\ant
goto checkJava

:checkCDrive
rem check for ant in C:\ant for Win9X users
if not exist C:\ant\lib\ant.jar goto noAntHome
set DITA_HOME=C:\ant
goto checkJava

:noAntHome
echo DITA_HOME is set incorrectly or ant could not be located. Please set DITA_HOME.
goto end

:checkJava
rem Set environment variables
call "%DITA_HOME%\resources\env.bat"

set _JAVACMD=%JAVACMD%

if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java.exe

:noJavaHome
if "%_JAVACMD%" == "" set _JAVACMD=java.exe

:runAnt
if "%_USE_CLASSPATH%"=="no" goto runAntNoClasspath
:runAntWithClasspath
"%_JAVACMD%" %ANT_OPTS% -classpath "%DITA_HOME%\lib\ant-launcher.jar" "-Dant.home=%DITA_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp "%CLASSPATH%" %DITA_CMD_LINE_ARGS% -buildfile "%DITA_HOME%\build.xml" -main "org.dita.dost.invoker.Main"
rem Check the error code of the Ant build
if not "%OS%"=="Windows_NT" goto onError
set ANT_ERROR=%ERRORLEVEL%
goto end

:runAntNoClasspath
"%_JAVACMD%" %ANT_OPTS% -classpath "%DITA_HOME%\lib\ant-launcher.jar" "-Dant.home=%DITA_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %DITA_CMD_LINE_ARGS% -buildfile "%DITA_HOME%\build.xml" -main "org.dita.dost.invoker.Main"
rem Check the error code of the Ant build
if not "%OS%"=="Windows_NT" goto onError
set ANT_ERROR=%ERRORLEVEL%
goto end

:onError
rem Windows 9x way of checking the error code.  It matches via brute force.
for %%i in (1 10 100) do set err%%i=
for %%i in (0 1 2) do if errorlevel %%i00 set err100=%%i
if %err100%==2 goto onError200
if %err100%==0 set err100=
for %%i in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %err100%%%i0 set err10=%%i
if "%err100%"=="" if %err10%==0 set err10=
:onError1
for %%i in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %err100%%err10%%%i set err1=%%i
goto onErrorEnd
:onError200
for %%i in (0 1 2 3 4 5) do if errorlevel 2%%i0 set err10=%%i
if err10==5 for %%i in (0 1 2 3 4 5) do if errorlevel 25%%i set err1=%%i
if not err10==5 goto onError1
:onErrorEnd
set ANT_ERROR=%err100%%err10%%err1%
for %%i in (1 10 100) do set err%%i=

:end
rem bug ID 32069: resetting an undefined env variable changes the errorlevel.
if not "%_JAVACMD%"=="" set _JAVACMD=
if not "%_DITA_CMD_LINE_ARGS%"=="" set DITA_CMD_LINE_ARGS=

if "%ANT_ERROR%"=="0" goto mainEnd

goto omega

:mainEnd

rem If there were no errors, we run the post script.
if "%OS%"=="Windows_NT" @endlocal
if "%OS%"=="WINNT" @endlocal

if "%HOME%"=="" goto homeDrivePathPost
if exist "%HOME%\antrc_post.bat" call "%HOME%\antrc_post.bat"

:homeDrivePathPost
if "%HOMEDRIVE%%HOMEPATH%"=="" goto userProfilePost
if "%HOMEDRIVE%%HOMEPATH%"=="%HOME%" goto userProfilePost
if exist "%HOMEDRIVE%%HOMEPATH%\antrc_post.bat" call "%HOMEDRIVE%%HOMEPATH%\antrc_post.bat"

:userProfilePost
if "%USERPROFILE%"=="" goto omega
if "%USERPROFILE%"=="%HOME%" goto omega
if "%USERPROFILE%"=="%HOMEDRIVE%%HOMEPATH%" goto omega
if exist "%USERPROFILE%\antrc_post.bat" call "%USERPROFILE%\antrc_post.bat"

:omega

exit /b %ANT_ERROR%

@echo off

REM This file is part of the DITA Open Toolkit project.
REM See the accompanying license.txt file for applicable licenses.

REM Derived from Apache Ant command line tool.

REM  Licensed to the Apache Software Foundation (ASF) under one or more
REM  contributor license agreements.  See the NOTICE file distributed with
REM  this work for additional information regarding copyright ownership.
REM  The ASF licenses this file to You under the Apache License, Version 2.0
REM  (the "License"); you may not use this file except in compliance with
REM  the License.  You may obtain a copy of the License at
REM
REM      http://www.apache.org/licenses/LICENSE-2.0
REM
REM  Unless required by applicable law or agreed to in writing, software
REM  distributed under the License is distributed on an "AS IS" BASIS,
REM  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM  See the License for the specific language governing permissions and
REM  limitations under the License.

if "%OS%"=="Windows_NT" @setlocal
if "%OS%"=="WINNT" @setlocal

if "%DITA_HOME%"=="" goto setDefaultDitaHome

:setDefaultDitaHome
rem %~dp0 is expanded pathname of the current script under NT
set DITA_HOME="%~dp0.."

rem Slurp the command line arguments. This loop allows for an unlimited number
rem of arguments (up to the command line limit, anyway).
set DITA_CMD_LINE_ARGS=
:setupArgs
if ""%1""=="""" goto doneStart
set DITA_CMD_LINE_ARGS=%DITA_CMD_LINE_ARGS% %1
shift
goto setupArgs

rem This label provides a place for the argument list loop to break out
rem and for NT handling to skip to.

:doneStart

:checkJava
rem Set environment variables
call "%DITA_HOME%\resources\env.bat"

set _JAVACMD=%JAVACMD%

if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java.exe

:noJavaHome
if "%_JAVACMD%" == "" set _JAVACMD=java.exe

:runAnt
"%_JAVACMD%" %ANT_OPTS% -classpath "%DITA_HOME%\lib\ant-launcher.jar" "-Dant.home=%DITA_HOME%"  "-Ddita.dir=%DITA_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp "%CLASSPATH%" %DITA_CMD_LINE_ARGS% -buildfile "%DITA_HOME%\build.xml" -main "org.dita.dost.invoker.Main"
rem Check the error code of the Ant build
if not "%OS%"=="Windows_NT" goto onError
set ANT_ERROR=%ERRORLEVEL%
goto end

:onError
rem Windows 9x way of checking the error code.  It matches via brute force.
for %%i in (1 10 100) do set err%%i=
for %%i in (0 1 2) do if errorlevel %%i00 set err100=%%i
if %err100%==2 goto onError200
if %err100%==0 set err100=
for %%i in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %err100%%%i0 set err10=%%i
if "%err100%"=="" if %err10%==0 set err10=
:onError1
for %%i in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %err100%%err10%%%i set err1=%%i
goto onErrorEnd
:onError200
for %%i in (0 1 2 3 4 5) do if errorlevel 2%%i0 set err10=%%i
if err10==5 for %%i in (0 1 2 3 4 5) do if errorlevel 25%%i set err1=%%i
if not err10==5 goto onError1
:onErrorEnd
set ANT_ERROR=%err100%%err10%%err1%
for %%i in (1 10 100) do set err%%i=

:end
rem bug ID 32069: resetting an undefined env variable changes the errorlevel.
if not "%_JAVACMD%"=="" set _JAVACMD=
if not "%_DITA_CMD_LINE_ARGS%"=="" set DITA_CMD_LINE_ARGS=

if "%ANT_ERROR%"=="0" goto mainEnd

goto omega

:mainEnd

rem If there were no errors, we run the post script.
if "%OS%"=="Windows_NT" @endlocal
if "%OS%"=="WINNT" @endlocal

:omega

exit /b %ANT_ERROR%

Fix dita.bat

Fix dita.bat