@echo off
setlocal

:SetupArgs
:: Initialize the args that will be passed to cmake
set __sourceDir=%~dp0
set __binDir=%~dp0..\..\..\bin
set __CMakeBinDir=""
set __IntermediatesDir=""
set __BuildArch=AnyCPU
set __VCBuildArch=x86_amd64
set CMAKE_BUILD_TYPE=Release

:Arg_Loop
:: Since the native build requires some configuration information before msbuild is called, we have to do some manual args parsing
:: For consistency with building the managed components, args are taken in the msbuild style i.e. /p:
if [%1] == [] goto :ToolsVersion
if /i [%1] == [/p:ConfigurationGroup]    (
    if /i [%2] == [Release] (set CMAKE_BUILD_TYPE=Release&&shift&&shift&goto Arg_Loop)
    if /i [%2] == [Debug]   (set CMAKE_BUILD_TYPE=Debug&&shift&&shift&goto Arg_Loop)
    echo Error: Invalid configuration args "%1 and %2"
    exit /b 1
)
if /i [%1] == [/p:Platform]    (
    if /i [%2] == [AnyCPU]  (set __BuildArch=AnyCPU&&set __VCBuildArch=x86_amd64&&shift&&shift&goto Arg_Loop)
    if /i [%2] == [x86]     (set __BuildArch=x86&&set __VCBuildArch=x86&&shift&&shift&goto Arg_Loop)
    if /i [%2] == [arm]     (set __BuildArch=arm&&set __VCBuildArch=x86_arm&&shift&&shift&goto Arg_Loop)
    if /i [%2] == [x64]     (set __BuildArch=x64&&set __VCBuildArch=x86_amd64&&shift&&shift&goto Arg_Loop)
    echo Error: Invalid platform args "%1 and %2"
    exit /b 1
)
if /i [%1] == [-intermediateDir]    (
    set __IntermediatesDir=%2
)
if /i [%1] == [-binDir]    (
    set __CMakeBinDir=%2
)
shift
goto :Arg_Loop

:ToolsVersion
:: Determine the tools version to pass to cmake/msbuild
if not defined VisualStudioVersion (
    if defined VS140COMNTOOLS (
        goto :VS2015
    )
    if defined VS120COMNTOOLS (
        goto :VS2013
    )
    goto :MissingVersion
)
if "%VisualStudioVersion%"=="14.0" (
    goto :VS2015
)
if "%VisualStudioVersion%"=="12.0" (
    goto :VS2013
)

:MissingVersion
:: Can't find VS 2013+
echo Error: build.cmd requires Visual Studio 2013 or 2015.
echo        Please see https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md for build instructions.
exit /b 1

:VS2013
:: Setup vars for VS2013
set __VSVersion=vs2013
set __PlatformToolset="v120"
:: Set the environment for the native build
call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat" %__VCBuildArch%
goto :SetupDirs

:VS2015
:: Setup vars for VS2015
set __VSVersion=vs2015
set __PlatformToolset="v140"
:: Set the environment for the native build
call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" %__VCBuildArch%
goto :SetupDirs

:SetupDirs
:: Setup to cmake the native components
echo Commencing build of native components
echo.

if %__CMakeBinDir% == "" (
    set "__CMakeBinDir=%__binDir%\Windows_NT.%__BuildArch%.%CMAKE_BUILD_TYPE%\Native"
)
if %__IntermediatesDir% == "" (
    set "__IntermediatesDir=%__binDir%\obj\Windows_NT.%__BuildArch%.%CMAKE_BUILD_TYPE%\Native"
)
    set "__CMakeBinDir=%__CMakeBinDir:\=/%"
    set "__IntermediatesDir=%__IntermediatesDir:\=/%"

:: We wanted to allow AnyCPU for folder creation purposes, but it doesn't make sense for a native build. Default to something else for the actual building.
if "%__BuildArch%" == "AnyCPU" (
    set __BuildArch=x64
)
echo %__CMakeBinDir%

:: Check that the intermediate directory exists so we can place our cmake build tree there
if exist "%__IntermediatesDir%" rd /s /q "%__IntermediatesDir%"
if not exist "%__IntermediatesDir%" md "%__IntermediatesDir%"

if exist "%VSINSTALLDIR%DIA SDK" goto GenVSSolution
echo Error: DIA SDK is missing at "%VSINSTALLDIR%DIA SDK". ^
This is due to a bug in the Visual Studio installer. It does not install DIA SDK at "%VSINSTALLDIR%" but rather ^
at VS install location of previous version. Workaround is to copy DIA SDK folder from VS install location ^
of previous version to "%VSINSTALLDIR%" and then resume build.
:: DIA SDK not included in Express editions
echo Visual Studio 2013 Express does not include the DIA SDK. ^
You need Visual Studio 2013+ (Community is free).
echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md#prerequisites
exit /b 1

:GenVSSolution
:: Regenerate the VS solution
pushd "%__IntermediatesDir%"
call "%__sourceDir%\gen-buildsys-win.bat" %__sourceDir% %__VSVersion% %__BuildArch%
popd

:CheckForProj
:: Check that the project created by Cmake exists
if exist "%__IntermediatesDir%\install.vcxproj" goto BuildNativeProj
goto :Failure

:BuildNativeProj
:: Build the project created by Cmake
msbuild "%__IntermediatesDir%\install.vcxproj" /t:rebuild /nologo /p:Configuration=%CMAKE_BUILD_TYPE% /p:Platform=%__BuildArch% /maxcpucount /nodeReuse:false /p:PlatformToolset="%__PlatformToolset%" /fileloggerparameters:Verbosity=normal
IF ERRORLEVEL 1 (
    goto :Failure
)

:Success
:: Successful build
echo Done building Native components
EXIT /B 0

:Failure
:: Build failed
echo Failed to generate native component build project!
exit /b 1

@echo off
setlocal

:SetupArgs
:: Initialize the args that will be passed to cmake
set __sourceDir=%~dp0
set __binDir=%~dp0..\..\..\bin
set __CMakeBinDir=""
set __IntermediatesDir=""
set __BuildArch=AnyCPU
set __VCBuildArch=x86_amd64
set CMAKE_BUILD_TYPE=Debug

:Arg_Loop
:: Since the native build requires some configuration information before msbuild is called, we have to do some manual args parsing
:: For consistency with building the managed components, args are taken in the msbuild style i.e. /p:
if [%1] == [] goto :ToolsVersion
if /i [%1] == [/p:ConfigurationGroup]    (
    if /i [%2] == [Release] (set CMAKE_BUILD_TYPE=Release&&shift&&shift&goto Arg_Loop)
    if /i [%2] == [Debug]   (set CMAKE_BUILD_TYPE=Debug&&shift&&shift&goto Arg_Loop)
    echo Error: Invalid configuration args "%1 and %2"
    exit /b 1
)
if /i [%1] == [/p:Platform]    (
    if /i [%2] == [AnyCPU]  (set __BuildArch=AnyCPU&&set __VCBuildArch=x86_amd64&&shift&&shift&goto Arg_Loop)
    if /i [%2] == [x86]     (set __BuildArch=x86&&set __VCBuildArch=x86&&shift&&shift&goto Arg_Loop)
    if /i [%2] == [arm]     (set __BuildArch=arm&&set __VCBuildArch=x86_arm&&shift&&shift&goto Arg_Loop)
    if /i [%2] == [x64]     (set __BuildArch=x64&&set __VCBuildArch=x86_amd64&&shift&&shift&goto Arg_Loop)
    echo Error: Invalid platform args "%1 and %2"
    exit /b 1
)
if /i [%1] == [-intermediateDir]    (
    set __IntermediatesDir=%2
)
if /i [%1] == [-binDir]    (
    set __CMakeBinDir=%2
)
shift
goto :Arg_Loop

:ToolsVersion
:: Determine the tools version to pass to cmake/msbuild
if not defined VisualStudioVersion (
    if defined VS140COMNTOOLS (
        goto :VS2015
    )
    if defined VS120COMNTOOLS (
        goto :VS2013
    )
    goto :MissingVersion
)
if "%VisualStudioVersion%"=="14.0" (
    goto :VS2015
)
if "%VisualStudioVersion%"=="12.0" (
    goto :VS2013
)

:MissingVersion
:: Can't find VS 2013+
echo Error: build.cmd requires Visual Studio 2013 or 2015.
echo        Please see https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md for build instructions.
exit /b 1

:VS2013
:: Setup vars for VS2013
set __VSVersion=vs2013
set __PlatformToolset="v120"
:: Set the environment for the native build
call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat" %__VCBuildArch%
goto :SetupDirs

:VS2015
:: Setup vars for VS2015
set __VSVersion=vs2015
set __PlatformToolset="v140"
:: Set the environment for the native build
call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" %__VCBuildArch%
goto :SetupDirs

:SetupDirs
:: Setup to cmake the native components
echo Commencing build of native components
echo.

if %__CMakeBinDir% == "" (
    set "__CMakeBinDir=%__binDir%\Windows_NT.%__BuildArch%.%CMAKE_BUILD_TYPE%\Native"
)
if %__IntermediatesDir% == "" (
    set "__IntermediatesDir=%__binDir%\obj\Windows_NT.%__BuildArch%.%CMAKE_BUILD_TYPE%\Native"
)
    set "__CMakeBinDir=%__CMakeBinDir:\=/%"
    set "__IntermediatesDir=%__IntermediatesDir:\=/%"

:: We wanted to allow AnyCPU for folder creation purposes, but it doesn't make sense for a native build. Default to something else for the actual building.
if "%__BuildArch%" == "AnyCPU" (
    set __BuildArch=x64
)
echo %__CMakeBinDir%

:: Check that the intermediate directory exists so we can place our cmake build tree there
if exist "%__IntermediatesDir%" rd /s /q "%__IntermediatesDir%"
if not exist "%__IntermediatesDir%" md "%__IntermediatesDir%"

if exist "%VSINSTALLDIR%DIA SDK" goto GenVSSolution
echo Error: DIA SDK is missing at "%VSINSTALLDIR%DIA SDK". ^
This is due to a bug in the Visual Studio installer. It does not install DIA SDK at "%VSINSTALLDIR%" but rather ^
at VS install location of previous version. Workaround is to copy DIA SDK folder from VS install location ^
of previous version to "%VSINSTALLDIR%" and then resume build.
:: DIA SDK not included in Express editions
echo Visual Studio 2013 Express does not include the DIA SDK. ^
You need Visual Studio 2013+ (Community is free).
echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md#prerequisites
exit /b 1

:GenVSSolution
:: Regenerate the VS solution
pushd "%__IntermediatesDir%"
call "%__sourceDir%\gen-buildsys-win.bat" %__sourceDir% %__VSVersion% %__BuildArch%
popd

:CheckForProj
:: Check that the project created by Cmake exists
if exist "%__IntermediatesDir%\install.vcxproj" goto BuildNativeProj
goto :Failure

:BuildNativeProj
:: Build the project created by Cmake
msbuild "%__IntermediatesDir%\install.vcxproj" /t:rebuild /nologo /p:Configuration=%CMAKE_BUILD_TYPE% /p:Platform=%__BuildArch% /maxcpucount /nodeReuse:false /p:PlatformToolset="%__PlatformToolset%" /fileloggerparameters:Verbosity=normal
IF ERRORLEVEL 1 (
    goto :Failure
)

:Success
:: Successful build
echo Done building Native components
EXIT /B 0

:Failure
:: Build failed
echo Failed to generate native component build project!
exit /b 1

Make debug the default native build configuration.


rem Delete everything in Install2.0
rd /s /q Install2.0

rem Delete everything in Install2.0
rd /s /q Install2.0

rem Now do steps to create a zip that has FLExTools FLExTrans and SenseLinker all in one file
mkdir Install2.0\FlexTools2.0\FlexTools\Collections
mkdir Install2.0\FlexTools2.0\FlexTools\Output
mkdir Install2.0\FlexTools2.0\FlexTools\__icons
mkdir Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans
mkdir Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans\Lib

xcopy FlexTools2.0\* Install2.0\FlexTools2.0
xcopy FlexTools2.0\FlexTools\* Install2.0\FlexTools2.0\FlexTools
xcopy /s FlexTools2.0\FlexTools\__icons\* Install2.0\FlexTools2.0\FlexTools\__icons
echo fuzzywuzzy >> Install2.0\FlexTools2.0\requirements.txt
copy install_flextools_libs.bat Install2.0\FlexTools2.0

rem core models
copy CatalogTargetPrefixes.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans
copy ConvertTextToSTAMPformat.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans
copy ExtractBilingualLexicon.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans
copy ExtractSourceText.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans
copy ExtractTargetLexicon.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans
copy InsertTargetText.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans
copy RunApertium.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans

rem libraries
copy readconfig.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans\Lib
copy Utils.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans\Lib
copy MyTableView.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans\Lib

rem other stuff
copy /Y subdirs.pth Install2.0\FlexTools2.0\FlexTools\Modules
copy /Y FlexTrans.config Install2.0\FlexTools2.0\FlexTools
copy "FlexTrans All Steps.ini" Install2.0\FlexTools2.0\FlexTools\Collections
copy "FlexTrans Run Testbed.ini" Install2.0\FlexTools2.0\FlexTools\Collections
copy "FlexTrans Tools.ini" Install2.0\FlexTools2.0\FlexTools\Collections
copy /Y flextools.ini Install2.0\FlexTools2.0\FlexTools
copy transfer_rules.t1x Install2.0\FlexTools2.0\FlexTools\Output
copy replace.dix Install2.0\FlexTools2.0\FlexTools\Output
copy stamp32.exe Install2.0\FlexTools2.0\FlexTools
copy VirtualMachineFiles\do_make_direct.sh Install2.0\FlexTools2.0\FlexTools\Output
copy VirtualMachineFiles\ForXXE\Makefile Install2.0\FlexTools2.0\FlexTools\Output
copy VirtualMachineFiles\ForXXE\fix.py Install2.0\FlexTools2.0\FlexTools\Output

rem Documentation
mkdir "Install2.0\FlexTools2.0\FLExTrans Documentation"
mkdir "Install2.0\FlexTools2.0\FLExTrans Documentation\Images"
mkdir "Install2.0\FlexTools2.0\FLExTrans Documentation\Transfer Rules Tutorial"
copy Doc\*.htm "Install2.0\FlexTools2.0\FLExTrans Documentation"
copy Doc\Images\* "Install2.0\FlexTools2.0\FLExTrans Documentation\Images"
copy "Doc\Transfer Rules Tutorial\*" "Install2.0\FlexTools2.0\FLExTrans Documentation\Transfer Rules Tutorial"

rem Sample projects
mkdir "Install2.0\FlexTools2.0\Sample Projects"
copy "Sample Projects\German-FLExTrans-Sample 2016-10-19 2109.fwbackup" "Install2.0\FlexTools2.0\Sample Projects"
copy "Sample Projects\Swedish-FLExTrans-Sample 2016-10-19 2110.fwbackup" "Install2.0\FlexTools2.0\Sample Projects"

rem Sense Linker pieces
mkdir Install2.0\FlexTools2.0\Python27.NET\FW8\PyQt4
mkdir Install2.0\FlexTools2.0\Python27.NET\FW8\Levenshtein
mkdir Install2.0\FlexTools2.0\Python27.NET\FW8\fuzzywuzzy
copy LinkSenseTool.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans
copy Linker.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib
copy Linker.ui Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib
copy Qt*.* Install2.0\FlexTools2.0\Python27.NET\FW8\PyQt4
copy __init__.py Install2.0\FlexTools2.0\Python27.NET\FW8\PyQt4
copy libeay32.dll Install2.0\FlexTools2.0\Python27.NET\FW8\PyQt4
copy ssleay32.dll Install2.0\FlexTools2.0\Python27.NET\FW8\PyQt4
copy fuzzywuzzy Install2.0\FlexTools2.0\Python27.NET\FW8\fuzzywuzzy
copy Levenshtein Install2.0\FlexTools2.0\Python27.NET\FW8\Levenshtein
copy sip.pyd Install2.0\FlexTools2.0\Python27.NET\FW8

rem Live Rule Tester pieces
mkdir Install2.0\FlexTools2.0\FlexTools\Output\LiveRuleTester
copy LiveRuleTesterTool.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans
copy LiveRuleTester.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib
copy LiveRuleTester.ui Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib
copy UpArrow.png Install2.0\FlexTools2.0\FLExTools
copy DownArrow.png Install2.0\FlexTools2.0\FLExTools
copy VirtualMachineFiles\ForLiveRuleTester\do_make.sh Install2.0\FlexTools2.0\FlexTools\Output\LiveRuleTester
copy VirtualMachineFiles\ForXXE\Makefile Install2.0\FlexTools2.0\FlexTools\Output\LiveRuleTester
copy VirtualMachineFiles\ForXXE\fix.py Install2.0\FlexTools2.0\FlexTools\Output\LiveRuleTester

rem View Source-Target pieces
copy ViewSrcTgt.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans
copy SrcTgtViewer.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib
copy SrcTgtViewer.ui Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib

rem SetUp Gramm Categories pieces
copy SetUpTransferRuleGramCat.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans

rem Testbed pieces
copy TestbedValidator.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib
copy StartTestbed.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans
copy EndTestbed.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans
copy OverWriteTestDlg.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib
copy OverWriteTestDlg.ui Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib
copy TestbedLogViewer.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans
copy TestbedLog.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib
copy TestbedLog.ui Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib
copy Light_green_check.png Install2.0\FlexTools2.0\FLExTools
copy Red_x.png             Install2.0\FlexTools2.0\FLExTools
copy Yellow_triangle.png   Install2.0\FlexTools2.0\FLExTools

cd Install2.0
"%SEVENZ_PATH%"\7z a FLExTools20WithFLExTrans.zip FlexTools2.0
copy /Y FLExTools20WithFLExTrans.zip ..
cd ..

pause

rem Delete everything in Install2.0
rd /s /q Install2.0

rem Delete everything in Install2.0
rd /s /q Install2.0

rem Now do steps to create a zip that has FLExTools FLExTrans and SenseLinker all in one file
mkdir Install2.0\FlexTools2.0\FlexTools\Collections
mkdir Install2.0\FlexTools2.0\FlexTools\Output
mkdir Install2.0\FlexTools2.0\FlexTools\__icons
mkdir Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans
mkdir Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans\Lib

xcopy FlexTools2.0\* Install2.0\FlexTools2.0
xcopy FlexTools2.0\FlexTools\* Install2.0\FlexTools2.0\FlexTools
xcopy /s FlexTools2.0\FlexTools\__icons\* Install2.0\FlexTools2.0\FlexTools\__icons
echo fuzzywuzzy >> Install2.0\FlexTools2.0\requirements.txt
copy install_flextools_libs.bat Install2.0\FlexTools2.0

rem core models
copy CatalogTargetPrefixes.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans
copy ConvertTextToSTAMPformat.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans
copy ExtractBilingualLexicon.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans
copy ExtractSourceText.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans
copy ExtractTargetLexicon.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans
copy InsertTargetText.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans
copy RunApertium.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans
copy RunTreeTran.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans

rem libraries
copy readconfig.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans\Lib
copy Utils.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans\Lib
copy MyTableView.py Install2.0\FlexTools2.0\FlexTools\Modules\FLExTrans\Lib

rem other stuff
copy /Y subdirs.pth Install2.0\FlexTools2.0\FlexTools\Modules
copy /Y FlexTrans.config Install2.0\FlexTools2.0\FlexTools
copy "FlexTrans All Steps.ini" Install2.0\FlexTools2.0\FlexTools\Collections
copy "FlexTrans Run Testbed.ini" Install2.0\FlexTools2.0\FlexTools\Collections
copy "FlexTrans Tools.ini" Install2.0\FlexTools2.0\FlexTools\Collections
copy /Y flextools.ini Install2.0\FlexTools2.0\FlexTools
copy transfer_rules.t1x Install2.0\FlexTools2.0\FlexTools\Output
copy replace.dix Install2.0\FlexTools2.0\FlexTools\Output
copy stamp32.exe Install2.0\FlexTools2.0\FlexTools
copy VirtualMachineFiles\do_make_direct.sh Install2.0\FlexTools2.0\FlexTools\Output
copy VirtualMachineFiles\ForXXE\Makefile Install2.0\FlexTools2.0\FlexTools\Output
copy VirtualMachineFiles\ForXXE\fix.py Install2.0\FlexTools2.0\FlexTools\Output

rem Documentation
mkdir "Install2.0\FlexTools2.0\FLExTrans Documentation"
mkdir "Install2.0\FlexTools2.0\FLExTrans Documentation\Images"
mkdir "Install2.0\FlexTools2.0\FLExTrans Documentation\Transfer Rules Tutorial"
copy Doc\*.htm "Install2.0\FlexTools2.0\FLExTrans Documentation"
copy Doc\Images\* "Install2.0\FlexTools2.0\FLExTrans Documentation\Images"
copy "Doc\Transfer Rules Tutorial\*" "Install2.0\FlexTools2.0\FLExTrans Documentation\Transfer Rules Tutorial"

rem Sample projects
mkdir "Install2.0\FlexTools2.0\Sample Projects"
copy "Sample Projects\German-FLExTrans-Sample 2016-10-19 2109.fwbackup" "Install2.0\FlexTools2.0\Sample Projects"
copy "Sample Projects\Swedish-FLExTrans-Sample 2016-10-19 2110.fwbackup" "Install2.0\FlexTools2.0\Sample Projects"

rem Sense Linker pieces
mkdir Install2.0\FlexTools2.0\Python27.NET\FW8\PyQt4
mkdir Install2.0\FlexTools2.0\Python27.NET\FW8\Levenshtein
mkdir Install2.0\FlexTools2.0\Python27.NET\FW8\fuzzywuzzy
copy LinkSenseTool.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans
copy Linker.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib
copy Linker.ui Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib
copy Qt*.* Install2.0\FlexTools2.0\Python27.NET\FW8\PyQt4
copy __init__.py Install2.0\FlexTools2.0\Python27.NET\FW8\PyQt4
copy libeay32.dll Install2.0\FlexTools2.0\Python27.NET\FW8\PyQt4
copy ssleay32.dll Install2.0\FlexTools2.0\Python27.NET\FW8\PyQt4
copy fuzzywuzzy Install2.0\FlexTools2.0\Python27.NET\FW8\fuzzywuzzy
copy Levenshtein Install2.0\FlexTools2.0\Python27.NET\FW8\Levenshtein
copy sip.pyd Install2.0\FlexTools2.0\Python27.NET\FW8

rem Live Rule Tester pieces
mkdir Install2.0\FlexTools2.0\FlexTools\Output\LiveRuleTester
copy LiveRuleTesterTool.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans
copy LiveRuleTester.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib
copy LiveRuleTester.ui Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib
copy UpArrow.png Install2.0\FlexTools2.0\FLExTools
copy DownArrow.png Install2.0\FlexTools2.0\FLExTools
copy VirtualMachineFiles\ForLiveRuleTester\do_make.sh Install2.0\FlexTools2.0\FlexTools\Output\LiveRuleTester
copy VirtualMachineFiles\ForXXE\Makefile Install2.0\FlexTools2.0\FlexTools\Output\LiveRuleTester
copy VirtualMachineFiles\ForXXE\fix.py Install2.0\FlexTools2.0\FlexTools\Output\LiveRuleTester

rem View Source-Target pieces
copy ViewSrcTgt.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans
copy SrcTgtViewer.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib
copy SrcTgtViewer.ui Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib

rem SetUp Gramm Categories pieces
copy SetUpTransferRuleGramCat.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans

rem Testbed pieces
copy TestbedValidator.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib
copy StartTestbed.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans
copy EndTestbed.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans
copy OverWriteTestDlg.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib
copy OverWriteTestDlg.ui Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib
copy TestbedLogViewer.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans
copy TestbedLog.py Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib
copy TestbedLog.ui Install2.0\FlexTools2.0\FLExTools\Modules\FLExTrans\Lib
copy Light_green_check.png Install2.0\FlexTools2.0\FLExTools
copy Red_x.png             Install2.0\FlexTools2.0\FLExTools
copy Yellow_triangle.png   Install2.0\FlexTools2.0\FLExTools

cd Install2.0
"%SEVENZ_PATH%"\7z a FLExTools20WithFLExTrans.zip FlexTools2.0
copy /Y FLExTools20WithFLExTrans.zip ..
cd ..

pause

Update CreateInstallFolder2-0.bat

Update CreateInstallFolder2-0.bat


@ECHO OFF
IF %1.==. GOTO No1
set CONFIG=%1

REM set debug parameters
REM set DEBUG_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=y"

"%JAVA_HOME%\bin\java" -cp ..\lib\* %DEBUG_OPTS% "-Daerobase.config.dir=%CONFIG%" "-Djava.library.path=..\\lib" org.jboss.aerogear.unifiedpush.DBMaintenance > initdb-java.log 2>&1

GOTO End1

:No1
  ECHO Missing Config file
GOTO End1

:End1
@ECHO ON

@ECHO OFF
IF %1.==. GOTO No1
set CONFIG=%1

REM set debug parameters
REM set DEBUG_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=y"

"%JAVA_HOME%\bin\java" -cp ..\lib\* %DEBUG_OPTS% "-Daerobase.config.dir=%CONFIG%" "-Djava.library.path=..\\..\\..\\mssql" org.jboss.aerogear.unifiedpush.DBMaintenance > initdb-java.log 2>&1

GOTO End1

:No1
  ECHO Missing Config file
GOTO End1

:End1
@ECHO ON

Add mssql jdbc driver to path

Add mssql jdbc driver to path


@if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off

:: ----------------------
:: KUDU Deployment Script
:: Version: 0.1.7
:: ----------------------

:: Prerequisites
:: -------------

:: Verify node.js installed
where node 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
  echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment.
  goto error
)

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

IF NOT DEFINED DEPLOYMENT_SOURCE (
  SET DEPLOYMENT_SOURCE=%~dp0%.
)

IF NOT DEFINED DEPLOYMENT_TARGET (
  SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot
)

IF NOT DEFINED NEXT_MANIFEST_PATH (
  SET NEXT_MANIFEST_PATH=%ARTIFACTS%\manifest

  IF NOT DEFINED PREVIOUS_MANIFEST_PATH (
    SET PREVIOUS_MANIFEST_PATH=%ARTIFACTS%\manifest
  )
)

IF NOT DEFINED KUDU_SYNC_CMD (
  :: Install kudu sync
  echo Installing Kudu Sync
  call npm install kudusync -g --silent
  IF !ERRORLEVEL! NEQ 0 goto error

  :: Locally just running "kuduSync" would also work
  SET KUDU_SYNC_CMD=%appdata%\npm\kuduSync.cmd
)
goto Deployment

:: Utility Functions
:: -----------------

:SelectNodeVersion

IF DEFINED KUDU_SELECT_NODE_VERSION_CMD (
  :: The following are done only on Windows Azure Websites environment
  call %KUDU_SELECT_NODE_VERSION_CMD% "%DEPLOYMENT_SOURCE%" "%DEPLOYMENT_TARGET%" "%DEPLOYMENT_TEMP%"
  IF !ERRORLEVEL! NEQ 0 goto error

  IF EXIST "%DEPLOYMENT_TEMP%\__nodeVersion.tmp" (
    SET /p NODE_EXE=<"%DEPLOYMENT_TEMP%\__nodeVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF EXIST "%DEPLOYMENT_TEMP%\__npmVersion.tmp" (
    SET /p NPM_JS_PATH=<"%DEPLOYMENT_TEMP%\__npmVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

  SET NPM_CMD="!NODE_EXE!" "!NPM_JS_PATH!"
) ELSE (
  SET NPM_CMD=npm
  SET NODE_EXE=node
)

goto :EOF

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------

:Deployment
echo Handling node.js deployment.

:: 1. KuduSync
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
  call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 50 -f "%DEPLOYMENT_SOURCE%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
  IF !ERRORLEVEL! NEQ 0 goto error
)

:: 2. Select node version
call :SelectNodeVersion

:: 3. Install npm packages
IF EXIST "%DEPLOYMENT_TARGET%\package.json" (
  pushd "%DEPLOYMENT_TARGET%"
  call :ExecuteCmd !NPM_CMD! install --production
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

:: 4. Install bower packages
IF EXIST "%DEPLOYMENT_TARGET%\bower.json" (
  pushd "%DEPLOYMENT_TARGET%"
  call :ExecuteCmd !NPM_CMD! install -g bower
  IF !ERRORLEVEL! NEQ 0 goto error
  call :ExecuteCmd bower install
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

:: 5. Run grunt
IF EXIST "%DEPLOYMENT_TARGET%\bower.json" (
  pushd "%DEPLOYMENT_TARGET%"
  call :ExecuteCmd !NPM_CMD! install grunt-cli
  IF !ERRORLEVEL! NEQ 0 goto error
  call :ExecuteCmd grunt --no-color cssmin uglify
  IF !ERRORLEVEL! NEQ 0 goto error
  call :ExecuteCmd grunt --no-color --force
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: Post deployment stub
IF DEFINED POST_DEPLOYMENT_ACTION call "%POST_DEPLOYMENT_ACTION%"
IF !ERRORLEVEL! NEQ 0 goto error

goto end

:: Execute command routine that will echo out when error
:ExecuteCmd
setlocal
set _CMD_=%*
call %_CMD_%
if "%ERRORLEVEL%" NEQ "0" echo Failed exitCode=%ERRORLEVEL%, command=%_CMD_%
exit /b %ERRORLEVEL%

:error
endlocal
echo An error has occurred during web site deployment.
call :exitSetErrorLevel
call :exitFromFunction 2>nul

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

@if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off

:: ----------------------
:: KUDU Deployment Script
:: Version: 0.1.7
:: ----------------------

:: Prerequisites
:: -------------

:: Verify node.js installed
where node 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
  echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment.
  goto error
)

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

IF NOT DEFINED DEPLOYMENT_SOURCE (
  SET DEPLOYMENT_SOURCE=%~dp0%.
)

IF NOT DEFINED DEPLOYMENT_TARGET (
  SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot
)

IF NOT DEFINED NEXT_MANIFEST_PATH (
  SET NEXT_MANIFEST_PATH=%ARTIFACTS%\manifest

  IF NOT DEFINED PREVIOUS_MANIFEST_PATH (
    SET PREVIOUS_MANIFEST_PATH=%ARTIFACTS%\manifest
  )
)

IF NOT DEFINED KUDU_SYNC_CMD (
  :: Install kudu sync
  echo Installing Kudu Sync
  call npm install kudusync -g --silent
  IF !ERRORLEVEL! NEQ 0 goto error

  :: Locally just running "kuduSync" would also work
  SET KUDU_SYNC_CMD=%appdata%\npm\kuduSync.cmd
)
goto Deployment

:: Utility Functions
:: -----------------

:SelectNodeVersion

IF DEFINED KUDU_SELECT_NODE_VERSION_CMD (
  :: The following are done only on Windows Azure Websites environment
  call %KUDU_SELECT_NODE_VERSION_CMD% "%DEPLOYMENT_SOURCE%" "%DEPLOYMENT_TARGET%" "%DEPLOYMENT_TEMP%"
  IF !ERRORLEVEL! NEQ 0 goto error

  IF EXIST "%DEPLOYMENT_TEMP%\__nodeVersion.tmp" (
    SET /p NODE_EXE=<"%DEPLOYMENT_TEMP%\__nodeVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF EXIST "%DEPLOYMENT_TEMP%\__npmVersion.tmp" (
    SET /p NPM_JS_PATH=<"%DEPLOYMENT_TEMP%\__npmVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

  SET NPM_CMD="!NODE_EXE!" "!NPM_JS_PATH!"
) ELSE (
  SET NPM_CMD=npm
  SET NODE_EXE=node
)

goto :EOF

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------

:Deployment
echo Handling node.js deployment.

:: 1. KuduSync
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
  call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 50 -f "%DEPLOYMENT_SOURCE%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
  IF !ERRORLEVEL! NEQ 0 goto error
)

:: 2. Select node version
call :SelectNodeVersion

:: 3. Install npm packages
IF EXIST "%DEPLOYMENT_TARGET%\package.json" (
  pushd "%DEPLOYMENT_TARGET%"
  call :ExecuteCmd !NPM_CMD! install --production
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

:: 4. Install bower packages
IF EXIST "%DEPLOYMENT_TARGET%\bower.json" (
  pushd "%DEPLOYMENT_TARGET%"
  call :ExecuteCmd !NPM_CMD! install -g bower
  IF !ERRORLEVEL! NEQ 0 goto error
  call :ExecuteCmd bower install
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

:: 5. Run grunt
IF EXIST "%DEPLOYMENT_TARGET%\bower.json" (
  pushd "%DEPLOYMENT_TARGET%"
  call :ExecuteCmd !NPM_CMD! install -g grunt-cli
  IF !ERRORLEVEL! NEQ 0 goto error
  call :ExecuteCmd grunt --no-color cssmin uglify
  IF !ERRORLEVEL! NEQ 0 goto error
  call :ExecuteCmd grunt --no-color --force
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: Post deployment stub
IF DEFINED POST_DEPLOYMENT_ACTION call "%POST_DEPLOYMENT_ACTION%"
IF !ERRORLEVEL! NEQ 0 goto error

goto end

:: Execute command routine that will echo out when error
:ExecuteCmd
setlocal
set _CMD_=%*
call %_CMD_%
if "%ERRORLEVEL%" NEQ "0" echo Failed exitCode=%ERRORLEVEL%, command=%_CMD_%
exit /b %ERRORLEVEL%

:error
endlocal
echo An error has occurred during web site deployment.
call :exitSetErrorLevel
call :exitFromFunction 2>nul

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

install grunt globally

install grunt globally


REM work in progress
REM Setup a non-production BigFix Eval Server with SQL Developer Edition.

REM http://software.bigfix.com/download/bes/95/BigFix-BES-Server-9.5.9.62.exe
REM http://download.microsoft.com/download/2/5/0/2508F7B4-6DDE-4C3E-B1FA-E1EB66F2F79F/SQLServer2016-SSEI-Dev.exe

SET BASEFOLDER=C:\Windows\Temp

powershell -command "& { (New-Object Net.WebClient).DownloadFile('http://download.microsoft.com/download/2/5/0/2508F7B4-6DDE-4C3E-B1FA-E1EB66F2F79F/SQLServer2016-SSEI-Dev.exe', '%BASEFOLDER%\SQLServer-SSEI-Dev.exe') }" -ExecutionPolicy Bypass

%BASEFOLDER%\SQLServer-SSEI-Dev.exe /Q /ACTION=Install /IACCEPTSQLSERVERLICENSETERMS

REM work in progress
REM Setup a non-production BigFix Eval Server with SQL Developer Edition.

REM http://software.bigfix.com/download/bes/95/BigFix-BES-Server-9.5.9.62.exe
REM http://download.microsoft.com/download/2/5/0/2508F7B4-6DDE-4C3E-B1FA-E1EB66F2F79F/SQLServer2016-SSEI-Dev.exe

SET BASEFOLDER=C:\Windows\Temp

powershell -command "& { (New-Object Net.WebClient).DownloadFile('http://download.microsoft.com/download/2/5/0/2508F7B4-6DDE-4C3E-B1FA-E1EB66F2F79F/SQLServer2016-SSEI-Dev.exe', '%BASEFOLDER%\SQLServer-SSEI-Dev.exe') }" -ExecutionPolicy Bypass

REM https://docs.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-from-the-command-prompt?view=sql-server-2017
%BASEFOLDER%\SQLServer-SSEI-Dev.exe /Q /ACTION=Install /IACCEPTSQLSERVERLICENSETERMS

Update bigfix_setup_root_eval.bat

Update bigfix_setup_root_eval.bat


@echo off
del *.nupkg
rem nuget pack Acr.Ble.nuspec
nuget pack Plugin.BluetoothLE.nuspec
pause

@echo off
del *.nupkg
nuget pack Acr.Ble.nuspec
rem nuget pack Plugin.BluetoothLE.nuspec
pause

update pack script

update pack script


@echo off

rem $Id$

if not "%JAVA_HOME%" == "" goto gotJavaHome
set JAVA_HOME=$JAVA_HOME

:gotJavaHome
rem will be set by the installer
set EXIST_HOME=$INSTALL_PATH

:gotExistHome
set ANT_HOME=%EXIST_HOME%\tools\ant
set _LIBJARS=%CLASSPATH%;%ANT_HOME%\lib\ant-launcher.jar;%EXIST_HOME%\lib\test\junit-4.8.2.jar;%JAVA_HOME%\lib\tools.jar

set JAVA_ENDORSED_DIRS=%EXIST_HOME%\lib\endorsed

rem You must set
rem -Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl
rem Otherwise Ant will fail to do junitreport with Saxon, as it has a direct dependency on Xalan.

set _JAVA_OPTS=-Xms512m -Xmx512m -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -Dant.home="%ANT_HOME%" -Dexist.home="%EXIST_HOME%" -Djavax.xml.transform.TransformerFactory="org.apache.xalan.processor.TransformerFactoryImpl" %JAVA_OPTS%

echo eXist Build
echo -------------------
echo JAVA_HOME=%JAVA_HOME%
echo EXIST_HOME=%EXIST_HOME%
echo _LIBJARS=%_LIBJARS%
echo _JAVA_OPTS=%_JAVA_OPTS%

echo Starting Ant...
echo

"%JAVA_HOME%\bin\java" %_JAVA_OPTS% -classpath "%_LIBJARS%" org.apache.tools.ant.launch.Launcher %1 %2 %3 %4 %5 %6 %7 %8 %9

@echo off

rem $Id$

if not "%JAVA_HOME%" == "" goto gotJavaHome
set JAVA_HOME=$JAVA_HOME

:gotJavaHome
rem will be set by the installer
set EXIST_HOME=$INSTALL_PATH

:gotExistHome
set ANT_HOME=%EXIST_HOME%\tools\ant
set _LIBJARS=%CLASSPATH%;%ANT_HOME%\lib\ant-launcher-1.9.4.jar;%EXIST_HOME%\lib\test\junit-4.12.jar;%JAVA_HOME%\lib\tools.jar

set JAVA_ENDORSED_DIRS=%EXIST_HOME%\lib\endorsed

rem You must set
rem -Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl
rem Otherwise Ant will fail to do junitreport with Saxon, as it has a direct dependency on Xalan.

set _JAVA_OPTS=-Xms512m -Xmx512m -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -Dant.home="%ANT_HOME%" -Dexist.home="%EXIST_HOME%" -Djavax.xml.transform.TransformerFactory="org.apache.xalan.processor.TransformerFactoryImpl" %JAVA_OPTS%

echo eXist Build
echo -------------------
echo JAVA_HOME=%JAVA_HOME%
echo EXIST_HOME=%EXIST_HOME%
echo _LIBJARS=%_LIBJARS%
echo _JAVA_OPTS=%_JAVA_OPTS%

echo Starting Ant...
echo

"%JAVA_HOME%\bin\java" %_JAVA_OPTS% -classpath "%_LIBJARS%" org.apache.tools.ant.launch.Launcher %1 %2 %3 %4 %5 %6 %7 %8 %9

[bugfix] Correct CLASSPATH for building src from a Windows install


@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements.  See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership.  The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with 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,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied.  See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------

@REM ----------------------------------------------------------------------------
@REM Apache Maven Wrapper startup batch script, version 3.1.1
@REM (Modified for the purposes of building Byte Buddy)
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM     e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------

@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%

@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")

@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
:skipRcPre

@setlocal

set ERROR_CODE=0

@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal

@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome

echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error

:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init

echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error

@REM ==== END VALIDATION ====

:init

@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.

set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir

set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir

:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir

:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"

:endDetectBaseDir

IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig

@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%

:endReadAdditionalConfig

@REM Use HTTP endpoints and legacy Maven if Java 6 or 7 is used to build (Byte Buddy edit)
set REPO_URL=http://insecure.repo1.maven.org
set WRAPPER_LOCATION=wrapper-legacy
set WRAPPER_PATH=io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
for /f tokens^=2-5^ delims^=.-_^" %%j in ('%JAVA_HOME%\bin\java -fullversion 2^>^&1') do set "JAVA_VERSION_STRING=%%j%%k%%l%%m"
IF NOT "%JAVA_VERSION_STRING:~0,3%"=="160" (
  IF NOT "%JAVA_VERSION_STRING:~0,3%"=="170" (
    set REPO_URL=https://repo.maven.apache.org
    set WRAPPER_LOCATION=wrapper
    set WRAPPER_PATH=org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
  )
)

SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\%WRAPPER_LOCATION%\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain

set WRAPPER_URL="%REPO_URL%/maven2/%WRAPPER_PATH%"

FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\%WRAPPER_LOCATION%\maven-wrapper.properties") DO (
    IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
)

@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
    if "%MVNW_VERBOSE%" == "true" (
        echo Found %WRAPPER_JAR%
    )
) else (
    if not "%MVNW_REPOURL%" == "" (
        SET WRAPPER_URL="%MVNW_REPOURL%/%WRAPPER_PATH%"
    )
    if "%MVNW_VERBOSE%" == "true" (
        echo Couldn't find %WRAPPER_JAR%, downloading it ...
        echo Downloading from: %WRAPPER_URL%
    )

    powershell -Command "&{"^
		"$webclient = new-object System.Net.WebClient;"^
		"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
		"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
		"}"^
		"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
		"}"
    if "%MVNW_VERBOSE%" == "true" (
        echo Finished downloading %WRAPPER_JAR%
    )
)
@REM End of extension

@REM Validate the Gradle wrapper's hash (Byte Buddy edit)
SET FILE_HASH=""
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\%WRAPPER_LOCATION%\maven-wrapper.properties") DO (
    IF "%%A"=="wrapperHash" SET FILE_HASH=%%B
)
IF NOT %FILE_HASH%=="" (
    IF NOT (Get-FileHash %MAVEN_PROJECTBASEDIR%/.mvn/%WRAPPER_LOCATION%/maven-wrapper.jar -Algorithm SHA256).hash=="%FILE_HASH%".toUpper() (
      echo Could not validate hash of maven-wrapper.jar
      goto error
    )
)

@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*

%MAVEN_JAVA_EXE% ^
  %JVM_CONFIG_MAVEN_PROPS% ^
  %MAVEN_OPTS% ^
  %MAVEN_DEBUG_OPTS% ^
  -classpath %WRAPPER_JAR% ^
  "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
  %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end

:error
set ERROR_CODE=1

:end
@endlocal & set ERROR_CODE=%ERROR_CODE%

if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
:skipRcPost

@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%"=="on" pause

if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%

cmd /C exit /B %ERROR_CODE%

@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements.  See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership.  The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with 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,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied.  See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------

@REM ----------------------------------------------------------------------------
@REM Apache Maven Wrapper startup batch script, version 3.1.1
@REM (Modified for the purposes of building Byte Buddy)
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM     e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------

@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%

@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")

@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
:skipRcPre

@setlocal

set ERROR_CODE=0

@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal

@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome

echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error

:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init

echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error

@REM ==== END VALIDATION ====

:init

@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.

set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir

set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir

:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir

:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"

:endDetectBaseDir

IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig

@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%

:endReadAdditionalConfig

@REM Use HTTP endpoints and legacy Maven if Java 6 or 7 is used to build (Byte Buddy edit)
set REPO_URL=http://insecure.repo1.maven.org
set WRAPPER_LOCATION=wrapper-legacy
set WRAPPER_PATH=io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
for /f tokens^=2-5^ delims^=.-_^" %%j in ('%JAVA_HOME%\bin\java -fullversion 2^>^&1') do set "JAVA_VERSION_STRING=%%j%%k%%l%%m"
IF NOT "%JAVA_VERSION_STRING:~0,3%"=="160" (
  IF NOT "%JAVA_VERSION_STRING:~0,3%"=="170" (
    set REPO_URL=https://repo.maven.apache.org
    set WRAPPER_LOCATION=wrapper
    set WRAPPER_PATH=org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
  )
)

SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\%WRAPPER_LOCATION%\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain

set WRAPPER_URL="%REPO_URL%/maven2/%WRAPPER_PATH%"

FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\%WRAPPER_LOCATION%\maven-wrapper.properties") DO (
    IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
)

@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
    if "%MVNW_VERBOSE%" == "true" (
        echo Found %WRAPPER_JAR%
    )
) else (
    if not "%MVNW_REPOURL%" == "" (
        SET WRAPPER_URL="%MVNW_REPOURL%/%WRAPPER_PATH%"
    )
    if "%MVNW_VERBOSE%" == "true" (
        echo Couldn't find %WRAPPER_JAR%, downloading it ...
        echo Downloading from: %WRAPPER_URL%
    )

    powershell -Command "&{"^
		"$webclient = new-object System.Net.WebClient;"^
		"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
		"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
		"}"^
		"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
		"}"
    if "%MVNW_VERBOSE%" == "true" (
        echo Finished downloading %WRAPPER_JAR%
    )
)
@REM End of extension

@REM Validate the Gradle wrapper's hash (Byte Buddy edit)
SET FILE_HASH=""
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\%WRAPPER_LOCATION%\maven-wrapper.properties") DO (
    IF "%%A"=="wrapperHash" SET FILE_HASH=%%B
)
IF NOT %FILE_HASH%=="" (
    IF NOT (Get-FileHash %MAVEN_PROJECTBASEDIR%\.mvn\%WRAPPER_LOCATION%\maven-wrapper.jar -Algorithm SHA256).hash=="%FILE_HASH%".toUpper() (
      echo Could not validate hash of maven-wrapper.jar
      goto error
    )
)

@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*

%MAVEN_JAVA_EXE% ^
  %JVM_CONFIG_MAVEN_PROPS% ^
  %MAVEN_OPTS% ^
  %MAVEN_DEBUG_OPTS% ^
  -classpath %WRAPPER_JAR% ^
  "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
  %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end

:error
set ERROR_CODE=1

:end
@endlocal & set ERROR_CODE=%ERROR_CODE%

if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
:skipRcPost

@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%"=="on" pause

if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%

cmd /C exit /B %ERROR_CODE%

Fix path.

Fix path.


rem #-- let powershell execute scripts
powershell -Command "Set-ExecutionPolicy Unrestricted -Force"
SET chocolatey_bin_root=c:\chocolatey\bin

rem #-- install chocolatey
powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"
SET PATH=%PATH%;%chocolatey_bin_root%

rem #-- install boxstarter
cinst boxstarter

powershell -ExecutionPolicy unrestricted -Command "Install-BoxstarterPackage -PackageName C:\hosthome\src\setup-windows\changepoint\setup.ps1"

add wininit for boxstarter

add wininit for boxstarter


REM Download latest ACE-World database, extract and import it
appveyor DownloadFile https://ci.appveyor.com/api/buildjobs/tcv394f0q590n1ik/artifacts/ACE-World-16PY-db-v0.0.5-ixhngyfm.sql.zip
7z x ACE-World-16PY-db-v0.0.5-ixhngyfm.sql.zip
"C:\Program Files\MySql\MySQL Server 5.7\bin\mysql.exe" -h localhost -u root -pPassword12! ace_world < ACE-World-16PY-db-v0.0.5-ixhngyfm.sql

REM Download latest ACE-World database, extract and import it
appveyor DownloadFile https://github.com/ACEmulator/ACE-World-16PY/releases/download/v0.0.5/ACE-World-16PY-db-v0.0.5.sql.zip
7z x ACE-World-16PY-db-v0.0.5.sql.zip
"C:\Program Files\MySql\MySQL Server 5.7\bin\mysql.exe" -h localhost -u root -pPassword12! ace_world < ACE-World-16PY-db-v0.0.5.sql

Update DownloadACEWorld.bat

Update DownloadACEWorld.bat


@echo off
echo called copy_post_pack.bat

@REM ============================================================
@REM Copy music files from original KaM TPR game
@REM ============================================================
@REM take music from previous KMR version for now
@REM xcopy "%KaMOrigDir%"\data\sfx\songs\*.sng "%kam_folder%"\Music\*.mp2 /y /r /s

REM ============================================================
REM Copy data folders
REM ============================================================
@REM Copy all data files, except sfx, which should be copied from KMRPrevVersionDir
xcopy ..\data\defines "%kam_folder%"\data\defines\ /y /r /s
xcopy ..\data\cursors "%kam_folder%"\data\cursors\ /y /r /s
xcopy ..\data\gfx "%kam_folder%"\data\gfx\ /y /r /s
@REM Copy *.rxx files only from the /data/Sprites folder, since we will copy *.rxa from the KMR private repo
xcopy ..\data\Sprites\*.rxx "%kam_folder%"\data\Sprites\ /y /r /s
REM xcopy ..\data\Sprites\*.rxa "%kam_folder%"\data\Sprites\ /y /r /s
xcopy ..\data\text "%kam_folder%"\data\text\ /y /r /s
xcopy ..\data\locales.txt "%kam_folder%"\data\locales.txt* /y /r /i
xcopy ..\Docs\Readme "%kam_folder%"\ /y /r /s
xcopy ..\Sounds "%kam_folder%"\Sounds\ /y /r /s
xcopy ..\Music "%kam_folder%"\Music\ /y /r /s
xcopy ..\lib "%kam_folder%"\lib\ /y /r /s
xcopy ..\"Modding graphics" "%kam_folder%"\"Modding graphics"\ /y /r /s

REM ============================================================
REM Copy *.rxa resource files
REM ============================================================
xcopy "%SpritesRXADir%"\*.rxa "%kam_folder%"\data\Sprites\ /y /r /s

call pull_maps.bat

REM ============================================================
REM Copy Maps, Campaigns and Tutorials
REM ============================================================
xcopy "%KMRMapsRepoDir%"\Campaigns "%kam_folder%"\Campaigns\ /y /r /s
xcopy "%KMRMapsRepoDir%"\Maps "%kam_folder%"\Maps\ /y /r /s /exclude:excluded_test_maps.txt
xcopy "%KMRMapsRepoDir%"\MapsMP "%kam_folder%"\MapsMP\ /y /r /s
xcopy "%KMRMapsRepoDir%"\Tutorials "%kam_folder%"\Tutorials\ /y /r /s

REM ============================================================
REM Copy video files
REM ============================================================
xcopy "%KMRPrivateRepoDir%"\Video "%kam_folder%" /y /r /s

REM ============================================================
REM Copy files from KMRPrevVersionDir
REM ============================================================
xcopy "%KMRPrevVersionDir%"\data\sfx "%kam_folder%"\data\sfx\ /y /r /s
xcopy "%KMRPrevVersionDir%"\Music "%kam_folder%"\Music\ /y /r /s
xcopy "%KMRPrevVersionDir%"\Campaigns\*.mp3 "%kam_folder%"\Campaigns\ /y /r /s

@REM ============================================================
@REM Erase source-code files from copied "data\"
@REM ============================================================
@REM erase /F /Q /S .\"%kam_folder%"\*.inc

REM ============================================================
REM Copy selected executable files
REM ============================================================
@REM Adding * to the file name supresses the "Is it a file or a folder" query
@REM xcopy ..\data.pack .\"%kam_folder%"\data.pack* /y /r /i
xcopy ..\KaM_Remake.exe "%kam_folder%"\KaM_Remake.exe* /y /r /i
REM xcopy ..\libzplay.dll "%kam_folder%"\libzplay.dll* /y /r /i
xcopy ..\bass.dll "%kam_folder%"\bass.dll* /y /r /i
xcopy ..\ogg.dll "%kam_folder%"\ogg.dll* /y /r /i
xcopy ..\vorbis.dll "%kam_folder%"\vorbis.dll* /y /r /i
xcopy ..\vorbisfile.dll "%kam_folder%"\vorbisfile.dll* /y /r /i
xcopy ..\Installer\uninst_clean.bat "%kam_folder%"\uninst_clean.bat* /y /r /i
xcopy ..\Installer\oalinst.exe "%kam_folder%"\oalinst.exe* /y /r /i

mkdir "%kam_folder%"\Utils

@REM copy ScriptingEditor
if %IncludeScriptingEditor%==True (
  xcopy "%ScriptingEditorDir%"\bin\ScriptingEditor.exe* "%kam_folder%"\Utils\ScriptingEditor /y /r /i
  xcopy "%ScriptingEditorDir%"\bin\SE_Data_KMR "%kam_folder%"\Utils\ScriptingEditor\SE_Data\ /y /r /s
  xcopy "%ScriptingEditorDir%"\bin\SE_Data\Examples "%kam_folder%"\Utils\ScriptingEditor\SE_Data\Examples\ /y /r /s
  xcopy "..\Utils\ScriptValidator\ScriptValidator.exe" "%kam_folder%"\Utils\ScriptingEditor\SE_Data\ScriptValidator.exe* /y /r /i
  REM erase "%kam_folder%"\Utils\ScriptingEditor\SE_Data\ScriptValidator.exe
  @REM no need for OLD and Logs folders there
  rmdir /S /Q "%kam_folder%"\Utils\ScriptingEditor\SE_Data\OLD
  rmdir /S /Q "%kam_folder%"\Utils\ScriptingEditor\SE_Data\Logs
)

@REM copy utility applications exe files
xcopy ..\KM_TextIDs.inc "%kam_folder%"\Utils\KM_TextIDs.inc* /y /r /i
xcopy "..\Utils\Campaign builder\KaM_Remake_Settings_ini_readme.txt" "%kam_folder%"\Utils\KaM_Remake_Settings_ini_readme.txt* /y /r /i
xcopy "..\Utils\Campaign builder\CampaignBuilder.exe" "%kam_folder%"\Utils\CampaignBuilder.exe* /y /r /i
xcopy "..\Utils\DedicatedServer\KaM_DedicatedServer.exe" "%kam_folder%"\Utils\KaM_Remake_Server_win32.exe* /y /r /i
xcopy "..\Utils\DedicatedServerGUI\KaM_DedicatedServerGUI.exe" "%kam_folder%"\Utils\KaM_Remake_ServerGUI_win32.exe* /y /r /i
xcopy "..\Utils\ScriptValidator\ScriptValidator.exe" "%kam_folder%"\Utils\ScriptValidator.exe* /y /r /i
xcopy "..\Utils\TranslationManager\TranslationManager.exe" "%kam_folder%"\Utils\TranslationManager.exe* /y /r /i
@REM copy linux dedicated servers
xcopy "..\Utils\DedicatedServer\KaM_Remake_Server_linux_x86" "%kam_folder%"\Utils\KaM_Remake_Server_linux_x86* /y /r /i
xcopy "..\Utils\DedicatedServer\KaM_Remake_Server_linux_x86_64" "%kam_folder%"\Utils\KaM_Remake_Server_linux_x86_64* /y /r /i

@echo off
echo called copy_post_pack.bat

@REM ============================================================
@REM Copy music files from original KaM TPR game
@REM ============================================================
@REM take music from previous KMR version for now
@REM xcopy "%KaMOrigDir%"\data\sfx\songs\*.sng "%kam_folder%"\Music\*.mp2 /y /r /s

REM ============================================================
REM Copy data folders
REM ============================================================
@REM Copy all data files, except sfx, which should be copied from KMRPrevVersionDir
xcopy ..\data\defines "%kam_folder%"\data\defines\ /y /r /s
xcopy ..\data\cursors "%kam_folder%"\data\cursors\ /y /r /s
xcopy ..\data\gfx "%kam_folder%"\data\gfx\ /y /r /s
@REM Copy *.rxx files only from the /data/Sprites folder, since we will copy *.rxa from the KMR private repo
xcopy ..\data\Sprites\*.rxx "%kam_folder%"\data\Sprites\ /y /r /s
REM xcopy ..\data\Sprites\*.rxa "%kam_folder%"\data\Sprites\ /y /r /s
xcopy ..\data\text "%kam_folder%"\data\text\ /y /r /s
xcopy ..\data\locales.txt "%kam_folder%"\data\locales.txt* /y /r /i
xcopy ..\Docs\Readme "%kam_folder%"\ /y /r /s
xcopy ..\Sounds "%kam_folder%"\Sounds\ /y /r /s
xcopy ..\Music "%kam_folder%"\Music\ /y /r /s
xcopy ..\lib "%kam_folder%"\lib\ /y /r /s
xcopy ..\"Modding graphics" "%kam_folder%"\"Modding graphics"\ /y /r /s

REM ============================================================
REM Copy *.rxa resource files
REM ============================================================
REM xcopy "%SpritesRXADir%"\*.rxa "%kam_folder%"\data\Sprites\ /y /r /s

call pull_maps.bat

REM ============================================================
REM Copy Maps, Campaigns and Tutorials
REM ============================================================
xcopy "%KMRMapsRepoDir%"\Campaigns "%kam_folder%"\Campaigns\ /y /r /s
xcopy "%KMRMapsRepoDir%"\Maps "%kam_folder%"\Maps\ /y /r /s /exclude:excluded_test_maps.txt
xcopy "%KMRMapsRepoDir%"\MapsMP "%kam_folder%"\MapsMP\ /y /r /s
xcopy "%KMRMapsRepoDir%"\Tutorials "%kam_folder%"\Tutorials\ /y /r /s

REM ============================================================
REM Copy video files
REM ============================================================
xcopy "%KMRPrivateRepoDir%"\Video "%kam_folder%" /y /r /s

REM ============================================================
REM Copy files from KMRPrevVersionDir
REM ============================================================
xcopy "%KMRPrevVersionDir%"\data\sfx "%kam_folder%"\data\sfx\ /y /r /s
xcopy "%KMRPrevVersionDir%"\Music "%kam_folder%"\Music\ /y /r /s
xcopy "%KMRPrevVersionDir%"\Campaigns\*.mp3 "%kam_folder%"\Campaigns\ /y /r /s

@REM ============================================================
@REM Erase source-code files from copied "data\"
@REM ============================================================
@REM erase /F /Q /S .\"%kam_folder%"\*.inc

REM ============================================================
REM Copy selected executable files
REM ============================================================
@REM Adding * to the file name supresses the "Is it a file or a folder" query
@REM xcopy ..\data.pack .\"%kam_folder%"\data.pack* /y /r /i
xcopy ..\KaM_Remake.exe "%kam_folder%"\KaM_Remake.exe* /y /r /i
REM xcopy ..\libzplay.dll "%kam_folder%"\libzplay.dll* /y /r /i
xcopy ..\bass.dll "%kam_folder%"\bass.dll* /y /r /i
xcopy ..\ogg.dll "%kam_folder%"\ogg.dll* /y /r /i
xcopy ..\vorbis.dll "%kam_folder%"\vorbis.dll* /y /r /i
xcopy ..\vorbisfile.dll "%kam_folder%"\vorbisfile.dll* /y /r /i
xcopy ..\Installer\uninst_clean.bat "%kam_folder%"\uninst_clean.bat* /y /r /i
xcopy ..\Installer\oalinst.exe "%kam_folder%"\oalinst.exe* /y /r /i

mkdir "%kam_folder%"\Utils

@REM copy ScriptingEditor
if %IncludeScriptingEditor%==True (
  xcopy "%ScriptingEditorDir%"\bin\ScriptingEditor.exe* "%kam_folder%"\Utils\ScriptingEditor /y /r /i
  xcopy "%ScriptingEditorDir%"\bin\SE_Data_KMR "%kam_folder%"\Utils\ScriptingEditor\SE_Data\ /y /r /s
  xcopy "%ScriptingEditorDir%"\bin\SE_Data\Examples "%kam_folder%"\Utils\ScriptingEditor\SE_Data\Examples\ /y /r /s
  xcopy "..\Utils\ScriptValidator\ScriptValidator.exe" "%kam_folder%"\Utils\ScriptingEditor\SE_Data\ScriptValidator.exe* /y /r /i
  REM erase "%kam_folder%"\Utils\ScriptingEditor\SE_Data\ScriptValidator.exe
  @REM no need for OLD and Logs folders there
  rmdir /S /Q "%kam_folder%"\Utils\ScriptingEditor\SE_Data\OLD
  rmdir /S /Q "%kam_folder%"\Utils\ScriptingEditor\SE_Data\Logs
)

@REM copy utility applications exe files
xcopy ..\KM_TextIDs.inc "%kam_folder%"\Utils\KM_TextIDs.inc* /y /r /i
xcopy "..\Utils\Campaign builder\KaM_Remake_Settings_ini_readme.txt" "%kam_folder%"\Utils\KaM_Remake_Settings_ini_readme.txt* /y /r /i
xcopy "..\Utils\Campaign builder\CampaignBuilder.exe" "%kam_folder%"\Utils\CampaignBuilder.exe* /y /r /i
xcopy "..\Utils\DedicatedServer\KaM_DedicatedServer.exe" "%kam_folder%"\Utils\KaM_Remake_Server_win32.exe* /y /r /i
xcopy "..\Utils\DedicatedServerGUI\KaM_DedicatedServerGUI.exe" "%kam_folder%"\Utils\KaM_Remake_ServerGUI_win32.exe* /y /r /i
xcopy "..\Utils\ScriptValidator\ScriptValidator.exe" "%kam_folder%"\Utils\ScriptValidator.exe* /y /r /i
xcopy "..\Utils\TranslationManager\TranslationManager.exe" "%kam_folder%"\Utils\TranslationManager.exe* /y /r /i
@REM copy linux dedicated servers
xcopy "..\Utils\DedicatedServer\KaM_Remake_Server_linux_x86" "%kam_folder%"\Utils\KaM_Remake_Server_linux_x86* /y /r /i
xcopy "..\Utils\DedicatedServer\KaM_Remake_Server_linux_x86_64" "%kam_folder%"\Utils\KaM_Remake_Server_linux_x86_64* /y /r /i

build scripts: do not use previously packer RXA files


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

:: #############################################################################
:: IF YOU'RE MODIFYING THIS FILE, PLEASE UPDATE:
::   `//learning/brain/testing/kokoro/common_windows.bat`
:: #############################################################################

@REM
@REM Set Environment Variables
@REM
IF NOT DEFINED PYTHON_DIRECTORY (
  SET PYTHON_DIRECTORY=Python36
)
SET PY_EXE=C:\%PYTHON_DIRECTORY%\python.exe
SET PIP_EXE=C:\%PYTHON_DIRECTORY%\Scripts\pip.exe
SET PATH=%PATH%;C:\%PYTHON_DIRECTORY%

@REM TODO(amitpatankar): Make an image with these packages and remove this.

%PIP_EXE% install setuptools --upgrade
%PIP_EXE% install future>=0.17.1 --no-deps
%PIP_EXE% install tf-estimator-nightly --no-deps
%PIP_EXE% install tb-nightly --no-deps
%PIP_EXE% install numpy --upgrade --no-deps
%PIP_EXE% install opt_einsum --upgrade
%PIP_EXE% install pandas --upgrade --no-deps
%PIP_EXE% install protobuf --upgrade --no-deps
%PIP_EXE% install keras_applications==1.0.8 --upgrade --no-deps
%PIP_EXE% install keras_preprocessing==1.1.0 --upgrade --no-deps
%PIP_EXE% install wrapt --upgrade --no-deps

IF "%PYTHON_DIRECTORY%"=="Python37" (
    %PIP_EXE% install astor==0.7.1
    %PIP_EXE% install absl-py==0.5.0
    %PIP_EXE% install colorama==0.3.9
    %PIP_EXE% install cycler==0.10.0
    %PIP_EXE% install gast==0.2.0
    %PIP_EXE% install jedi==0.11.1
    %PIP_EXE% install oauth2client==4.1.2
    %PIP_EXE% install portpicker==1.2.0
    %PIP_EXE% install parso==0.1.1
    %PIP_EXE% install protobuf==3.8.0
    %PIP_EXE% install scikit-learn==0.19.2
    %PIP_EXE% install scipy==1.1.0
    %PIP_EXE% install termcolor==1.1.0
)

:: Set cuda related environment variables. If we are not using CUDA, these are not used.
IF NOT DEFINED TF_CUDA_VERSION (
  SET TF_CUDA_VERSION=10.1
)
SET TF_CUDNN_VERSION=7
SET TF_CUDA_COMPUTE_CAPABILITIES=3.5,3.7,5.2,6.0,6.1,7.0
SET CUDA_TOOLKIT_PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v%TF_CUDA_VERSION%
SET CUDNN_INSTALL_PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v%TF_CUDA_VERSION%
SET PATH=%CUDA_TOOLKIT_PATH%\extras\CUPTI\libx64;%PATH%
SET PATH=%CUDA_TOOLKIT_PATH%\bin;%PATH%
SET PATH=%CUDNN_INSTALL_PATH%\bin;%PATH%

@REM
@REM Setup Bazel
@REM
:: Download Bazel from github and make sure its found in PATH.
SET BAZEL_VERSION=1.1.0
md C:\tools\bazel\
wget -q https://github.com/bazelbuild/bazel/releases/download/%BAZEL_VERSION%/bazel-%BAZEL_VERSION%-windows-x86_64.exe -O C:/tools/bazel/bazel.exe
SET PATH=C:\tools\bazel;%PATH%
bazel version

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

@REM
@REM Set Environment Variables
@REM
IF NOT DEFINED PYTHON_DIRECTORY (
  SET PYTHON_DIRECTORY=Python36
)
SET PY_EXE=C:\%PYTHON_DIRECTORY%\python.exe
SET PIP_EXE=C:\%PYTHON_DIRECTORY%\Scripts\pip.exe
SET PATH=%PATH%;C:\%PYTHON_DIRECTORY%

@REM TODO(amitpatankar): Make an image with these packages and remove this.

%PIP_EXE% install setuptools --upgrade
%PIP_EXE% install future>=0.17.1 --no-deps
%PIP_EXE% install tf-estimator-nightly --no-deps
%PIP_EXE% install tb-nightly --no-deps
%PIP_EXE% install numpy --upgrade --no-deps
%PIP_EXE% install opt_einsum --upgrade
%PIP_EXE% install pandas --upgrade --no-deps
%PIP_EXE% install protobuf --upgrade --no-deps
%PIP_EXE% install keras_applications==1.0.8 --upgrade --no-deps
%PIP_EXE% install keras_preprocessing==1.1.0 --upgrade --no-deps
%PIP_EXE% install wrapt --upgrade --no-deps

IF "%PYTHON_DIRECTORY%"=="Python37" (
    %PIP_EXE% install astor==0.7.1
    %PIP_EXE% install absl-py==0.5.0
    %PIP_EXE% install colorama==0.3.9
    %PIP_EXE% install cycler==0.10.0
    %PIP_EXE% install gast==0.2.0
    %PIP_EXE% install jedi==0.11.1
    %PIP_EXE% install oauth2client==4.1.2
    %PIP_EXE% install portpicker==1.2.0
    %PIP_EXE% install parso==0.1.1
    %PIP_EXE% install protobuf==3.8.0
    %PIP_EXE% install scikit-learn==0.19.2
    %PIP_EXE% install scipy==1.1.0
    %PIP_EXE% install termcolor==1.1.0
)

:: Set cuda related environment variables. If we are not using CUDA, these are not used.
IF NOT DEFINED TF_CUDA_VERSION (
  SET TF_CUDA_VERSION=10.1
)
SET TF_CUDNN_VERSION=7
SET TF_CUDA_COMPUTE_CAPABILITIES=3.5,3.7,5.2,6.0,6.1,7.0
SET CUDA_TOOLKIT_PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v%TF_CUDA_VERSION%
SET CUDNN_INSTALL_PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v%TF_CUDA_VERSION%
SET PATH=%CUDA_TOOLKIT_PATH%\extras\CUPTI\libx64;%PATH%
SET PATH=%CUDA_TOOLKIT_PATH%\bin;%PATH%
SET PATH=%CUDNN_INSTALL_PATH%\bin;%PATH%

@REM
@REM Setup Bazel
@REM
:: Download Bazel from github and make sure its found in PATH.
SET BAZEL_VERSION=1.1.0
md C:\tools\bazel\
wget -q https://github.com/bazelbuild/bazel/releases/download/%BAZEL_VERSION%/bazel-%BAZEL_VERSION%-windows-x86_64.exe -O C:/tools/bazel/bazel.exe
SET PATH=C:\tools\bazel;%PATH%
bazel version

Remove comments from `common_win.bat`.

Remove comments from `common_win.bat`.

PiperOrigin-RevId: 280511800
Change-Id: I6e93726439997e08b094334609d5b9309818459b


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.2/4638234/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.12/VBoxGuestAdditions_5.1.12.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.2/4638234/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.12/VBoxGuestAdditions_5.1.12.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

Install VirtualBox certs

Install VirtualBox certs


set VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_api_dump

rdmd gdi32.lib -g src/d/SwapChainTest1.d

set VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_api_dump

rdmd gdi32.lib -g -wi src/d/SwapChainTest1.d

update build .bat file

[D] : update build .bat file


set MAVEN_OPTS="-Xmx1G"

cmd.exe /c mvn clean compile assembly:single || echo ""

copy "%SRC_DIR%\target\tabula-%PKG_VERSION%-jar-with-dependencies.jar" "%LIBRARY_LIB%\"

echo java -Xmx500M -jar %LIBRARY_LIB%\\tabula.jar %* > %LIBRARY_BIN%\tabula.cmd
echo IF %%ERRORLEVEL%% NEQ 0 EXIT /B %%ERRORLEVEL%% >> %LIBRARY_BIN%\tabula.cmd

set MAVEN_OPTS="-Xmx1G"

cmd.exe /c mvn clean compile assembly:single || echo ""

copy "%SRC_DIR%\target\tabula-%PKG_VERSION%-jar-with-dependencies.jar" "%LIBRARY_LIB%\tabula.jar"

echo java -Xmx500M -jar %LIBRARY_LIB%\\tabula.jar %* > %LIBRARY_BIN%\tabula.cmd
echo IF %%ERRORLEVEL%% NEQ 0 EXIT /B %%ERRORLEVEL%% >> %LIBRARY_BIN%\tabula.cmd

Fix windows build location

Fix windows build location


Add gen-empty-database.bat : generates an empty database.


@echo on

if "%CU_VERSION%" == "cpu" (
    echo Skipping for CPU builds
    exit /b 0
)

set SRC_DIR=%~dp0\..

if not exist "%SRC_DIR%\temp_build" mkdir "%SRC_DIR%\temp_build"

set /a CUDA_VER=%CU_VERSION:cu=%
set CUDA_VER_MAJOR=%CUDA_VER:~0,-1%
set CUDA_VER_MINOR=%CUDA_VER:~-1,1%
set CUDA_VERSION_STR=%CUDA_VER_MAJOR%.%CUDA_VER_MINOR%

if %CUDA_VER% EQU 92 goto cuda92
if %CUDA_VER% EQU 100 goto cuda100
if %CUDA_VER% EQU 101 goto cuda101
if %CUDA_VER% EQU 102 goto cuda102
if %CUDA_VER% EQU 110 goto cuda110

echo CUDA %CUDA_VERSION_STR% is not supported
exit /b 1

:cuda92
if not exist "%SRC_DIR%\temp_build\cuda_9.2.148_win10.exe" (
    curl -k -L https://ossci-windows.s3.amazonaws.com/win2016/cuda_9.2.148_win10.exe --output "%SRC_DIR%\temp_build\cuda_9.2.148_win10.exe"
    if errorlevel 1 exit /b 1
    set "CUDA_SETUP_FILE=%SRC_DIR%\temp_build\cuda_9.2.148_win10.exe"
    set "ARGS=nvcc_9.2 cuobjdump_9.2 nvprune_9.2 cupti_9.2 cublas_9.2 cublas_dev_9.2 cudart_9.2 cufft_9.2 cufft_dev_9.2 curand_9.2 curand_dev_9.2 cusolver_9.2 cusolver_dev_9.2 cusparse_9.2 cusparse_dev_9.2 nvgraph_9.2 nvgraph_dev_9.2 npp_9.2 npp_dev_9.2 nvrtc_9.2 nvrtc_dev_9.2 nvml_dev_9.2"
)

if not exist "%SRC_DIR%\temp_build\cudnn-9.2-windows10-x64-v7.2.1.38.zip" (
    curl -k -L https://ossci-windows.s3.amazonaws.com/win2016/cudnn-9.2-windows10-x64-v7.2.1.38.zip --output "%SRC_DIR%\temp_build\cudnn-9.2-windows10-x64-v7.2.1.38.zip"
    if errorlevel 1 exit /b 1
    set "CUDNN_SETUP_FILE=%SRC_DIR%\temp_build\cudnn-9.2-windows10-x64-v7.2.1.38.zip"
)

goto cuda_common

:cuda100

if not exist "%SRC_DIR%\temp_build\cuda_10.0.130_411.31_win10.exe" (
    curl -k -L https://ossci-windows.s3.amazonaws.com/win2016/cuda_10.0.130_411.31_win10.exe --output "%SRC_DIR%\temp_build\cuda_10.0.130_411.31_win10.exe"
    if errorlevel 1 exit /b 1
    set "CUDA_SETUP_FILE=%SRC_DIR%\temp_build\cuda_10.0.130_411.31_win10.exe"
    set "ARGS=nvcc_10.0 cuobjdump_10.0 nvprune_10.0 cupti_10.0 cublas_10.0 cublas_dev_10.0 cudart_10.0 cufft_10.0 cufft_dev_10.0 curand_10.0 curand_dev_10.0 cusolver_10.0 cusolver_dev_10.0 cusparse_10.0 cusparse_dev_10.0 nvgraph_10.0 nvgraph_dev_10.0 npp_10.0 npp_dev_10.0 nvrtc_10.0 nvrtc_dev_10.0 nvml_dev_10.0"
)

if not exist "%SRC_DIR%\temp_build\cudnn-10.0-windows10-x64-v7.4.1.5.zip" (
    curl -k -L https://ossci-windows.s3.amazonaws.com/win2016/cudnn-10.0-windows10-x64-v7.4.1.5.zip --output "%SRC_DIR%\temp_build\cudnn-10.0-windows10-x64-v7.4.1.5.zip"
    if errorlevel 1 exit /b 1
    set "CUDNN_SETUP_FILE=%SRC_DIR%\temp_build\cudnn-10.0-windows10-x64-v7.4.1.5.zip"
)

goto cuda_common

:cuda101

if not exist "%SRC_DIR%\temp_build\cuda_10.1.243_426.00_win10.exe" (
    curl -k -L https://ossci-windows.s3.amazonaws.com/cuda_10.1.243_426.00_win10.exe --output "%SRC_DIR%\temp_build\cuda_10.1.243_426.00_win10.exe"
    if errorlevel 1 exit /b 1
    set "CUDA_SETUP_FILE=%SRC_DIR%\temp_build\cuda_10.1.243_426.00_win10.exe"
    set "ARGS=nvcc_10.1 cuobjdump_10.1 nvprune_10.1 cupti_10.1 cublas_10.1 cublas_dev_10.1 cudart_10.1 cufft_10.1 cufft_dev_10.1 curand_10.1 curand_dev_10.1 cusolver_10.1 cusolver_dev_10.1 cusparse_10.1 cusparse_dev_10.1 nvgraph_10.1 nvgraph_dev_10.1 npp_10.1 npp_dev_10.1 nvrtc_10.1 nvrtc_dev_10.1 nvml_dev_10.1"
)

if not exist "%SRC_DIR%\temp_build\cudnn-10.1-windows10-x64-v7.6.4.38.zip" (
    curl -k -L https://ossci-windows.s3.amazonaws.com/cudnn-10.1-windows10-x64-v7.6.4.38.zip --output "%SRC_DIR%\temp_build\cudnn-10.1-windows10-x64-v7.6.4.38.zip"
    if errorlevel 1 exit /b 1
    set "CUDNN_SETUP_FILE=%SRC_DIR%\temp_build\cudnn-10.1-windows10-x64-v7.6.4.38.zip"
)

goto cuda_common

:cuda102

if not exist "%SRC_DIR%\temp_build\cuda_10.2.89_441.22_win10.exe" (
    curl -k -L https://ossci-windows.s3.amazonaws.com/cuda_10.2.89_441.22_win10.exe --output "%SRC_DIR%\temp_build\cuda_10.2.89_441.22_win10.exe"
    if errorlevel 1 exit /b 1
    set "CUDA_SETUP_FILE=%SRC_DIR%\temp_build\cuda_10.2.89_441.22_win10.exe"
    set "ARGS=nvcc_10.2 cuobjdump_10.2 nvprune_10.2 cupti_10.2 cublas_10.2 cublas_dev_10.2 cudart_10.2 cufft_10.2 cufft_dev_10.2 curand_10.2 curand_dev_10.2 cusolver_10.2 cusolver_dev_10.2 cusparse_10.2 cusparse_dev_10.2 nvgraph_10.2 nvgraph_dev_10.2 npp_10.2 npp_dev_10.2 nvrtc_10.2 nvrtc_dev_10.2 nvml_dev_10.2"
)

if not exist "%SRC_DIR%\temp_build\cudnn-10.2-windows10-x64-v7.6.5.32.zip" (
    curl -k -L https://ossci-windows.s3.amazonaws.com/cudnn-10.2-windows10-x64-v7.6.5.32.zip --output "%SRC_DIR%\temp_build\cudnn-10.2-windows10-x64-v7.6.5.32.zip"
    if errorlevel 1 exit /b 1
    set "CUDNN_SETUP_FILE=%SRC_DIR%\temp_build\cudnn-10.2-windows10-x64-v7.6.5.32.zip"
)

goto cuda_common

:cuda110

if not exist "%SRC_DIR%\temp_build\cuda_11.0.2_451.48_win10.exe" (
    curl -k -L https://ossci-windows.s3.amazonaws.com/cuda_11.0.2_451.48_win10.exe --output "%SRC_DIR%\temp_build\cuda_11.0.2_451.48_win10.exe"
    if errorlevel 1 exit /b 1
    set "CUDA_SETUP_FILE=%SRC_DIR%\temp_build\cuda_11.0.2_451.48_win10.exe"
    set "ARGS=nvcc_11.0 cuobjdump_11.0 nvprune_11.0 nvprof_11.0 cupti_11.0 cublas_11.0 cublas_dev_11.0 cudart_11.0 cufft_11.0 cufft_dev_11.0 curand_11.0 curand_dev_11.0 cusolver_11.0 cusolver_dev_11.0 cusparse_11.0 cusparse_dev_11.0 npp_11.0 npp_dev_11.0 nvrtc_11.0 nvrtc_dev_11.0 nvml_dev_11.0"
)

if not exist "%SRC_DIR%\temp_build\cudnn-11.0-windows-x64-v8.0.2.39.zip" (
    curl -k -L https://ossci-windows.s3.amazonaws.com/cudnn-11.0-windows-x64-v8.0.2.39.zip --output "%SRC_DIR%\temp_build\cudnn-11.0-windows-x64-v8.0.2.39.zip"
    if errorlevel 1 exit /b 1
    set "CUDNN_SETUP_FILE=%SRC_DIR%\temp_build\cudnn-11.0-windows-x64-v8.0.2.39.zip"
)

goto cuda_common

:cuda_common

if not exist "%SRC_DIR%\temp_build\NvToolsExt.7z" (
    curl -k -L https://www.dropbox.com/s/9mcolalfdj4n979/NvToolsExt.7z?dl=1 --output "%SRC_DIR%\temp_build\NvToolsExt.7z"
    if errorlevel 1 exit /b 1
)

if not exist "%SRC_DIR%\temp_build\gpu_driver_dlls.7z" (
    curl -k -L "https://drive.google.com/u/0/uc?id=1injUyo3lnarMgWyRcXqKg4UGnN0ysmuq&export=download" --output "%SRC_DIR%\temp_build\gpu_driver_dlls.zip"
    if errorlevel 1 exit /b 1
)

echo Installing CUDA toolkit...
7z x %CUDA_SETUP_FILE% -o"%SRC_DIR%\temp_build\cuda"
pushd "%SRC_DIR%\temp_build\cuda"
start /wait setup.exe -s %ARGS%
popd

echo Installing VS integration...
xcopy /Y "%SRC_DIR%\temp_build\cuda\CUDAVisualStudioIntegration\extras\visual_studio_integration\MSBuildExtensions\*.*" "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets\BuildCustomizations"

echo Installing NvToolsExt...
7z x %SRC_DIR%\temp_build\NvToolsExt.7z -o"%SRC_DIR%\temp_build\NvToolsExt"
mkdir "%ProgramFiles%\NVIDIA Corporation\NvToolsExt\bin\x64"
mkdir "%ProgramFiles%\NVIDIA Corporation\NvToolsExt\include"
mkdir "%ProgramFiles%\NVIDIA Corporation\NvToolsExt\lib\x64"
xcopy /Y "%SRC_DIR%\temp_build\NvToolsExt\bin\x64\*.*" "%ProgramFiles%\NVIDIA Corporation\NvToolsExt\bin\x64"
xcopy /Y "%SRC_DIR%\temp_build\NvToolsExt\include\*.*" "%ProgramFiles%\NVIDIA Corporation\NvToolsExt\include"
xcopy /Y "%SRC_DIR%\temp_build\NvToolsExt\lib\x64\*.*" "%ProgramFiles%\NVIDIA Corporation\NvToolsExt\lib\x64"

echo Setting up environment...
set "PATH=%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\bin;%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\libnvvp;%PATH%"
set "CUDA_PATH=%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%"
set "CUDA_PATH_V%CUDA_VER_MAJOR%_%CUDA_VER_MINOR%=%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%"
set "NVTOOLSEXT_PATH=%ProgramFiles%\NVIDIA Corporation\NvToolsExt\bin\x64"

if not exist "%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\bin\nvcc.exe" (
    echo CUDA %CUDA_VERSION_STR% installed failed.
    exit /b 1
)

echo Installing cuDNN...
7z x %CUDNN_SETUP_FILE% -o"%SRC_DIR%\temp_build\cudnn"
xcopy /Y "%SRC_DIR%\temp_build\cudnn\cuda\bin\*.*" "%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\bin"
xcopy /Y "%SRC_DIR%\temp_build\cudnn\cuda\lib\x64\*.*" "%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\lib\x64"
xcopy /Y "%SRC_DIR%\temp_build\cudnn\cuda\include\*.*" "%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\include"

echo Installing GPU driver DLLs
7z x %SRC_DIR%\temp_build\gpu_driver_dlls.zip -o"C:\Windows\System32"

echo Cleaning temp files
rd /s /q "%SRC_DIR%\temp_build" || ver > nul

@echo on

if "%CU_VERSION%" == "cpu" (
    echo Skipping for CPU builds
    exit /b 0
)

set SRC_DIR=%~dp0\..

if not exist "%SRC_DIR%\temp_build" mkdir "%SRC_DIR%\temp_build"

set /a CUDA_VER=%CU_VERSION:cu=%
set CUDA_VER_MAJOR=%CUDA_VER:~0,-1%
set CUDA_VER_MINOR=%CUDA_VER:~-1,1%
set CUDA_VERSION_STR=%CUDA_VER_MAJOR%.%CUDA_VER_MINOR%

if %CUDA_VER% EQU 92 goto cuda92
if %CUDA_VER% EQU 100 goto cuda100
if %CUDA_VER% EQU 101 goto cuda101
if %CUDA_VER% EQU 102 goto cuda102
if %CUDA_VER% EQU 110 goto cuda110

echo CUDA %CUDA_VERSION_STR% is not supported
exit /b 1

:cuda92
if not exist "%SRC_DIR%\temp_build\cuda_9.2.148_win10.exe" (
    curl -k -L https://ossci-windows.s3.amazonaws.com/win2016/cuda_9.2.148_win10.exe --output "%SRC_DIR%\temp_build\cuda_9.2.148_win10.exe"
    if errorlevel 1 exit /b 1
    set "CUDA_SETUP_FILE=%SRC_DIR%\temp_build\cuda_9.2.148_win10.exe"
    set "ARGS=nvcc_9.2 cuobjdump_9.2 nvprune_9.2 cupti_9.2 cublas_9.2 cublas_dev_9.2 cudart_9.2 cufft_9.2 cufft_dev_9.2 curand_9.2 curand_dev_9.2 cusolver_9.2 cusolver_dev_9.2 cusparse_9.2 cusparse_dev_9.2 nvgraph_9.2 nvgraph_dev_9.2 npp_9.2 npp_dev_9.2 nvrtc_9.2 nvrtc_dev_9.2 nvml_dev_9.2"
)

if not exist "%SRC_DIR%\temp_build\cudnn-9.2-windows10-x64-v7.2.1.38.zip" (
    curl -k -L https://ossci-windows.s3.amazonaws.com/win2016/cudnn-9.2-windows10-x64-v7.2.1.38.zip --output "%SRC_DIR%\temp_build\cudnn-9.2-windows10-x64-v7.2.1.38.zip"
    if errorlevel 1 exit /b 1
    set "CUDNN_SETUP_FILE=%SRC_DIR%\temp_build\cudnn-9.2-windows10-x64-v7.2.1.38.zip"
)

goto cuda_common

:cuda100

if not exist "%SRC_DIR%\temp_build\cuda_10.0.130_411.31_win10.exe" (
    curl -k -L https://ossci-windows.s3.amazonaws.com/win2016/cuda_10.0.130_411.31_win10.exe --output "%SRC_DIR%\temp_build\cuda_10.0.130_411.31_win10.exe"
    if errorlevel 1 exit /b 1
    set "CUDA_SETUP_FILE=%SRC_DIR%\temp_build\cuda_10.0.130_411.31_win10.exe"
    set "ARGS=nvcc_10.0 cuobjdump_10.0 nvprune_10.0 cupti_10.0 cublas_10.0 cublas_dev_10.0 cudart_10.0 cufft_10.0 cufft_dev_10.0 curand_10.0 curand_dev_10.0 cusolver_10.0 cusolver_dev_10.0 cusparse_10.0 cusparse_dev_10.0 nvgraph_10.0 nvgraph_dev_10.0 npp_10.0 npp_dev_10.0 nvrtc_10.0 nvrtc_dev_10.0 nvml_dev_10.0"
)

if not exist "%SRC_DIR%\temp_build\cudnn-10.0-windows10-x64-v7.4.1.5.zip" (
    curl -k -L https://ossci-windows.s3.amazonaws.com/win2016/cudnn-10.0-windows10-x64-v7.4.1.5.zip --output "%SRC_DIR%\temp_build\cudnn-10.0-windows10-x64-v7.4.1.5.zip"
    if errorlevel 1 exit /b 1
    set "CUDNN_SETUP_FILE=%SRC_DIR%\temp_build\cudnn-10.0-windows10-x64-v7.4.1.5.zip"
)

goto cuda_common

:cuda101

if not exist "%SRC_DIR%\temp_build\cuda_10.1.243_426.00_win10.exe" (
    curl -k -L https://ossci-windows.s3.amazonaws.com/cuda_10.1.243_426.00_win10.exe --output "%SRC_DIR%\temp_build\cuda_10.1.243_426.00_win10.exe"
    if errorlevel 1 exit /b 1
    set "CUDA_SETUP_FILE=%SRC_DIR%\temp_build\cuda_10.1.243_426.00_win10.exe"
    set "ARGS=nvcc_10.1 cuobjdump_10.1 nvprune_10.1 cupti_10.1 cublas_10.1 cublas_dev_10.1 cudart_10.1 cufft_10.1 cufft_dev_10.1 curand_10.1 curand_dev_10.1 cusolver_10.1 cusolver_dev_10.1 cusparse_10.1 cusparse_dev_10.1 nvgraph_10.1 nvgraph_dev_10.1 npp_10.1 npp_dev_10.1 nvrtc_10.1 nvrtc_dev_10.1 nvml_dev_10.1"
)

if not exist "%SRC_DIR%\temp_build\cudnn-10.1-windows10-x64-v7.6.4.38.zip" (
    curl -k -L https://ossci-windows.s3.amazonaws.com/cudnn-10.1-windows10-x64-v7.6.4.38.zip --output "%SRC_DIR%\temp_build\cudnn-10.1-windows10-x64-v7.6.4.38.zip"
    if errorlevel 1 exit /b 1
    set "CUDNN_SETUP_FILE=%SRC_DIR%\temp_build\cudnn-10.1-windows10-x64-v7.6.4.38.zip"
)

goto cuda_common

:cuda102

if not exist "%SRC_DIR%\temp_build\cuda_10.2.89_441.22_win10.exe" (
    curl -k -L https://ossci-windows.s3.amazonaws.com/cuda_10.2.89_441.22_win10.exe --output "%SRC_DIR%\temp_build\cuda_10.2.89_441.22_win10.exe"
    if errorlevel 1 exit /b 1
    set "CUDA_SETUP_FILE=%SRC_DIR%\temp_build\cuda_10.2.89_441.22_win10.exe"
    set "ARGS=nvcc_10.2 cuobjdump_10.2 nvprune_10.2 cupti_10.2 cublas_10.2 cublas_dev_10.2 cudart_10.2 cufft_10.2 cufft_dev_10.2 curand_10.2 curand_dev_10.2 cusolver_10.2 cusolver_dev_10.2 cusparse_10.2 cusparse_dev_10.2 nvgraph_10.2 nvgraph_dev_10.2 npp_10.2 npp_dev_10.2 nvrtc_10.2 nvrtc_dev_10.2 nvml_dev_10.2"
)

if not exist "%SRC_DIR%\temp_build\cudnn-10.2-windows10-x64-v7.6.5.32.zip" (
    curl -k -L https://ossci-windows.s3.amazonaws.com/cudnn-10.2-windows10-x64-v7.6.5.32.zip --output "%SRC_DIR%\temp_build\cudnn-10.2-windows10-x64-v7.6.5.32.zip"
    if errorlevel 1 exit /b 1
    set "CUDNN_SETUP_FILE=%SRC_DIR%\temp_build\cudnn-10.2-windows10-x64-v7.6.5.32.zip"
)

goto cuda_common

:cuda110

if not exist "%SRC_DIR%\temp_build\cuda_11.0.2_451.48_win10.exe" (
    curl -k -L https://ossci-windows.s3.amazonaws.com/cuda_11.0.2_451.48_win10.exe --output "%SRC_DIR%\temp_build\cuda_11.0.2_451.48_win10.exe"
    if errorlevel 1 exit /b 1
    set "CUDA_SETUP_FILE=%SRC_DIR%\temp_build\cuda_11.0.2_451.48_win10.exe"
    set "ARGS=nvcc_11.0 cuobjdump_11.0 nvprune_11.0 nvprof_11.0 cupti_11.0 cublas_11.0 cublas_dev_11.0 cudart_11.0 cufft_11.0 cufft_dev_11.0 curand_11.0 curand_dev_11.0 cusolver_11.0 cusolver_dev_11.0 cusparse_11.0 cusparse_dev_11.0 npp_11.0 npp_dev_11.0 nvrtc_11.0 nvrtc_dev_11.0 nvml_dev_11.0"
)

if not exist "%SRC_DIR%\temp_build\cudnn-11.0-windows-x64-v8.0.4.30.zip" (
    curl -k -L https://ossci-windows.s3.amazonaws.com/cudnn-11.0-windows-x64-v8.0.4.30.zip --output "%SRC_DIR%\temp_build\cudnn-11.0-windows-x64-v8.0.4.30.zip"
    if errorlevel 1 exit /b 1
    set "CUDNN_SETUP_FILE=%SRC_DIR%\temp_build\cudnn-11.0-windows-x64-v8.0.4.30.zip"
)

goto cuda_common

:cuda_common

if not exist "%SRC_DIR%\temp_build\NvToolsExt.7z" (
    curl -k -L https://www.dropbox.com/s/9mcolalfdj4n979/NvToolsExt.7z?dl=1 --output "%SRC_DIR%\temp_build\NvToolsExt.7z"
    if errorlevel 1 exit /b 1
)

if not exist "%SRC_DIR%\temp_build\gpu_driver_dlls.7z" (
    curl -k -L "https://drive.google.com/u/0/uc?id=1injUyo3lnarMgWyRcXqKg4UGnN0ysmuq&export=download" --output "%SRC_DIR%\temp_build\gpu_driver_dlls.zip"
    if errorlevel 1 exit /b 1
)

echo Installing CUDA toolkit...
7z x %CUDA_SETUP_FILE% -o"%SRC_DIR%\temp_build\cuda"
pushd "%SRC_DIR%\temp_build\cuda"
start /wait setup.exe -s %ARGS%
popd

echo Installing VS integration...
xcopy /Y "%SRC_DIR%\temp_build\cuda\CUDAVisualStudioIntegration\extras\visual_studio_integration\MSBuildExtensions\*.*" "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets\BuildCustomizations"

echo Installing NvToolsExt...
7z x %SRC_DIR%\temp_build\NvToolsExt.7z -o"%SRC_DIR%\temp_build\NvToolsExt"
mkdir "%ProgramFiles%\NVIDIA Corporation\NvToolsExt\bin\x64"
mkdir "%ProgramFiles%\NVIDIA Corporation\NvToolsExt\include"
mkdir "%ProgramFiles%\NVIDIA Corporation\NvToolsExt\lib\x64"
xcopy /Y "%SRC_DIR%\temp_build\NvToolsExt\bin\x64\*.*" "%ProgramFiles%\NVIDIA Corporation\NvToolsExt\bin\x64"
xcopy /Y "%SRC_DIR%\temp_build\NvToolsExt\include\*.*" "%ProgramFiles%\NVIDIA Corporation\NvToolsExt\include"
xcopy /Y "%SRC_DIR%\temp_build\NvToolsExt\lib\x64\*.*" "%ProgramFiles%\NVIDIA Corporation\NvToolsExt\lib\x64"

echo Setting up environment...
set "PATH=%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\bin;%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\libnvvp;%PATH%"
set "CUDA_PATH=%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%"
set "CUDA_PATH_V%CUDA_VER_MAJOR%_%CUDA_VER_MINOR%=%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%"
set "NVTOOLSEXT_PATH=%ProgramFiles%\NVIDIA Corporation\NvToolsExt\bin\x64"

if not exist "%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\bin\nvcc.exe" (
    echo CUDA %CUDA_VERSION_STR% installed failed.
    exit /b 1
)

echo Installing cuDNN...
7z x %CUDNN_SETUP_FILE% -o"%SRC_DIR%\temp_build\cudnn"
xcopy /Y "%SRC_DIR%\temp_build\cudnn\cuda\bin\*.*" "%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\bin"
xcopy /Y "%SRC_DIR%\temp_build\cudnn\cuda\lib\x64\*.*" "%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\lib\x64"
xcopy /Y "%SRC_DIR%\temp_build\cudnn\cuda\include\*.*" "%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\include"

echo Installing GPU driver DLLs
7z x %SRC_DIR%\temp_build\gpu_driver_dlls.zip -o"C:\Windows\System32"

echo Cleaning temp files
rd /s /q "%SRC_DIR%\temp_build" || ver > nul

Bump up windows cudnn version (#2837)

Bump up windows cudnn version (#2837)


@echo off

if [%1] EQU [--path-only] goto path_only

:: Start the goodness
call clink inject --quiet

:: Setup aliases
if not exist %DOT%\clink\aliases (
  "%GIT_INSTALL_ROOT%\usr\bin\bash" --login %DOT%\clink\collect-aliases.sh
)
doskey /macrofile=%DOT%\clink\aliases

:: ENV
set _ZL_NO_CHECK=1
set FZF_DEFAULT_COMMAND=fd -t f
set FZF_DEFAULT_OPTS=--height=40%% --color=dark,gutter:-1 --layout=reverse --bind "alt-e:execute(nvr {})+abort"

:: Clean title
title cmd

:: Setup PATH
:path_only
if exist %USERPROFILE%\bin\ set PATH=%USERPROFILE%\bin;%PATH%
set PATH=%DOT%\win\bin;%PATH%
for /F %%p in ('scoop prefix z.lua') do set PATH=%PATH%;%%p

@echo off

if [%1] EQU [--path-only] goto path_only

:: Start the goodness
call clink inject --quiet

:: Setup aliases
if not exist %DOT%\clink\aliases (
  "%GIT_INSTALL_ROOT%\usr\bin\bash" --login %DOT%\clink\collect-aliases.sh
)
doskey /macrofile=%DOT%\clink\aliases

:: ENV
set _ZL_NO_CHECK=1
set FZF_DEFAULT_COMMAND=fd -t f
set FZF_DEFAULT_OPTS=--height=40%% --layout=reverse ^
    --bind "alt-e:execute(nvr {})+abort" ^
    --color=dark,gutter:-1 ^
    --color=fg:#f8f8f2,hl:#bd93f9 ^
    --color=fg+:#f8f8f2,bg+:#44475a,hl+:#bd93f9 ^
    --color=info:#ffb86c,prompt:#50fa7b,pointer:#ff79c6 ^
    --color=marker:#ff79c6,spinner:#ffb86c,header:#6272a4

:: Clean title
title cmd

:: Setup PATH
:path_only
if exist %USERPROFILE%\bin\ set PATH=%USERPROFILE%\bin;%PATH%
set PATH=%DOT%\win\bin;%PATH%
for /F %%p in ('scoop prefix z.lua') do set PATH=%PATH%;%%p

use dracula theme

fzf: use dracula theme