<# :
@echo off
setlocal
set "POWERSHELL_BAT_ARGS=%*"
if defined POWERSHELL_BAT_ARGS set "POWERSHELL_BAT_ARGS=%POWERSHELL_BAT_ARGS:"=\"%"
endlocal & powershell -NoLogo -NoProfile -Command "$_ = $input; Invoke-Expression $( '$input = $_; $_ = \"\"; $args = @( &{ $args } %POWERSHELL_BAT_ARGS% );' + [String]::Join( [char]10, $( Get-Content \"%~f0\" ) ) )"
goto :EOF
#>

$packages = @(

	@{
		"name" = "7-zip";
		"home" = "http://7-zip.org/";
		"url" = "http://downloads.sourceforge.net/sevenzip/7za920.zip";
		"dir" = "7za";
		"postinstall" = {
			$dir = $args[0];
			$script:7zip_exe = "$dir\7za.exe";
		};
	}

	@{
		"name" = "ConEmu";
		"home" = "https://github.com/Maximus5/ConEmu/";
		"url" = "https://github.com/Maximus5/ConEmu/releases/download/v15.06.10/ConEmuPack.150610.7z";
		"dir" = "ConEmu";
	}

	@{
		"name" = "Clink";
		"home" = "http://mridgers.github.io/clink";
		"url" = "https://github.com/mridgers/clink/releases/download/0.4.4/clink_0.4.4.zip";
		"dir" = "clink";
		"onlyFiles" = $True;
		"postinstall" = {
			$dir = $args[0];
			ls $dir |
			? { $_.Attributes -eq "Directory" } |
			% { rmdir -Force -Path "$dir\$_"; };
		};
	}

	@{
		"name" = "Far3";
		"home" = "http://www.farmanager.com/";
#-		"url" = "http://www.farmanager.com/files/Far30b4400.x86.20150709.7z";
		"url" = "http://www.farmanager.com/files/Far30b4444.x86.20151024.7z";
		"dir" = "Far3";
	}

	@{
		"skip" = $True;
		"name" = "Far3bis";
		"home" = "http://code.google.com/p/conemu-maximus5/";
		"url" = "http://downloads.sourceforge.net/project/conemu/FarManager/Far3bis/far3.4254bis.x86.x64.7z";
		"dir" = "Far3bis";
	}

	@{
		"name" = "Notepad2-mod";
		"home" = "http://xhmikosr.github.io/notepad2-mod/";
		"url" = "https://github.com/XhmikosR/notepad2-mod/releases/download/4.2.25.940/Notepad2-mod.4.2.25.940_x86.zip";
		"dir" = "notepad2-mod";
		"postinstall" = {
			$dir = $args[0];
			$ini = "$dir\Notepad2.ini";
			mv -Force -Path "$ini" -Destination "$ini.orig";
			& {
				"[Notepad2]";
				"Notepad2.ini=..\..\etc\notepad2\Notepad2.ini";
			} | Out-File "$ini";
		};
	}

	@{
		"name" = "UnxUtils";
		"home" = "http://unxutils.sourceforge.met/";
		"url" = "http://downloads.sourceforge.net/project/unxutils/unxutils/current/UnxUtils.zip";
		"dir" = "unxutils";
		"postinstall" = {
			$dir = $args[0];
			$src = "$dir\usr\local\wbin\*";
			$dst = "$dir\bin";
			mv -Force -Path $src -Destination $dst;
		};
	}

	@{
		"name" = "UnxUtils Updates";
		"home" = "http://unxutils.sourceforge.met/";
		"url" = "http://unxutils.sourceforge.net/UnxUpdates.zip";
		"dir" = "unxutils\bin";
	}

);

# =========================================================================

$vendorsDir = [System.IO.Path]::GetFullPath("$pwd\..\vendors");
$distribDir = "$pwd\distrib";

$7zip_exe = "";

# =========================================================================

function download-archive( [string]$url, [string]$targetDir ) {
	$filename = "$targetDir\" + [System.IO.Path]::GetFileName($url);
	if ( ! ( Test-Path $filename ) ) {
		$webclient = New-Object System.Net.WebClient;
		$webclient.DownloadFile($url, $filename);
	}
	return $filename;
}

function extract-zip( [string]$filename, [string]$targetDir ) {
	$shell = New-Object -com shell.application;
	$zip = $shell.NameSpace($filename);
	foreach ( $item in $zip.items() ) {
		$shell.Namespace($targetDir).CopyHere($item, 16);
	}
}

function extract-7z( [string]$filename, [string]$targetDir, [bool]$onlyFiles ) {
	$mode = if ( $onlyFiles ) { "e" } else { "x" };
	& "$script:7zip_exe" $mode "$filename" -y "-o$targetDir";
}

function extract-archive( [string]$filename, [string]$targetDir, [bool]$onlyFiles ) {
	if ( $script:7zip_exe ) {
		extract-7z $filename $targetDir $onlyFiles;
	} else {
		extract-zip $filename $targetDir;
	}
}

function install-package( $package ) {
	$dstDir = $script:vendorsDir + "\" + $package.dir;

	"=================================================================";
	"Package     : $($package.name)";
	"Destination : $dstDir";

	if ( $package.skip ) {
		"Skipped";
		return;
	}

	New-Item -Force -ItemType Directory -Path $dstDir >$null;
	$filename = download-archive $package.url $script:distribDir;
	extract-archive $filename $dstDir ( !! $package.onlyFiles );

	if ( ! $package.postinstall ) {
		return;
	}

	"`nInvoke command:";
	$package.postinstall;
	Invoke-Command -ScriptBlock $package.postinstall -ArgumentList $dstDir;
}

# =========================================================================

$enabled = "$pwd\candy-for-tea.enabled";
$logfile = "$pwd\candy-for-tea.log";

if ( ! ( Test-Path "$enabled" ) ) {
	[System.Reflection.Assembly]::LoadWithPartialName( "System.Windows.Forms" ) >$Null;
	[System.Windows.Forms.MessageBox]::Show( "To enable execution create the file:`n$enabled.", "Disabled", 0, "Stop" ) >$Null;
	exit;
}

$packages | % { install-package $_; } | Out-File $logfile;

if ( Test-Path $enabled ) {
	Remove-Item -Force -Path "$enabled";
}

# =========================================================================

# EOF

<# :
@echo off
setlocal
set "POWERSHELL_BAT_ARGS=%*"
if defined POWERSHELL_BAT_ARGS set "POWERSHELL_BAT_ARGS=%POWERSHELL_BAT_ARGS:"=\"%"
endlocal & powershell -NoLogo -NoProfile -Command "$_ = $input; Invoke-Expression $( '$input = $_; $_ = \"\"; $args = @( &{ $args } %POWERSHELL_BAT_ARGS% );' + [String]::Join( [char]10, $( Get-Content \"%~f0\" ) ) )"
goto :EOF
#>

$packages = @(

	@{
		"name" = "7-zip";
		"home" = "http://7-zip.org/";
		"url" = "http://downloads.sourceforge.net/sevenzip/7za920.zip";
		"dir" = "7za";
		"postinstall" = {
			$dir = $args[0];
			$script:7zip_exe = "$dir\7za.exe";
		};
	}

	@{
		"name" = "ConEmu";
		"home" = "https://github.com/Maximus5/ConEmu/";
		"url" = "https://github.com/Maximus5/ConEmu/releases/download/v15.06.10/ConEmuPack.150610.7z";
		"dir" = "ConEmu";
	}

	@{
		"name" = "Clink";
		"home" = "http://mridgers.github.io/clink";
		"url" = "https://github.com/mridgers/clink/releases/download/0.4.5/clink_0.4.5.zip";
		"dir" = "clink";
		"onlyFiles" = $True;
		"postinstall" = {
			$dir = $args[0];
			ls $dir |
			? { $_.Attributes -eq "Directory" } |
			% { rmdir -Force -Path "$dir\$_"; };
		};
	}

	@{
		"name" = "Far3";
		"home" = "http://www.farmanager.com/";
		"url" = "http://www.farmanager.com/files/Far30b4444.x86.20151024.7z";
		"dir" = "Far3";
	}

	@{
		"skip" = $True;
		"name" = "Far3bis";
		"home" = "http://code.google.com/p/conemu-maximus5/";
		"url" = "http://downloads.sourceforge.net/project/conemu/FarManager/Far3bis/far3.4254bis.x86.x64.7z";
		"dir" = "Far3bis";
	}

	@{
		"name" = "Notepad2-mod";
		"home" = "http://xhmikosr.github.io/notepad2-mod/";
		"url" = "https://github.com/XhmikosR/notepad2-mod/releases/download/4.2.25.964/Notepad2-mod.4.2.25.964_x64.zip";
		"dir" = "notepad2-mod";
		"postinstall" = {
			$dir = $args[0];
			$ini = "$dir\Notepad2.ini";
			mv -Force -Path "$ini" -Destination "$ini.orig";
			& {
				"[Notepad2]";
				"Notepad2.ini=..\..\etc\notepad2\Notepad2.ini";
			} | Out-File "$ini";
		};
	}

	@{
		"name" = "UnxUtils";
		"home" = "http://unxutils.sourceforge.met/";
		"url" = "http://downloads.sourceforge.net/project/unxutils/unxutils/current/UnxUtils.zip";
		"dir" = "unxutils";
		"postinstall" = {
			$dir = $args[0];
			$src = "$dir\usr\local\wbin\*";
			$dst = "$dir\bin";
			mv -Force -Path $src -Destination $dst;
		};
	}

	@{
		"name" = "UnxUtils Updates";
		"home" = "http://unxutils.sourceforge.met/";
		"url" = "http://unxutils.sourceforge.net/UnxUpdates.zip";
		"dir" = "unxutils\bin";
	}

);

# =========================================================================

$vendorsDir = [System.IO.Path]::GetFullPath("$pwd\..\vendors");
$distribDir = "$pwd\distrib";

$7zip_exe = "";

# =========================================================================

function download-archive( [string]$url, [string]$targetDir ) {
	$filename = "$targetDir\" + [System.IO.Path]::GetFileName($url);
	if ( ! ( Test-Path $filename ) ) {
		$webclient = New-Object System.Net.WebClient;
		$webclient.DownloadFile($url, $filename);
	}
	return $filename;
}

function extract-zip( [string]$filename, [string]$targetDir ) {
	$shell = New-Object -com shell.application;
	$zip = $shell.NameSpace($filename);
	foreach ( $item in $zip.items() ) {
		$shell.Namespace($targetDir).CopyHere($item, 16);
	}
}

function extract-7z( [string]$filename, [string]$targetDir, [bool]$onlyFiles ) {
	$mode = if ( $onlyFiles ) { "e" } else { "x" };
	& "$script:7zip_exe" $mode "$filename" -y "-o$targetDir";
}

function extract-archive( [string]$filename, [string]$targetDir, [bool]$onlyFiles ) {
	if ( $script:7zip_exe ) {
		extract-7z $filename $targetDir $onlyFiles;
	} else {
		extract-zip $filename $targetDir;
	}
}

function install-package( $package ) {
	$dstDir = $script:vendorsDir + "\" + $package.dir;

	"=================================================================";
	"Package     : $($package.name)";
	"Destination : $dstDir";

	if ( $package.skip ) {
		"Skipped";
		return;
	}

	New-Item -Force -ItemType Directory -Path $dstDir >$null;
	$filename = download-archive $package.url $script:distribDir;
	extract-archive $filename $dstDir ( !! $package.onlyFiles );

	if ( ! $package.postinstall ) {
		return;
	}

	"`nInvoke command:";
	$package.postinstall;
	Invoke-Command -ScriptBlock $package.postinstall -ArgumentList $dstDir;
}

# =========================================================================

$enabled = "$pwd\candy-for-tea.enabled";
$logfile = "$pwd\candy-for-tea.log";

if ( ! ( Test-Path "$enabled" ) ) {
	[System.Reflection.Assembly]::LoadWithPartialName( "System.Windows.Forms" ) >$Null;
	[System.Windows.Forms.MessageBox]::Show( "To enable execution create the file:`n$enabled.", "Disabled", 0, "Stop" ) >$Null;
	exit;
}

$packages | % { install-package $_; } | Out-File $logfile;

if ( Test-Path $enabled ) {
	Remove-Item -Force -Path "$enabled";
}

# =========================================================================

# EOF

update download links for main tools

update download links for main tools


{% extends "_shared/universal_script.cmd" %}

{% block bash %}
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'

this_dir=$(cd $(dirname $0); pwd -P)
cd $this_dir
args=(${@// /\\ })
mvn exec:java -Dexec.mainClass="{{reversed_domain}}.App" -Dexec.args="${args[*]}"
exit $?
{% endblock %}

{% block cmd %}
@echo off
setlocal
set args=%*
call :Main "%~dp0\."
goto :eof

:Main
set this_dir=%~f1
cd /d "%this_dir%"
mvn exec:java -Dexec.mainClass="{{reversed_domain}}.App" -Dexec.args="%args%" || exit /b 1
goto :eof
{% endblock %}

{% extends "_shared/universal_script.cmd" %}

{% block bash %}
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'

this_dir=$(cd $(dirname $0); pwd -P)
cd $this_dir
if [ "$#" -eq 0 ]; then
  mvn exec:java -Dexec.mainClass="{{reversed_domain}}.App"
else
  args=(${@// /\\ })
  mvn exec:java -Dexec.mainClass="{{reversed_domain}}.App" -Dexec.args="${args[*]}"
fi
exit $?
{% endblock %}

{% block cmd %}
@echo off
setlocal
set args=%*
call :Main "%~dp0\."
goto :eof

:Main
set this_dir=%~f1
cd /d "%this_dir%"
mvn exec:java -Dexec.mainClass="{{reversed_domain}}.App" -Dexec.args="%args%" || exit /b 1
goto :eof
{% endblock %}

Handle no command-line arguments

Handle no command-line arguments


@echo off

set NODE_ENV=production
set AUTH_TOKEN=changeme
set PORT=80

if %AUTH_TOKEN%==changeme (
  echo *****************************************************
  echo Please change the AUTH_TOKEN in server/bin/server.bat
  echo *****************************************************
  pause > nul
  EXIT
)

coffee ./bin/server.coffee

@echo off

set NODE_ENV=production
set AUTH_TOKEN=changeme
set PORT=80

if %AUTH_TOKEN%==changeme (
  echo *****************************************************
  echo Please change the AUTH_TOKEN in server/bin/server.bat
  echo *****************************************************
  pause > nul
  EXIT
)

forever ./bin/server.coffee

Make app use forever on windows

Make app use forever on windows


anvil

copy ./lib/standard/postal.* ./example/standard/js
copy ./lib/amd/postal.* ./example/amd/js/libs/postal
copy ./lib/amd/postal.js ./example/node/client/js/lib
copy ./lib/node/postal.js ./example/node/messaging

Add in a new build bat for teh windoze

Add in a new build bat for teh windoze


@TITLE Building Mesa3D
@cd "%~dp0"
@cd ..\..\
@for %%I in ("%cd%") do @set mesa=%%~sI
@set mesa=%mesa%\
@where /q cmake.exe
@IF ERRORLEVEL 1 set PATH=%mesa%cmake\bin\;%PATH%
@set ERRORLEVEL=0
@where /q python.exe
@IF ERRORLEVEL 1 set PATH=%mesa%Python\;%mesa%Python\Scripts\;%PATH%
@set ERRORLEVEL=0
@set pyupd=y
@set pyfrstupd=1
@if EXIST pyupd.ini set /p pyfrstupd=<pyupd.ini
@if %pyfrstupd%==0 set pyupd=n
@if %pyfrstupd%==0 set /p pyupd=Install/update python modules (y/n):
@if "%pyupd%"=="y" (
@python -m pip install -U mako
@python -m pip freeze > requirements.txt
@python -m pip install -r requirements.txt --upgrade
@del requirements.txt
@echo.
@echo 0 > pyupd.ini
)
@set abi=x86
@set /p x64=Do you want to build for x64? (y/n) Otherwise build for x86:
@if /I "%x64%"=="y" set abi=x64
@set longabi=%abi%
@if %abi%==x64 set longabi=x86_64
@set altabi=i686
@if %abi%==x64 set altabi=%longabi%
@set minabi=32
@if %abi%==x64 set minabi=64
@set targetabi=x86
@if %abi%==x64 set targetabi=amd64
@set hostabi=x86
@set vsenv="%ProgramFiles%
@if NOT "%ProgramW6432%"=="" set hostabi=amd64
@set vsabi=%minabi%
@if NOT %targetabi%==%hostabi% set vsabi=%hostabi%_%targetabi%
@if NOT "%ProgramW6432%"=="" set vsenv=%vsenv% (x86)
@set vsenv15=%vsenv%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars%vsabi%.bat"
@if %vsabi%==32 set vsenv14=%VS140COMNTOOLS%..\..\VC\bin\vcvars%vsabi%.bat"
@if %vsabi%==64 set vsenv14=%VS140COMNTOOLS%..\..\VC\bin\%targetabi%\vcvars%vsabi%.bat"
@if NOT %targetabi%==%hostabi% set vsenv14=%VS140COMNTOOLS%..\..\VC\bin\%vsabi%\vcvars%vsabi%.bat"
@set gcc=%mesa%mingw-w64\%abi%\mingw%minabi%\bin
@set vsenvloaded=0
@set toolset=14
@if EXIST %vsenv15% set toolset=15
@if EXIST toolset-%abi%.ini set /p toolset=<toolset-%abi%.ini
@set vsenv=%vsenv14%
@if %toolset%==15 set vsenv=%vsenv15%
@set PATH=%mesa%flexbison\;%PATH%
@TITLE Building Mesa3D %abi%

:build_llvm
@set /p buildllvm=Begin LLVM build. Only needs to run once for each ABI and version. Proceed (y/n):
@if /I NOT "%buildllvm%"=="y" GOTO build_mesa
@echo.
@cd %mesa%llvm
@if EXIST %abi% RD /S /Q %abi%
@if EXIST cmake-%abi% RD /S /Q cmake-%abi%
@md cmake-%abi%
@cd cmake-%abi%
@set toolchain=Visual Studio 14
@set toolset=14
@if EXIST %vsenv15% set toolchain=Visual Studio 15 2017
@if EXIST %vsenv15% set toolset=15
@set ninja=n
@set oldtoolset=n
@set x64compiler= -Thost=x64
@if EXIST %mesa%ninja set ninja=1
@if EXIST %vsenv15% set ninja=%ninja%2
@if %ninja%==12 set /p oldtoolset=Build with MSVC 2015 backward compatibility toolset, alternative solution for LLVM 3.9.1 build with Visual Studio 2017 (y/n):
@if %ninja%==12 echo.
@if /I "%oldtoolset%"=="y" set ninja=y
@if /I "%oldtoolset%"=="y" set toolset=14
@if %ninja%==12 set ninja=2
@if %ninja%==1 set ninja=2
@if %ninja%==2 set /p ninja=Use Ninja build system instead of MsBuild, there is no requirement to do this with the primary toolset though (y/n):
@echo.
@if /I "%ninja%"=="y" set toolchain=Ninja
@if /I "%ninja%"=="y" set x64compiler=
@if "%toolchain%"=="Ninja" set PATH=%mesa%ninja\;%PATH%
@set vsenv=%vsenv14%
@if %toolset%==15 set vsenv=%vsenv15%
@set llvmbuildsys=%CD%
@call %vsenv%
@set vsenvloaded=1
@echo.
@set modtoolchainabi=0
@if NOT "%toolchain%"=="Ninja" set modtoolchainabi=1
@if %abi%==x64 set modtoolchainabi=%modtoolchainabi%2
@if %modtoolchainabi%==12 set toolchain=%toolchain% Win64
@cd %llvmbuildsys%
@if NOT %hostabi%==amd64 set x64compiler=
@cmake -G "%toolchain%"%x64compiler% -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_CRT_RELEASE=MT -DLLVM_ENABLE_RTTI=1 -DLLVM_ENABLE_TERMINFO=OFF -DCMAKE_INSTALL_PREFIX=../%abi% ..
@echo.
@pause
@echo.
@if NOT "%toolchain%"=="Ninja" cmake --build . --config Release --target install
@if "%toolchain%"=="Ninja" ninja install
@echo.
@echo %toolset% > %mesa%toolset-%abi%.ini

:build_mesa
@set /p buildmesa=Begin mesa build. Proceed (y/n):
@if /i NOT "%buildmesa%"=="y" GOTO build_dxtn
@echo.
@set LLVM=%mesa%llvm\%abi%
@if NOT EXIST %LLVM% (
@echo Could not find LLVM, aborting mesa build.
@echo.
@pause
@GOTO build_dxtn
)
@cd %mesa%
@if NOT EXIST mesa echo Mesa3D source code not found. Attempting to download it using git as long as it is in PATH...
@if NOT EXIST mesa set /p branch=Enter Mesa source code branch name - defaults to master:
@if "%branch%"=="" set branch=master
@if NOT EXIST mesa echo.
@if NOT EXIST mesa git clone --depth=1 --branch=%branch% git://anongit.freedesktop.org/mesa/mesa mesa
@cd mesa
git apply -v ..\mesa-dist-win\patches\scons-llvm5.patch
git apply -v ..\mesa-dist-win\patches\s3tc.patch
@echo.
@set openswr=n
@set sconscmd=python %mesa%Python\Scripts\scons.py build=release platform=windows machine=%longabi% libgl-gdi
@if %abi%==x64 set /p openswr=Do you want to build OpenSWR drivers? (y=yes):
@echo.
@if /I "%openswr%"=="y" set sconscmd=%sconscmd% swr=1
@set /p osmesa=Do you want to build off-screen rendering drivers (y/n):
@echo.
@if /I "%osmesa%"=="y" set sconscmd=%sconscmd% osmesa
@set /p graw=Do you want to build graw library (y/n):
@echo.
@if /I "%graw%"=="y" set sconscmd=%sconscmd% graw-gdi
@GOTO build_with_vs

:build_with_mingw
@set mingw=n
@set mingwtest=0
@if EXIST %gcc% set mingwtest=1
@set msys2=%mesa%msys64\msys2_shell.cmd
@if EXIST %msys2% set mingwtest=%mingwtest%2
@if %mingwtest%==12 set /p mingw=Do you want to build with MinGW-W64 instead of Visual Studio (y=yes):
@set ERRORLEVEL=0
@where /q gcc.exe
@IF ERRORLEVEL 1 set PATH=%gcc%\;%PATH%
@set ERRORLEVEL=0
@if /I "%mingw%"=="y" set sconscmd=%sconscmd% toolchain=crossmingw
@if /I "%mingw%"=="y" copy %gcc%\%altabi%-w64-mingw32-gcc-ar.exe %gcc%\%altabi%-w64-mingw32-ar.exe
@if /I "%mingw%"=="y" copy %gcc%\%altabi%-w64-mingw32-gcc-ranlib.exe %gcc%\%altabi%-w64-mingw32-ranlib.exe
@if /I "%mingw%"=="y" call "%msys2%" -use-full-path
@if /I "%mingw%"=="y" (
pacman -Syu
pacman -S python2
wget https://bootstrap.pypa.io/get-pip.py
python2 get-pip.py
pip install -U mako
pip install -U scons
pip freeze > requirements.txt
pip install -r requirements.txt --upgrade
cd $mesa
cd mesa
GOTO build_mesa_exec
)

:build_with_vs
@set cleanbuild=n
@if EXIST build\windows-%longabi% set /p cleanbuild=Do you want to clean build (y/n):
@if EXIST build\windows-%longabi% echo.
@if /I "%cleanbuild%"=="y" RD /S /Q build\windows-%longabi%
@if %vsenvloaded%==0 (
@call %vsenv%
@cd %mesa%mesa
@echo.
)

:build_mesa_exec
@%sconscmd%
@echo.

:build_dxtn
@if NOT EXIST %gcc% GOTO distcreate
@if NOT EXIST %mesa%dxtn GOTO distcreate
@if NOT EXIST %mesa%mesa GOTO distcreate
@set /p builddxtn=Do you want to build S3 texture compression library? (y/n):
@if /i NOT "%builddxtn%"=="y" GOTO distcreate
@set PATH=%gcc%\;%PATH%
@cd %mesa%dxtn
@echo.
@if EXIST %abi% RD /S /Q %abi%
@MD %abi%
@set dxtn=gcc -shared -m%minabi% -v *.c *.h -I ..\mesa\include -Wl,--dll,--dynamicbase,--enable-auto-image-base,--nxcompat -o %abi%\dxtn.dll
@%dxtn%
@echo.

:distcreate
@set /p dist=Create or update Mesa3D distribution package (y/n):
@echo.
@if /I NOT "%dist%"=="y" GOTO exit
@cd %mesa%
@if NOT EXIST mesa-dist-win MD mesa-dist-win
@cd mesa-dist-win
@if NOT EXIST bin MD bin
@cd bin
@if EXIST %abi% RD /S /Q %abi%
@MD %abi%
@cd %abi%
@copy %mesa%mesa\build\windows-%longabi%\gallium\targets\libgl-gdi\opengl32.dll opengl32.dll
@if %abi%==x64 copy %mesa%mesa\build\windows-%longabi%\gallium\drivers\swr\swrAVX.dll swrAVX.dll
@if %abi%==x64 copy %mesa%mesa\build\windows-%longabi%\gallium\drivers\swr\swrAVX2.dll swrAVX2.dll
@copy %mesa%mesa\build\windows-%longabi%\mesa\drivers\osmesa\osmesa.dll osmesa-swrast.dll
@copy %mesa%mesa\build\windows-%longabi%\gallium\targets\osmesa\osmesa.dll osmesa-gallium.dll
@copy %mesa%mesa\build\windows-%longabi%\gallium\targets\graw-gdi\graw.dll graw.dll
@copy %mesa%dxtn\%abi%\dxtn.dll dxtn.dll
@echo.
@pause

:exit
exit

@TITLE Building Mesa3D
@cd "%~dp0"
@cd ..\..\
@for %%I in ("%cd%") do @set mesa=%%~sI
@set mesa=%mesa%\
@where /q cmake.exe
@IF ERRORLEVEL 1 set PATH=%mesa%cmake\bin\;%PATH%
@set ERRORLEVEL=0
@where /q python.exe
@IF ERRORLEVEL 1 set PATH=%mesa%Python\;%mesa%Python\Scripts\;%PATH%
@set ERRORLEVEL=0
@set pyupd=y
@where python.exe>pyupd.ini
@set /p makoloc=<pyupd.ini
@set makoloc="%makoloc:python.exe=%Lib\site-packages\mako"
@if EXIST %makoloc% set /p pyupd=Install/update python modules (y/n):
@if "%pyupd%"=="y" (
@python -m pip install -U mako
@python -m pip freeze > requirements.txt
@python -m pip install -r requirements.txt --upgrade
@del requirements.txt
@echo.
)
@set abi=x86
@set /p x64=Do you want to build for x64? (y/n) Otherwise build for x86:
@if /I "%x64%"=="y" set abi=x64
@set longabi=%abi%
@if %abi%==x64 set longabi=x86_64
@set altabi=i686
@if %abi%==x64 set altabi=%longabi%
@set minabi=32
@if %abi%==x64 set minabi=64
@set targetabi=x86
@if %abi%==x64 set targetabi=amd64
@set hostabi=x86
@set vsenv="%ProgramFiles%
@if NOT "%ProgramW6432%"=="" set hostabi=amd64
@set vsabi=%minabi%
@if NOT %targetabi%==%hostabi% set vsabi=%hostabi%_%targetabi%
@if NOT "%ProgramW6432%"=="" set vsenv=%vsenv% (x86)
@set vsenv15=%vsenv%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars%vsabi%.bat"
@if %vsabi%==32 set vsenv14=%VS140COMNTOOLS%..\..\VC\bin\vcvars%vsabi%.bat"
@if %vsabi%==64 set vsenv14=%VS140COMNTOOLS%..\..\VC\bin\%targetabi%\vcvars%vsabi%.bat"
@if NOT %targetabi%==%hostabi% set vsenv14=%VS140COMNTOOLS%..\..\VC\bin\%vsabi%\vcvars%vsabi%.bat"
@set gcc=%mesa%mingw-w64\%abi%\mingw%minabi%\bin
@set vsenvloaded=0
@set toolset=14
@if EXIST %vsenv15% set toolset=15
@if EXIST toolset-%abi%.ini set /p toolset=<toolset-%abi%.ini
@set vsenv=%vsenv14%
@if %toolset%==15 set vsenv=%vsenv15%
@set PATH=%mesa%flexbison\;%PATH%
@TITLE Building Mesa3D %abi%

:build_llvm
@set /p buildllvm=Begin LLVM build. Only needs to run once for each ABI and version. Proceed (y/n):
@if /I NOT "%buildllvm%"=="y" GOTO build_mesa
@echo.
@cd %mesa%llvm
@if EXIST %abi% RD /S /Q %abi%
@if EXIST cmake-%abi% RD /S /Q cmake-%abi%
@md cmake-%abi%
@cd cmake-%abi%
@set toolchain=Visual Studio 14
@set toolset=14
@if EXIST %vsenv15% set toolchain=Visual Studio 15 2017
@if EXIST %vsenv15% set toolset=15
@set ninja=n
@set oldtoolset=n
@set x64compiler= -Thost=x64
@if EXIST %mesa%ninja set ninja=1
@if EXIST %vsenv15% set ninja=%ninja%2
@if %ninja%==12 set /p oldtoolset=Build with MSVC 2015 backward compatibility toolset, alternative solution for LLVM 3.9.1 build with Visual Studio 2017 (y/n):
@if %ninja%==12 echo.
@if /I "%oldtoolset%"=="y" set ninja=y
@if /I "%oldtoolset%"=="y" set toolset=14
@if %ninja%==12 set ninja=2
@if %ninja%==1 set ninja=2
@if %ninja%==2 set /p ninja=Use Ninja build system instead of MsBuild, there is no requirement to do this with the primary toolset though (y/n):
@echo.
@if /I "%ninja%"=="y" set toolchain=Ninja
@if /I "%ninja%"=="y" set x64compiler=
@if "%toolchain%"=="Ninja" set PATH=%mesa%ninja\;%PATH%
@set vsenv=%vsenv14%
@if %toolset%==15 set vsenv=%vsenv15%
@set llvmbuildsys=%CD%
@call %vsenv%
@set vsenvloaded=1
@echo.
@set modtoolchainabi=0
@if NOT "%toolchain%"=="Ninja" set modtoolchainabi=1
@if %abi%==x64 set modtoolchainabi=%modtoolchainabi%2
@if %modtoolchainabi%==12 set toolchain=%toolchain% Win64
@cd %llvmbuildsys%
@if NOT %hostabi%==amd64 set x64compiler=
@cmake -G "%toolchain%"%x64compiler% -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_CRT_RELEASE=MT -DLLVM_ENABLE_RTTI=1 -DLLVM_ENABLE_TERMINFO=OFF -DCMAKE_INSTALL_PREFIX=../%abi% ..
@echo.
@pause
@echo.
@if NOT "%toolchain%"=="Ninja" cmake --build . --config Release --target install
@if "%toolchain%"=="Ninja" ninja install
@echo.
@echo %toolset% > %mesa%toolset-%abi%.ini

:build_mesa
@set /p buildmesa=Begin mesa build. Proceed (y/n):
@if /i NOT "%buildmesa%"=="y" GOTO build_dxtn
@echo.
@set LLVM=%mesa%llvm\%abi%
@if NOT EXIST %LLVM% (
@echo Could not find LLVM, aborting mesa build.
@echo.
@pause
@GOTO build_dxtn
)
@cd %mesa%
@if NOT EXIST mesa echo Mesa3D source code not found. Attempting to download it using git as long as it is in PATH...
@if NOT EXIST mesa set /p branch=Enter Mesa source code branch name - defaults to master:
@if "%branch%"=="" set branch=master
@if NOT EXIST mesa echo.
@if NOT EXIST mesa git clone --depth=1 --branch=%branch% git://anongit.freedesktop.org/mesa/mesa mesa
@cd mesa
git apply -v ..\mesa-dist-win\patches\scons-llvm5.patch
git apply -v ..\mesa-dist-win\patches\s3tc.patch
@echo.
@set openswr=n
@set sconscmd=python %mesa%Python\Scripts\scons.py build=release platform=windows machine=%longabi% libgl-gdi
@if %abi%==x64 set /p openswr=Do you want to build OpenSWR drivers? (y=yes):
@echo.
@if /I "%openswr%"=="y" set sconscmd=%sconscmd% swr=1
@set /p osmesa=Do you want to build off-screen rendering drivers (y/n):
@echo.
@if /I "%osmesa%"=="y" set sconscmd=%sconscmd% osmesa
@set /p graw=Do you want to build graw library (y/n):
@echo.
@if /I "%graw%"=="y" set sconscmd=%sconscmd% graw-gdi
@GOTO build_with_vs

:build_with_mingw
@set mingw=n
@set mingwtest=0
@if EXIST %gcc% set mingwtest=1
@set msys2=%mesa%msys64\msys2_shell.cmd
@if EXIST %msys2% set mingwtest=%mingwtest%2
@if %mingwtest%==12 set /p mingw=Do you want to build with MinGW-W64 instead of Visual Studio (y=yes):
@set ERRORLEVEL=0
@where /q gcc.exe
@IF ERRORLEVEL 1 set PATH=%gcc%\;%PATH%
@set ERRORLEVEL=0
@if /I "%mingw%"=="y" set sconscmd=%sconscmd% toolchain=crossmingw
@if /I "%mingw%"=="y" copy %gcc%\%altabi%-w64-mingw32-gcc-ar.exe %gcc%\%altabi%-w64-mingw32-ar.exe
@if /I "%mingw%"=="y" copy %gcc%\%altabi%-w64-mingw32-gcc-ranlib.exe %gcc%\%altabi%-w64-mingw32-ranlib.exe
@if /I "%mingw%"=="y" call "%msys2%" -use-full-path
@if /I "%mingw%"=="y" (
pacman -Syu
pacman -S python2
wget https://bootstrap.pypa.io/get-pip.py
python2 get-pip.py
pip install -U mako
pip install -U scons
pip freeze > requirements.txt
pip install -r requirements.txt --upgrade
cd $mesa
cd mesa
GOTO build_mesa_exec
)

:build_with_vs
@set cleanbuild=n
@if EXIST build\windows-%longabi% set /p cleanbuild=Do you want to clean build (y/n):
@if EXIST build\windows-%longabi% echo.
@if /I "%cleanbuild%"=="y" RD /S /Q build\windows-%longabi%
@if %vsenvloaded%==0 (
@call %vsenv%
@cd %mesa%mesa
@echo.
)

:build_mesa_exec
@%sconscmd%
@echo.

:build_dxtn
@if NOT EXIST %gcc% GOTO distcreate
@if NOT EXIST %mesa%dxtn GOTO distcreate
@if NOT EXIST %mesa%mesa GOTO distcreate
@set /p builddxtn=Do you want to build S3 texture compression library? (y/n):
@if /i NOT "%builddxtn%"=="y" GOTO distcreate
@set PATH=%gcc%\;%PATH%
@cd %mesa%dxtn
@echo.
@if EXIST %abi% RD /S /Q %abi%
@MD %abi%
@set dxtn=gcc -shared -m%minabi% -v *.c *.h -I ..\mesa\include -Wl,--dll,--dynamicbase,--enable-auto-image-base,--nxcompat -o %abi%\dxtn.dll
@%dxtn%
@echo.

:distcreate
@set /p dist=Create or update Mesa3D distribution package (y/n):
@echo.
@if /I NOT "%dist%"=="y" GOTO exit
@cd %mesa%
@if NOT EXIST mesa-dist-win MD mesa-dist-win
@cd mesa-dist-win
@if NOT EXIST bin MD bin
@cd bin
@if EXIST %abi% RD /S /Q %abi%
@MD %abi%
@cd %abi%
@copy %mesa%mesa\build\windows-%longabi%\gallium\targets\libgl-gdi\opengl32.dll opengl32.dll
@if %abi%==x64 copy %mesa%mesa\build\windows-%longabi%\gallium\drivers\swr\swrAVX.dll swrAVX.dll
@if %abi%==x64 copy %mesa%mesa\build\windows-%longabi%\gallium\drivers\swr\swrAVX2.dll swrAVX2.dll
@copy %mesa%mesa\build\windows-%longabi%\mesa\drivers\osmesa\osmesa.dll osmesa-swrast.dll
@copy %mesa%mesa\build\windows-%longabi%\gallium\targets\osmesa\osmesa.dll osmesa-gallium.dll
@copy %mesa%mesa\build\windows-%longabi%\gallium\targets\graw-gdi\graw.dll graw.dll
@copy %mesa%dxtn\%abi%\dxtn.dll dxtn.dll
@echo.
@pause

:exit
exit

Build script - Python update: Search Mako module Force an update if not found. Finally fixed Python modules update since update check skipping was added when build environment is offline to help with performance.


:: SOURCE: http://573.github.io/blog/2010/10/13/adopt-a-visual-c-plus-plus-express-edition-project-with-cmake/
::
::@echo off

:: Setup the development environment for CMake -- we need a compiler and linker.
@set PATH=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin;%PATH%

@mkdir build
@cd build
:: Force a rebuild of the CMake cache
del /Q CMakeCache.txt
del /Q CMakeFiles

:: Commence build configuration of project ...
cmake -D DEBUG=on -D EXAMPLES=on ..
:: if all goes well, we ought to have generated a nomlib.vcxproj file!

:: Return to where we came from
@cd ..
pause

Introduce 'windev.bat' for bootstrapping cmake env


cd ..
del/q scite.zip
zip scite.zip scintilla\*.* scintilla\*\*.* scite\*.* scite\*\*.* scite\*\*\*.* scite\*\*\*\*.* -x *.o -x *.obj -x *.lib -x *.dll -x *.exe -x *.pdb -x *.res -x *.exp -x *.ncb -x *.sbr -x *.bsc -x *.ilk -x *.idb -x *.dpsession -x *.bak
cd scite

cd ..
del/q scite.zip
zip scite.zip scintilla\*.* scintilla\*\*.* scintilla\*\*\*.* scintilla\*\*\*\*.* scintilla\*\*\*\*\*.* scite\*.* scite\*\*.* scite\*\*\*.* scite\*\*\*\*.* -x *.o -x *.obj -x *.lib -x *.dll -x *.exe -x *.pdb -x *.res -x *.exp -x *.ncb -x *.sbr -x *.bsc -x *.ilk -x *.idb -x *.dpsession -x *.bak
cd scite

Store OS X files in zips.

Store OS X files in zips.


:: Download and build curl.exe and libcurl on Windows.
::
:: Builds DLLs and curl.exe for x86 and amd64 in Release- and Debug
:: configuration including .pdb files.
::
:: Requirements:
::   - Visual Studio 2017 installed (Tested with Professional edition but
::     Community should work fine, too.)
::   - 7z.exe in PATH

@setlocal
@set curl_version=7.57.0
@set curl_download_url="https://curl.haxx.se/download/curl-%curl_version%.zip"

@if exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" (
  @set vsdevcmd="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"
) else (
  @set vsdevcmd="C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\VsDevCmd.bat"
)
@call %vsdevcmd%
@if "%VS150COMNTOOLS%"=="" goto error_no_vscomntools

@where /q 7z.exe
@if %errorlevel% equ 1 goto error_no_7zip

@if not exist curl-%curl_version%.zip (
@bitsadmin /transfer downloadjob /download /priority normal ^
  %curl_download_url% ^
  %cd%\curl-%curl_version%.zip
)
@if not exist curl-%curl_version%.zip goto error_download_failed

@7z.exe x curl-%curl_version%.zip

@pushd curl-%curl_version%\winbuild
@cmd.exe /c "@call %vsdevcmd% -no_logo -arch=amd64 && nmake /f Makefile.vc mode=dll MACHINE=x64 VC=15 GEN_PDB=yes"
@cmd.exe /c "@call %vsdevcmd% -no_logo -arch=amd64 && nmake /f Makefile.vc mode=dll MACHINE=x64 VC=15 GEN_PDB=yes DEBUG=yes"
@cmd.exe /c "@call %vsdevcmd% -no_logo -arch=x86 && nmake /f Makefile.vc mode=dll MACHINE=x86 VC=15 GEN_PDB=yes"
@cmd.exe /c "@call %vsdevcmd% -no_logo -arch=x86 && nmake /f Makefile.vc mode=dll MACHINE=x86 VC=15 GEN_PDB=yes DEBUG=yes"
@popd

@robocopy ^
  curl-%curl_version%\builds\libcurl-vc15-x64-release-dll-ipv6-sspi-winssl ^
  win64 /e /move

@robocopy ^
  curl-%curl_version%\builds\libcurl-vc15-x64-debug-dll-ipv6-sspi-winssl ^
  win64-debug /e /move

@robocopy ^
  curl-%curl_version%\builds\libcurl-vc15-x86-release-dll-ipv6-sspi-winssl ^
  win32 /e /move

@robocopy ^
  curl-%curl_version%\builds\libcurl-vc15-x86-debug-dll-ipv6-sspi-winssl ^
  win32-debug /e /move

@goto end

:error_no_vscomntools
@echo ERROR: Cannot determine location of Visual Studio 2017 Common Tools folder
@goto end

:error_no_7zip
@echo ERROR: Cannot find 7z.exe in PATH
@goto end

:error_download_failed
@echo ERROR: Downloading curl-%curl_version%.zip failed
@goto end

:end
@if exist curl-%curl_version% ( @rd /s /q curl-%curl_version% )
@endlocal
exit /b 0

:: Download and build curl.exe and libcurl on Windows.
::
:: Builds DLLs and curl.exe for x86 and amd64 in Release- and Debug
:: configuration including .pdb files.
::
:: Requirements:
::   - Visual Studio 2017 installed (Tested with Professional edition but
::     Community should work fine, too.)
::   - 7z.exe in PATH

@setlocal
@set curl_version=7.59.0
@set curl_download_url="https://curl.haxx.se/download/curl-%curl_version%.zip"

@if exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" (
  @set vsdevcmd="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"
) else (
  @set vsdevcmd="C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\VsDevCmd.bat"
)
@call %vsdevcmd%
@if "%VS150COMNTOOLS%"=="" goto error_no_vscomntools

@where /q 7z.exe
@if %errorlevel% equ 1 goto error_no_7zip

@if not exist curl-%curl_version%.zip (
@bitsadmin /transfer downloadjob /download /priority normal ^
  %curl_download_url% ^
  %cd%\curl-%curl_version%.zip
)
@if not exist curl-%curl_version%.zip goto error_download_failed

@7z.exe x curl-%curl_version%.zip

@pushd curl-%curl_version%\winbuild
@cmd.exe /c "@call %vsdevcmd% -no_logo -arch=amd64 && nmake /f Makefile.vc mode=dll MACHINE=x64 VC=15 GEN_PDB=yes"
@cmd.exe /c "@call %vsdevcmd% -no_logo -arch=amd64 && nmake /f Makefile.vc mode=dll MACHINE=x64 VC=15 GEN_PDB=yes DEBUG=yes"
@cmd.exe /c "@call %vsdevcmd% -no_logo -arch=x86 && nmake /f Makefile.vc mode=dll MACHINE=x86 VC=15 GEN_PDB=yes"
@cmd.exe /c "@call %vsdevcmd% -no_logo -arch=x86 && nmake /f Makefile.vc mode=dll MACHINE=x86 VC=15 GEN_PDB=yes DEBUG=yes"
@popd

@robocopy ^
  curl-%curl_version%\builds\libcurl-vc15-x64-release-dll-ipv6-sspi-winssl ^
  win64 /e /move

@robocopy ^
  curl-%curl_version%\builds\libcurl-vc15-x64-debug-dll-ipv6-sspi-winssl ^
  win64-debug /e /move

@robocopy ^
  curl-%curl_version%\builds\libcurl-vc15-x86-release-dll-ipv6-sspi-winssl ^
  win32 /e /move

@robocopy ^
  curl-%curl_version%\builds\libcurl-vc15-x86-debug-dll-ipv6-sspi-winssl ^
  win32-debug /e /move

@goto end

:error_no_vscomntools
@echo ERROR: Cannot determine location of Visual Studio 2017 Common Tools folder
@goto end

:error_no_7zip
@echo ERROR: Cannot find 7z.exe in PATH
@goto end

:error_download_failed
@echo ERROR: Downloading curl-%curl_version%.zip failed
@goto end

:end
@if exist curl-%curl_version% ( @rd /s /q curl-%curl_version% )
@endlocal
exit /b 0

update libcurl version on VS 2017

scripts: update libcurl version on VS 2017


@echo on

rmdir /S /Q ..\Install

rmdir /S /Q objfre_wxp_x86
rmdir /S /Q objfre_wnet_x86
rmdir /S /Q objfre_wnet_amd64
rmdir /S /Q objfre_wlh_x86
rmdir /S /Q objfre_wlh_amd64
rmdir /S /Q objfre_win7_x86
rmdir /S /Q objfre_win7_amd64

del /F *.log *.wrn *.err

@echo on

rmdir /S /Q .\Install

rmdir /S /Q objfre_wxp_x86
rmdir /S /Q objfre_wnet_x86
rmdir /S /Q objfre_wnet_amd64
rmdir /S /Q objfre_wlh_x86
rmdir /S /Q objfre_wlh_amd64
rmdir /S /Q objfre_win7_x86
rmdir /S /Q objfre_win7_amd64

del /F *.log *.wrn *.err

[viostor] Fix clean.bat to remove Install directry in new location


:: Copyright (c) 2020 PaddlePaddle 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.
::
:: ===============================
:: Build Paddle compile enviroment
:: ===============================
:: Description:
::
::   Install compile enviroment for xly CI.
::
::   Include:
::     1. CMake 3.17.0
::     2. Git 2.28.0
::     3. Python 3.7.8
::     4. Visual Studio 2015 with update 3
::     5. CUDA 10
::     6. java jre
::     7. xly agent

:: Echo command is not required.
@echo off

:: ===== start step 0: wget tool =====
:: Download wget for windows when there is not wget tool.
echo ">>>>>>>> step [0/7]: wget tool"
wget --help > nul 2> nul || call:install_wget
goto cmake

:install_wget
echo There is not wget in this PC, will download wget 1.20.
echo Download package from https://eternallybored.org/misc/wget/1.20/64/wget.exe ...
certutil -urlcache -split -f https://eternallybored.org/misc/wget/1.20/64/wget.exe > nul 2> nul
if %errorlevel% == 0 (
  echo Download wget tool into %cd% success.
) else (
  echo Error***** Download wget tool failed, please download it before rerun.
  exit /b 1
)
goto :eof
:: ===== end step 0: wget tool =====

:: ===== start step 1: cmake =====
:: Download CMake-3.17.0 and add in PATH when it not installed.
:: TODO: limit version >= 3.17.0
:cmake
echo ">>>>>>>> step [1/7]: CMake 3.17.0"
cmake --help > nul 2> nul || call :install_cmake
goto git

:install_cmake
echo There is not cmake in this PC, will install cmake-3.17.0.
echo Download package from https://cmake.org/files/v3.17/cmake-3.17.0-win64-x64.msi ...
wget -O cmake-3.17.0-win64-x64.msi https://cmake.org/files/v3.17/cmake-3.17.0-win64-x64.msi
echo Install cmake-3.17.0 ...
:: /passive [silent installation]
:: /norestart [do not restart]
:: ADD_CMAKE_TO_PATH = System [add CMake to the system PATH for all users]
start /wait cmake-3.17.0-win64-x64.msi /passive /norestart ADD_CMAKE_TO_PATH=System
if %errorlevel% == 0 (
  echo Install CMake-3.17.0 success!
) else (
  echo Error***** Install Cmake-3.17.0 failed, please re-install it manually.
)
del cmake-3.17.0-win64-x64.msi
goto :eof
:: ===== end step 1: cmake =====

:: ===== start step 2: Git =====
:: Download Git-2.28.0 and add in PATH when it not installed.
:: TODO: limit version >= 2.28.0
:git
echo ">>>>>>>> step [2/8]: Git 2.28.0"
git --help > nul 2> nul || call :install_git
goto python

:install_git
echo There is not git in this PC, will install Git-2.28.0.
echo Download package from https://github.com/git-for-windows/git/releases/download/v2.28.0.windows.1/Git-2.28.0-64-bit.exe ...
wget -O Git-2.28.0-64-bit.exe https://github.com/git-for-windows/git/releases/download/v2.28.0.windows.1/Git-2.28.0-64-bit.exe
echo Install Git-2.28.0 ...
:: /SILENT [silent install]
:: /ALLUSERS [add path for all users]
:: /NORESTART [do not restart]
start /wait Git-2.28.0-64-bit.exe /SILENT /ALLUSERS /NORESTART
if %errorlevel% == 0 (
  echo Install Git-2.28.0 success!
) else (
  echo Error***** Install Git-2.28.0 failed, please re-install it manually.
)
del Git-2.28.0-64-bit.exe
goto :eof
:: ===== end step 2: Git =====

:: ===== start step 3: Python =====
:: Download Python-3.7.8 and add in PATH when it not installed.
:: TODO: limit version >= 3.7.8
:python
echo ">>>>>>>> step [3/7]: Python 3.7.8"
python -V 2>&1 | findstr /C:"Python 3.7.8" > nul 2> nul || call :install_python
goto vs2015

:install_python
echo There is not Python in this PC, will install Python-3.7.8.
echo Download package from https://npm.taobao.org/mirrors/python/3.7.8/python-3.7.8-amd64.exe ...
wget -O python-3.7.8-amd64.exe https://npm.taobao.org/mirrors/python/3.7.8/python-3.7.8-amd64.exe
echo Install Python-3.7.8 ...
:: /passive [silent install]
:: InstallAllUsers [add path for all users]
:: PrependPath [add script/install into PATH]
:: TargetDir [install directory]
start /wait python-3.7.8-amd64.exe /passive InstallAllUsers=1 PrependPath=1 TargetDir=C:\Python37
if %errorlevel% == 0 (
  echo Install python-3.7.8 success!
) else (
  echo Error***** Install python-3.7.8 failed, please re-install it manually.
)
del python-3.7.8-amd64.exe
goto :eof
:: ===== end step 3: Python =====

:: ===== start step 4: Visual Studio 2015 =====
:: Download Visual Studio 2015 when it not installed.
:vs2015
echo ">>>>>>>> step [4/7]: Visual Studio 2015"
cmd /C "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 > nul 2> nul || call :install_visual_studio
goto :cuda10

:install_visual_studio
echo There is not Visual Studio in this PC, will install VS2015.
echo Download package from "https://paddle-ci.gz.bcebos.com/window_requirement/en_visual_studio_enterprise_2015_with_update_3_x86_x64_web_installer_8922986.exe"
wget -O vs_installer.exe "https://paddle-ci.gz.bcebos.com/window_requirement/en_visual_studio_enterprise_2015_with_update_3_x86_x64_web_installer_8922986.exe"
echo Install Visual Studio 2015 ...
:: /passive [silent install]
:: /norestart [no restart]
:: /NoRefresh [no refresh]
:: /InstallSelectableItems NativeLanguageSupport_Group [select Visual C++ for installing]
start /wait visual_installer.exe /passive /norestart /NoRefresh /InstallSelectableItems NativeLanguageSupport_Group
if %errorlevel% == 0 (
  echo Install Visual Studio 2015 success!
) else (
  echo Error***** Install Visual Studio 2015 failed, please re-install it manually.
)
del vs_installer.exe
goto :eof
:: ===== end step 4: Visual Studio 2015 =====

:: ===== start step 5: CUDA 10 =====
:cuda10
echo ">>>>>>>> step [5/7]: CUDA 10.2"
nvcc --version | findstr /C:"10.2" > nul 2> nul || call :install_cuda
goto java-jre

:install_cuda
echo There is not CUDA in this PC, will install CUDA-10.2.
echo Download package from "https://paddle-ci.gz.bcebos.com/window_requirement/cuda_10.2.89_441.22_win10.exe"
wget -O cuda_installer.exe "https://paddle-ci.gz.bcebos.com/window_requirement/cuda_10.2.89_441.22_win10.exe"
echo Install CUDA-10.2 ...
:: -s [silent install]
start /wait cuda_installer.exe -s
if %errorlevel% == 0 (
  echo Install CUDA-10.2 success!
) else (
  echo Error***** Install CUDA-10.2 failed, please re-install it manually.
  goto :eof
)
del cuda_installer.exe
echo Download cudnn from "https://paddle-ci.gz.bcebos.com/window_requirement/cudnn-10.2-windows10-x64-v7.6.5.32.zip"
wget -O cudnn-10.2-windows10-x64-v7.6.5.32.zip "https://paddle-ci.gz.bcebos.com/window_requirement/cudnn-10.2-windows10-x64-v7.6.5.32.zip"
tar xf cudnn-10.2-windows10-x64-v7.6.5.32.zip
xcopy "cuda\bin\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin"
xcopy "cuda\include\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include"
xcopy "cuda\lib\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\lib"
rd /s /q cuda
del cudnn-10.2-windows10-x64-v7.6.5.32.zip
goto :eof
:: ===== end step 5: CUDA 10 =====

:: ===== start step 6: java jre =====
:java-jre
echo ">>>>>>>> step [6/7]: java jre"
java > nul 2> nul || call :install_java
goto xly-agent

:install_java
echo There is not java-jre in this PC, will install java-jre.
echo Download package from "https://paddle-ci.gz.bcebos.com/window_requirement/jre-8u261-windows-i586.exe"
wget -O jre-8u261-windows-x64.exe "https://paddle-ci.gz.bcebos.com/window_requirement/jre-8u261-windows-i586.exe"
echo Install java-jre ...
:: -s [silent install]
start /wait jre-8u261-windows-x64.exe /s
if %errorlevel% == 0 (
  echo Install java success!
) else (
  echo Error***** Install java failed, please re-install it manually.
)
del jre-8u261-windows-x64.exe
goto :eof
:: ===== end step 6: java jre =====

:: ===== start step 7: xly agent =====
:xly-agent
echo ">>>>>>>> step [7/7]: xly agent"
wget -O agent.jar "https://paddle-ci.gz.bcebos.com/window_requirement/agent.jar"
goto :eof
:: ===== end step 8: xly agent =====

:: Copyright (c) 2020 PaddlePaddle 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.
::
:: ===============================
:: Build Paddle compile enviroment
:: ===============================
:: Description:
::
::   Install compile enviroment for xly CI.
::
::   Include:
::     1. CMake 3.17.0
::     2. Git 2.28.0
::     3. Python 3.7.8
::     4. Visual Studio 2015 with update 3
::     5. CUDA 10
::     6. java jre
::     7. xly agent

:: Echo command is not required.
@echo off
cd /d %~dp0%

:: ===== start step 0: wget tool =====
:: Download wget for windows when there is not wget tool.
echo ">>>>>>>> step [0/7]: wget tool"
wget --help > nul 2> nul || call:install_wget
goto cmake

:install_wget
echo There is not wget in this PC, will download wget 1.20.
echo Download package from https://eternallybored.org/misc/wget/1.20/64/wget.exe ...
certutil -urlcache -split -f https://eternallybored.org/misc/wget/1.20/64/wget.exe > nul 2> nul
if %errorlevel% == 0 (
  echo Download wget tool into %cd% success.
) else (
  echo Error***** Download wget tool failed, please download it before rerun.
  exit /b 1
)
goto :eof
:: ===== end step 0: wget tool =====

:: ===== start step 1: cmake =====
:: Download CMake-3.17.0 and add in PATH when it not installed.
:: TODO: limit version >= 3.17.0
:cmake
echo ">>>>>>>> step [1/7]: CMake 3.17.0"
cmake --help > nul 2> nul || call :install_cmake
goto git

:install_cmake
echo There is not cmake in this PC, will install cmake-3.17.0.
echo Download package from https://cmake.org/files/v3.17/cmake-3.17.0-win64-x64.msi ...
wget -O cmake-3.17.0-win64-x64.msi https://cmake.org/files/v3.17/cmake-3.17.0-win64-x64.msi
echo Install cmake-3.17.0 ...
:: /passive [silent installation]
:: /norestart [do not restart]
:: ADD_CMAKE_TO_PATH = System [add CMake to the system PATH for all users]
start /wait cmake-3.17.0-win64-x64.msi /passive /norestart ADD_CMAKE_TO_PATH=System
if %errorlevel% == 0 (
  echo Install CMake-3.17.0 success!
) else (
  echo Error***** Install Cmake-3.17.0 failed, please re-install it manually.
)
del cmake-3.17.0-win64-x64.msi
goto :eof
:: ===== end step 1: cmake =====

:: ===== start step 2: Git =====
:: Download Git-2.28.0 and add in PATH when it not installed.
:: TODO: limit version >= 2.28.0
:git
echo ">>>>>>>> step [2/8]: Git 2.28.0"
git --help > nul 2> nul || call :install_git
goto python

:install_git
echo There is not git in this PC, will install Git-2.28.0.
echo Download package from https://github.com/git-for-windows/git/releases/download/v2.28.0.windows.1/Git-2.28.0-64-bit.exe ...
wget -O Git-2.28.0-64-bit.exe https://github.com/git-for-windows/git/releases/download/v2.28.0.windows.1/Git-2.28.0-64-bit.exe
echo Install Git-2.28.0 ...
:: /SILENT [silent install]
:: /ALLUSERS [add path for all users]
:: /NORESTART [do not restart]
start /wait Git-2.28.0-64-bit.exe /SILENT /ALLUSERS /NORESTART
if %errorlevel% == 0 (
  echo Install Git-2.28.0 success!
) else (
  echo Error***** Install Git-2.28.0 failed, please re-install it manually.
)
del Git-2.28.0-64-bit.exe
goto :eof
:: ===== end step 2: Git =====

:: ===== start step 3: Python =====
:: Download Python-3.7.8 and add in PATH when it not installed.
:: TODO: limit version >= 3.7.8
:python
echo ">>>>>>>> step [3/7]: Python 3.7.8"
python -V 2>&1 | findstr /C:"Python 3.7.8" > nul 2> nul || call :install_python
goto vs2015

:install_python
echo There is not Python in this PC, will install Python-3.7.8.
echo Download package from https://npm.taobao.org/mirrors/python/3.7.8/python-3.7.8-amd64.exe ...
wget -O python-3.7.8-amd64.exe https://npm.taobao.org/mirrors/python/3.7.8/python-3.7.8-amd64.exe
echo Install Python-3.7.8 ...
:: /passive [silent install]
:: InstallAllUsers [add path for all users]
:: PrependPath [add script/install into PATH]
:: TargetDir [install directory]
start /wait python-3.7.8-amd64.exe /passive InstallAllUsers=1 PrependPath=1 TargetDir=C:\Python37
if %errorlevel% == 0 (
  echo Install python-3.7.8 success!
) else (
  echo Error***** Install python-3.7.8 failed, please re-install it manually.
)
del python-3.7.8-amd64.exe
goto :eof
:: ===== end step 3: Python =====

:: ===== start step 4: Visual Studio 2015 =====
:: Download Visual Studio 2015 when it not installed.
:vs2015
echo ">>>>>>>> step [4/7]: Visual Studio 2015"
cmd /C "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 > nul 2> nul || call :install_visual_studio
goto :cuda10

:install_visual_studio
echo There is not Visual Studio in this PC, will install VS2015.
echo Download package from "https://paddle-ci.gz.bcebos.com/window_requirement/en_visual_studio_enterprise_2015_with_update_3_x86_x64_web_installer_8922986.exe"
wget -O vs_installer.exe "https://paddle-ci.gz.bcebos.com/window_requirement/en_visual_studio_enterprise_2015_with_update_3_x86_x64_web_installer_8922986.exe"
echo Install Visual Studio 2015 ...
:: /passive [silent install]
:: /norestart [no restart]
:: /NoRefresh [no refresh]
:: /InstallSelectableItems NativeLanguageSupport_Group [select Visual C++ for installing]
start /wait vs_installer.exe /passive /norestart /NoRefresh /InstallSelectableItems NativeLanguageSupport_Group
if %errorlevel% == 0 (
  echo Install Visual Studio 2015 success!
) else (
  echo Error***** Install Visual Studio 2015 failed, please re-install it manually.
)
del vs_installer.exe
goto :eof
:: ===== end step 4: Visual Studio 2015 =====

:: ===== start step 5: CUDA 10 =====
:cuda10
echo ">>>>>>>> step [5/7]: CUDA 10.2"
cmd /C nvcc --version 2> nul | findstr /C:"10.2" > nul 2> nul || call :install_cuda
goto java-jre

:install_cuda
echo There is not CUDA in this PC, will install CUDA-10.2.
echo Download package from "https://paddle-ci.gz.bcebos.com/window_requirement/cuda_10.2.89_441.22_win10.exe"
wget -O cuda_installer.exe "https://paddle-ci.gz.bcebos.com/window_requirement/cuda_10.2.89_441.22_win10.exe"
echo Install CUDA-10.2 ...
:: -s [silent install]
start /wait cuda_installer.exe -s
if %errorlevel% == 0 (
  echo Install CUDA-10.2 success!
) else (
  echo Error***** Install CUDA-10.2 failed, please re-install it manually.
  goto :eof
)
del cuda_installer.exe
echo Download cudnn from "https://paddle-ci.gz.bcebos.com/window_requirement/cudnn-10.2-windows10-x64-v7.6.5.32.zip"
wget -O cudnn-10.2-windows10-x64-v7.6.5.32.zip "https://paddle-ci.gz.bcebos.com/window_requirement/cudnn-10.2-windows10-x64-v7.6.5.32.zip"
tar xf cudnn-10.2-windows10-x64-v7.6.5.32.zip
xcopy /E /Y /R "cuda\bin\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin"
xcopy /E /Y /R "cuda\include\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include"
xcopy /E /Y /R "cuda\lib\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\lib"
rd /s /q cuda
del cudnn-10.2-windows10-x64-v7.6.5.32.zip
goto :eof
:: ===== end step 5: CUDA 10 =====

:: ===== start step 6: java jre =====
:java-jre
echo ">>>>>>>> step [6/7]: java jre"
cmd /C java -version > nul 2> nul || call :install_java
goto xly-agent

:install_java
echo There is not java-jre in this PC, will install java-jre.
echo Download package from "https://paddle-ci.gz.bcebos.com/window_requirement/jre-8u261-windows-i586.exe"
wget -O jre-8u261-windows-x64.exe "https://paddle-ci.gz.bcebos.com/window_requirement/jre-8u261-windows-i586.exe"
echo Install java-jre ...
:: -s [silent install]
start /wait jre-8u261-windows-x64.exe /s
if %errorlevel% == 0 (
  echo Install java success!
) else (
  echo Error***** Install java failed, please re-install it manually.
)
del jre-8u261-windows-x64.exe
goto :eof
:: ===== end step 6: java jre =====

:: ===== start step 7: xly agent =====
:xly-agent
echo ">>>>>>>> step [7/7]: xly agent"
wget -O agent.jar "https://paddle-ci.gz.bcebos.com/window_requirement/agent.jar"
:: ===== end step 8: xly agent =====

pause

Fix the name error and exit caused by judgment failed, test=document_fix (#28118)


@ECHO OFF

:: This script updates your IntelliJ IDEA CE installation from the latest compiled classes. This way you can easily
:: upgrade your working IDEA to the latest changes.
::
:: Before you run the script, ensure you have the following:
:: 1. Your IntelliJ IDEA project is fully built (do 'Rebuild Project' if unsure).
:: 2. WORK_IDEA_HOME points to the directory of IntelliJ IDEA build you want to upgrade.
:: 3. DEV_IDEA_HOME points to the directory of the project you built at step 1.
:: 4. JAVA_HOME points to a valid JDK installation.
:: 5. You quit IntelliJ IDEA.

IF NOT EXIST "%WORK_IDEA_HOME%\bin\idea.bat" (
  ECHO WORK_IDEA_HOME must be defined and point to IDEA installation you wish to update
  EXIT
)

IF NOT EXIST "%DEV_IDEA_HOME%\build\update.cmd" (
  ECHO DEV_IDEA_HOME must be defined and point to a source base you're updating from
  EXIT
)

IF NOT EXIST "%JAVA_HOME%\bin\java.exe" (
  ECHO JAVA_HOME must be defined and point to a valid Java installation
  EXIT
)

ECHO Updating "%WORK_IDEA_HOME%" from compiled classes at "%DEV_IDEA_HOME%"

CD "%DEV_IDEA_HOME%"

SET ANT_HOME=%DEV_IDEA_HOME%\lib\ant
SET EXEC_ANT="%JAVA_HOME%\bin\java.exe" -Xmx512m -Dant.home="%ANT_HOME%" -classpath "%ANT_HOME%\lib\ant-launcher.jar" org.apache.tools.ant.launch.Launcher
%EXEC_ANT% -f build/update.xml -Dwork.idea.home="%WORK_IDEA_HOME%"
IF NOT ERRORLEVEL 0 GOTO failed
IF NOT EXIST "%DEV_IDEA_HOME%\out\deploy" GOTO failed

RMDIR /Q /S "%WORK_IDEA_HOME%\lib"
RMDIR /Q /S "%WORK_IDEA_HOME%\plugins"

XCOPY "%DEV_IDEA_HOME%\bin\win\*.dll" "%WORK_IDEA_HOME%\bin\" /Q /E /Y
XCOPY "%DEV_IDEA_HOME%\bin\win\*.exe" "%WORK_IDEA_HOME%\bin\" /Q /E /Y
XCOPY "%DEV_IDEA_HOME%\out\deploy\*.*" "%WORK_IDEA_HOME%\" /Q /E /Y
GOTO done

:failed
ECHO Update failed; work IDEA build not modified

:done
CD /D "%WORK_IDEA_HOME%\bin"

@ECHO OFF

:: This script updates your IntelliJ IDEA CE installation from the latest compiled classes. This way you can easily
:: upgrade your working IDEA to the latest changes.
::
:: Before you run the script, ensure you have the following:
:: 1. Your IntelliJ IDEA project is fully built (do 'Rebuild Project' if unsure).
:: 2. WORK_IDEA_HOME points to the directory of IntelliJ IDEA build you want to upgrade.
:: 3. DEV_IDEA_HOME points to the directory of the project you built at step 1.
:: 4. JAVA_HOME points to a valid JDK installation.
:: 5. You quit IntelliJ IDEA.

IF NOT EXIST "%WORK_IDEA_HOME%\bin\idea.bat" (
  ECHO WORK_IDEA_HOME must be defined and point to IDEA installation you wish to update
  EXIT
)

IF NOT EXIST "%DEV_IDEA_HOME%\build\update.cmd" (
  ECHO DEV_IDEA_HOME must be defined and point to a source base you're updating from
  EXIT
)

IF NOT EXIST "%JAVA_HOME%\bin\java.exe" (
  ECHO JAVA_HOME must be defined and point to a valid Java installation
  EXIT
)

ECHO Updating "%WORK_IDEA_HOME%" from compiled classes at "%DEV_IDEA_HOME%"

CD "%DEV_IDEA_HOME%"

SET ANT_HOME=%DEV_IDEA_HOME%\lib\ant
SET EXEC_ANT="%JAVA_HOME%\bin\java.exe" -Xmx512m -Dant.home="%ANT_HOME%" -classpath "%ANT_HOME%\lib\ant-launcher.jar" org.apache.tools.ant.launch.Launcher
%EXEC_ANT% -f build/update.xml -Dwork.idea.home="%WORK_IDEA_HOME%"
IF NOT ERRORLEVEL 0 GOTO failed
IF NOT EXIST "%DEV_IDEA_HOME%\out\deploy" GOTO failed

RMDIR /Q /S "%WORK_IDEA_HOME%\lib"
RMDIR /Q /S "%WORK_IDEA_HOME%\plugins"

XCOPY "%DEV_IDEA_HOME%\bin\win\*.dll" "%WORK_IDEA_HOME%\bin\" /Q /E /Y
XCOPY "%DEV_IDEA_HOME%\bin\win\*.exe" "%WORK_IDEA_HOME%\bin\" /Q /E /Y
XCOPY "%DEV_IDEA_HOME%\out\deploy\dist\*.*" "%WORK_IDEA_HOME%\" /Q /E /Y
GOTO done

:failed
ECHO Update failed; work IDEA build not modified

:done
CD /D "%WORK_IDEA_HOME%\bin"

Fix update from sources on Windows

Fix update from sources on Windows

GitOrigin-RevId: b5893fcbfec14ba86b512257d3f82cde27261314


rem To make this project work with maven, execute this batch file to install dependencies which are not in the central repository

rem
rem Clone the rosetta-dps-sdk-projects-maven-lib project to get its jar and pom and install it into the local maven 2 repository
rm -rf .\wct-core\target\rosetta-dps-sdk-projects-maven-lib
mkdir -pv .\wct-core\target
call git clone https://github.com/NLNZDigitalPreservation/rosetta-dps-sdk-projects-maven-lib.call git ^
  .\wct-core\target\rosetta-dps-sdk-projects-maven-lib
call mvn install:install-file -Dfile=.\wct-core\target\rosetta-dps-sdk-projects-maven-lib\dps-sdk-5.5.0.jar ^
  -DpomFile=.\wct-core\target\rosetta-dps-sdk-projects-maven-lib\dps-sdk-5.5.0-pom.xml

rem
rem Clone the commons-httpclient-heritrix-1-14 project to get its jar and pom and install it into the local maven 2 repository
call rmdir /s /q .\wct-core\target\commons-httpclient-heritrix-1-14
mkdir -pv .\wct-core\target
call git clone https://github.com/WebCuratorTool/commons-httpclient-heritrix-1-14.call git ^
  .\wct-core\target\commons-httpclient-heritrix-1-14
call mvn install:install-file -Dfile=.\wct-core\target\commons-httpclient-heritrix-1-14\release_archive\commons-httpclient-3.1.1-heritrix-1.14.2-webcuratortool-2.0.1.jar ^
  -DpomFile=.\wct-core\target\commons-httpclient-heritrix-1-14\release_archive\commons-httpclient-3.1.1-heritrix-1.14.2-webcuratortool-2.0.1.pom

rem
rem Clone the commons-pool-heritrix-1-14 project to get its jar and pom and install it into the local maven 2 repository
call rmdir /s /q .\wct-core\target\commons-pool-heritrix-1-14
mkdir -pv .\wct-core\target
call git clone https://github.com/WebCuratorTool/commons-pool-heritrix-1-14.call git ^
  .\wct-core\target\commons-pool-heritrix-1-14
call mvn install:install-file -Dfile=.\wct-core\target\commons-pool-heritrix-1-14\release_archive\commons-pool-1.3.1-heritrix-1.14.2-webcuratortool-2.0.1.jar ^
  -DpomFile=.\wct-core\target\commons-pool-heritrix-1-14\release_archive\commons-pool-1.3.1-heritrix-1.14.2-webcuratortool-2.0.1.pom

rem
rem Clone the heritrix-1-14-adjust project to get its jar and pom and install it into the local maven 2 repository
call rmdir /s /q .\wct-core\target\heritrix-1-14-adjust
mkdir -pv .\wct-core\target
call git clone https://github.com/WebCuratorTool/heritrix-1-14-adjust.call git ^
  .\wct-core\target\heritrix-1-14-adjust
call mvn install:install-file -Dfile=.\wct-core\target\heritrix-1-14-adjust\release_archive\heritrix-1.14.2-webcuratortool-2.0.1.jar ^
  -DpomFile=.\wct-core\target\heritrix-1-14-adjust\release_archive\heritrix-1.14.2-webcuratortool-2.0.1.pom

rem
rem Install the other dependencies that exist locally

call call mvn install:install-file -DgroupId=com.ibm -DartifactId=ibmjsse -Dversion=1.0 -Dpackaging=jar -Dfile=wct-core\etc\lib\ibmjsse.jar
call call mvn install:install-file -DgroupId=JimiProClasses -DartifactId=JimiProClasses -Dversion=1.0 -Dpackaging=jar -Dfile=wct-core\etc\lib\JimiProClasses.jar
call call mvn install:install-file -DgroupId=org.eclipse.jdt.core -DartifactId=org.eclipse.jdt.core -Dversion=3.7.3 -Dpackaging=jar -Dfile=wct-core\etc\lib\org.eclipse.jdt.core_3.7.3.v20120119-1537.jar
call call mvn install:install-file -DgroupId=poi-2.0-RC1-20031102 -DartifactId=poi-2.0-RC1-20031102 -Dversion=2.0 -Dpackaging=jar -Dfile=wct-core\etc\lib\poi-2.0-RC1-20031102.jar
call call mvn install:install-file -DgroupId=smalltext-0.1.4 -DartifactId=smalltext-0.1.4 -Dversion=0.1.4 -Dpackaging=jar -Dfile=wct-core\etc\lib\smalltext-0.1.4.jar
call call mvn install:install-file -DgroupId=org.archive.wayback -DartifactId=wayback-core -Dversion=1.2.0 -Dpackaging=jar -Dfile=wct-core\etc\lib\wayback-core-1.2.0.jar
call call mvn install:install-file -DgroupId=it.unimi.dsi -DartifactId=mg4j -Dversion=2.0.1 -Dpackaging=jar -Dfile=wct-core\etc\lib\mg4j-2.0.1.jar

call call mvn install:install-file -DgroupId=net.sf -DartifactId=jargs -Dversion=1.0 -Dpackaging=jar -Dfile=wct-core\etc\lib\jargs.jar

call call mvn install:install-file -DgroupId=net.sf -DartifactId=jargs -Dversion=1.0 -Dpackaging=jar -Dfile=wct-core\etc\lib\jargs.jar

call call mvn install:install-file -DgroupId=org.archive -DartifactId=aheritrix -Dversion=1.14.1 -Dpackaging=jar -Dfile=wct-core\etc\lib\aheritrix-1.14.1.jar

call call mvn install:install-file -DgroupId=xdoclet -DartifactId=xdoclet -Dversion=1.2.3-updated -Dpackaging=jar -Dfile=wct-core\etc\xdoclet-1.2.3-updated.jar
call call mvn install:install-file -DgroupId=xdoclet -DartifactId=xjavadoc -Dversion=1.5-snapshot050611 -Dpackaging=jar -Dfile=wct-core\etc\xjavadoc-1.5-snapshot050611.jar

call call mvn install:install-file -DgroupId=javassist -DartifactId=javassist -Dversion=2.6.ga -Dpackaging=jar -Dfile=wct-store\etc\lib\javassist-2.6.ga.jar
call call mvn install:install-file -DgroupId=policy -DartifactId=policy -Dversion=4.2.2.GA -Dpackaging=jar -Dfile=wct-store\etc\lib\policy-4.2.2.GA.jar

rem To make this project work with maven, execute this batch file to install dependencies which are not in the central repository

rem
rem Clone the rosetta-dps-sdk-projects-maven-lib project to get its jar and pom and install it into the local maven 2 repository
RD /S /Q .\wct-core\target\rosetta-dps-sdk-projects-maven-lib
mkdir .\wct-core\target
call git clone https://github.com/NLNZDigitalPreservation/rosetta-dps-sdk-projects-maven-lib.git .\wct-core\target\rosetta-dps-sdk-projects-maven-lib
call mvn install:install-file -Dfile=.\wct-core\target\rosetta-dps-sdk-projects-maven-lib\dps-sdk-5.5.0.jar -DpomFile=.\wct-core\target\rosetta-dps-sdk-projects-maven-lib\dps-sdk-5.5.0-pom.xml

rem
rem Clone the commons-httpclient-heritrix-1-14 project to get its jar and pom and install it into the local maven 2 repository
RD /S /Q .\wct-core\target\commons-httpclient-heritrix-1-14
mkdir .\wct-core\target
call git clone https://github.com/WebCuratorTool/commons-httpclient-heritrix-1-14.git .\wct-core\target\commons-httpclient-heritrix-1-14
call mvn install:install-file -Dfile=.\wct-core\target\commons-httpclient-heritrix-1-14\release_archive\commons-httpclient-3.1.1-heritrix-1.14.2-webcuratortool-2.0.1.jar ^
  -DpomFile=.\wct-core\target\commons-httpclient-heritrix-1-14\release_archive\commons-httpclient-3.1.1-heritrix-1.14.2-webcuratortool-2.0.1.pom

rem
rem Clone the commons-pool-heritrix-1-14 project to get its jar and pom and install it into the local maven 2 repository
RD /S /Q .\wct-core\target\commons-pool-heritrix-1-14
mkdir .\wct-core\target
call git clone https://github.com/WebCuratorTool/commons-pool-heritrix-1-14.git .\wct-core\target\commons-pool-heritrix-1-14
call mvn install:install-file -Dfile=.\wct-core\target\commons-pool-heritrix-1-14\release_archive\commons-pool-1.3.1-heritrix-1.14.2-webcuratortool-2.0.1.jar ^
  -DpomFile=.\wct-core\target\commons-pool-heritrix-1-14\release_archive\commons-pool-1.3.1-heritrix-1.14.2-webcuratortool-2.0.1.pom

rem
rem Clone the heritrix-1-14-adjust project to get its jar and pom and install it into the local maven 2 repository
RD /S /Q .\wct-core\target\heritrix-1-14-adjust
mkdir .\wct-core\target
call git clone https://github.com/WebCuratorTool/heritrix-1-14-adjust.git .\wct-core\target\heritrix-1-14-adjust
call mvn install:install-file -Dfile=.\wct-core\target\heritrix-1-14-adjust\release_archive\heritrix-1.14.2-webcuratortool-2.0.1.jar ^
  -DpomFile=.\wct-core\target\heritrix-1-14-adjust\release_archive\heritrix-1.14.2-webcuratortool-2.0.1.pom

rem
rem Install the other dependencies that exist locally

call call mvn install:install-file -DgroupId=com.ibm -DartifactId=ibmjsse -Dversion=1.0 -Dpackaging=jar -Dfile=wct-core\etc\lib\ibmjsse.jar
call call mvn install:install-file -DgroupId=JimiProClasses -DartifactId=JimiProClasses -Dversion=1.0 -Dpackaging=jar -Dfile=wct-core\etc\lib\JimiProClasses.jar
call call mvn install:install-file -DgroupId=org.eclipse.jdt.core -DartifactId=org.eclipse.jdt.core -Dversion=3.7.3 -Dpackaging=jar -Dfile=wct-core\etc\lib\org.eclipse.jdt.core_3.7.3.v20120119-1537.jar
call call mvn install:install-file -DgroupId=poi-2.0-RC1-20031102 -DartifactId=poi-2.0-RC1-20031102 -Dversion=2.0 -Dpackaging=jar -Dfile=wct-core\etc\lib\poi-2.0-RC1-20031102.jar
call call mvn install:install-file -DgroupId=smalltext-0.1.4 -DartifactId=smalltext-0.1.4 -Dversion=0.1.4 -Dpackaging=jar -Dfile=wct-core\etc\lib\smalltext-0.1.4.jar
call call mvn install:install-file -DgroupId=org.archive.wayback -DartifactId=wayback-core -Dversion=1.2.0 -Dpackaging=jar -Dfile=wct-core\etc\lib\wayback-core-1.2.0.jar
call call mvn install:install-file -DgroupId=it.unimi.dsi -DartifactId=mg4j -Dversion=2.0.1 -Dpackaging=jar -Dfile=wct-core\etc\lib\mg4j-2.0.1.jar

call call mvn install:install-file -DgroupId=net.sf -DartifactId=jargs -Dversion=1.0 -Dpackaging=jar -Dfile=wct-core\etc\lib\jargs.jar

call call mvn install:install-file -DgroupId=net.sf -DartifactId=jargs -Dversion=1.0 -Dpackaging=jar -Dfile=wct-core\etc\lib\jargs.jar

call call mvn install:install-file -DgroupId=org.archive -DartifactId=aheritrix -Dversion=1.14.1 -Dpackaging=jar -Dfile=wct-core\etc\lib\aheritrix-1.14.1.jar

call call mvn install:install-file -DgroupId=xdoclet -DartifactId=xdoclet -Dversion=1.2.3-updated -Dpackaging=jar -Dfile=wct-core\etc\xdoclet-1.2.3-updated.jar
call call mvn install:install-file -DgroupId=xdoclet -DartifactId=xjavadoc -Dversion=1.5-snapshot050611 -Dpackaging=jar -Dfile=wct-core\etc\xjavadoc-1.5-snapshot050611.jar

call call mvn install:install-file -DgroupId=javassist -DartifactId=javassist -Dversion=2.6.ga -Dpackaging=jar -Dfile=wct-store\etc\lib\javassist-2.6.ga.jar
call call mvn install:install-file -DgroupId=policy -DartifactId=policy -Dversion=4.2.2.GA -Dpackaging=jar -Dfile=wct-store\etc\lib\policy-4.2.2.GA.jar

Fix remove dir, make dir and git commands to work on Windows.


Adjust http_server.bat to the new file system location of webkitpy/layout_tests/layout_package/http_server.

TEST=none
BUG=none

Review URL: http://codereview.chromium.org/553074

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@37047 0039d316-1c4b-4281-b951-d872f2087c98


add runprettier.cmd

add runprettier.cmd


@echo off
rem
rem Uninstall Cygwin.
rem See http://cygwin.com/faq/faq-nochunks.html#faq.setup.uninstall-all
rem

setlocal

set _ROOTDIR=C:\cygwin
set _PREFIX=CYGWIN-UNINSTALL:

goto :main

:check_rootdir
    echo %_PREFIX% Checking if %_ROOTDIR% is valid
    if exist "%_ROOTDIR%" goto :endif_rootdir
        echo %_PREFIX% ERROR: ROOTDIR "%_ROOTDIR%" does not exist.
        exit /b 1
    :endif_rootdir
    if exist "%_ROOTDIR%\Cygwin.ico" goto :endif_cygwin_ico
        echo %_PREFIX% ERROR: ROOTDIR "%_ROOTDIR%" does not appear to be a Cygwin directory.
        exit /b 1
    :endif_cygwin_ico
goto :eof

:check_admin
    rem Check for ADMIN privileges
    rem https://sites.google.com/site/eneerge/home/BatchGotAdmin

    echo %_PREFIX% Checking for Administrator privileges
    >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
    if "%ERRORLEVEL%" EQU "0" goto :endif_check_admin
        echo %_PREFIX% ERROR: You do not have Administrator privileges
        echo %_PREFIX% Rerun from a "Run as Administrator" command prompt
        exit /b 1
    :endif_check_admin
goto :eof

:uninstall_lsa
    echo %_PREFIX% Checking if cyglsa is hooked into OS
    reg query HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v "Authentication Packages" | findstr cyglsa > NUL:
    if %ERRORLEVEL% NEQ 0 exit /b 0

    echo %_PREFIX% Checking for sane Authentication Packages value
    for /f "usebackq tokens=4-9" %%f in (`reg query HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v "Authentication Packages"`) do set _AP_VALUE=%%f
    set _AP_VALUEQ=%_AP_VALUE:\0=?%
    for /f "usebackq delims=? tokens=1,2,3" %%f in ('%_AP_VALUEQ%') do (
        set _AP_VALUE_0=%%f
        set _AP_VALUE_1=%%g
        set _AP_VALUE_2=%%h
    )
    if not "%_AP_VALUE_0%" == "msv1_0" goto :lsa_bad
    echo %_AP_VALUE_1% | findstr cyglsa > NUL:
    if %ERRORLEVEL% NEQ 0 goto :lsa_bad
    if not "%_AP_VALUE_2%" == "" goto :lsa_bad

    echo %_PREFIX% Unhooking cyglsa
    reg add HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v "Authentication Packages" /t REG_MULTI_SZ /f /d msv1_0
    echo %_PREFIX% Please reboot and rerun this script
    exit /b 1

    :lsa_bad
    echo %_PREFIX% ERROR: Don't know how to handle Authentication Packages value of %_AP_VALUE%
    exit /b 1
goto :eof

:stop_services
    echo %_PREFIX% Stopping Cygwin services
    for /f "usebackq" %%s in (`%_ROOTDIR%\bin\cygrunsrv.exe --list`) do %_ROOTDIR%\bin\cygrunsrv --stop %%s
goto :eof

:remove_services
    echo %_PREFIX% Removing Cygwin services
    for /f "usebackq" %%s in (`%_ROOTDIR%\bin\cygrunsrv.exe --list`) do %_ROOTDIR%\bin\cygrunsrv --remove %%s
goto :eof

:clean_registry
    echo %_PREFIX% Removing Software\Cygwin from registry
    reg delete HKLM\Software\Cygwin /va /f > NUL: 2>&1
    reg delete HKLM\Software\Wow6432Node\Cygwin /va /f > NUL: 2>&1
    reg delete HKCU\Software\Cygwin /va /f > NUL: 2>&1
goto :eof

:remove_cygwin_dir
    echo %_PREFIX% Removing %_ROOTDIR%
    rd /s /q %_ROOTDIR%
goto :eof

:remove_shortcuts
    echo %_PREFIX% Remove Cygwin shell shortcuts from Desktop and Start menu!
goto :eof

:remove_local_users
    echo %_PREFIX% Remove sshd and cyg_server local users!
goto :eof

:main
    call :check_rootdir ||exit /b 1
    call :check_admin ||exit /b 1
    call :uninstall_lsa ||exit /b 1
    call :stop_services ||exit /b 1
    call :remove_services ||exit /b 1
    call :clean_registry ||exit /b 1
    call :remove_cygwin_dir ||exit /b 1
    call :remove_shortcuts ||exit /b 1
    call :remove_local_users ||exit /b 1

@echo off
rem
rem Uninstall Cygwin.
rem See http://cygwin.com/faq/faq-nochunks.html#faq.setup.uninstall-all
rem
rem Copyright (c) 2012-2012 Tom Schutter
rem All rights reserved.
rem
rem Redistribution and use in source and binary forms, with or without
rem modification, are permitted provided that the following conditions
rem are met:
rem
rem    - Redistributions of source code must retain the above copyright
rem      notice, this list of conditions and the following disclaimer.
rem    - Redistributions in binary form must reproduce the above
rem      copyright notice, this list of conditions and the following
rem      disclaimer in the documentation and/or other materials provided
rem      with the distribution.
rem
rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
rem COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
rem LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
rem CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
rem POSSIBILITY OF SUCH DAMAGE.
rem

setlocal

rem Configuration.
set _ROOTDIR=C:\cygwin
set _PREFIX=CYGWIN_UNINSTALL:

goto :main

:check_rootdir
    echo %_PREFIX% Checking if %_ROOTDIR% is valid
    if exist "%_ROOTDIR%" goto :endif_rootdir
        echo %_PREFIX% ERROR: ROOTDIR "%_ROOTDIR%" does not exist.
        exit /b 1
    :endif_rootdir
    if exist "%_ROOTDIR%\Cygwin.ico" goto :endif_cygwin_ico
        echo %_PREFIX% ERROR: ROOTDIR "%_ROOTDIR%" does not appear to be a Cygwin directory.
        exit /b 1
    :endif_cygwin_ico
exit /b 0

:check_admin
    rem Check for ADMIN privileges
    rem https://sites.google.com/site/eneerge/home/BatchGotAdmin

    echo %_PREFIX% Checking for Administrator privileges
    >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
    if "%ERRORLEVEL%" EQU "0" goto :endif_check_admin
        echo %_PREFIX% ERROR: You do not have Administrator privileges
        echo %_PREFIX% Rerun from a "Run as Administrator" command prompt
        exit /b 1
    :endif_check_admin
exit /b 0

:uninstall_lsa
    echo %_PREFIX% Checking if cyglsa is hooked into OS
    reg query HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v "Authentication Packages" | findstr cyglsa > NUL:
    if %ERRORLEVEL% NEQ 0 exit /b 0

    echo %_PREFIX% Checking for sane Authentication Packages value
    for /f "usebackq tokens=4-9" %%f in (`reg query HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v "Authentication Packages"`) do set _AP_VALUE=%%f
    set _AP_VALUEQ=%_AP_VALUE:\0=?%
    for /f "usebackq delims=? tokens=1,2,3" %%f in ('%_AP_VALUEQ%') do (
        set _AP_VALUE_0=%%f
        set _AP_VALUE_1=%%g
        set _AP_VALUE_2=%%h
    )
    if not "%_AP_VALUE_0%" == "msv1_0" goto :lsa_bad
    echo %_AP_VALUE_1% | findstr cyglsa > NUL:
    if %ERRORLEVEL% NEQ 0 goto :lsa_bad
    if not "%_AP_VALUE_2%" == "" goto :lsa_bad

    echo %_PREFIX% Unhooking cyglsa
    reg add HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v "Authentication Packages" /t REG_MULTI_SZ /f /d msv1_0
    echo %_PREFIX% Please reboot and rerun this script
    exit /b 1

    :lsa_bad
    echo %_PREFIX% ERROR: Don't know how to handle Authentication Packages value of %_AP_VALUE%
exit /b 1

:stop_services
    echo %_PREFIX% Stopping Cygwin services
    for /f "usebackq" %%s in (`%_ROOTDIR%\bin\cygrunsrv.exe --list`) do %_ROOTDIR%\bin\cygrunsrv --stop %%s
goto :eof

:check_for_cygwin_proc
    rem Check for any Cygwin processes.
    echo %_PREFIX% Checking for running Cygwin processes
    if not exist "%_ROOTDIR%\bin\ps.exe" exit /b 0
    set _TEMPFILE=%TEMP%\cygwin_setup.txt
    :retry
        "%_ROOTDIR%\bin\ps.exe" -l | findstr /v /c:"/usr/bin/ps" > %_TEMPFILE%
        findstr /v /r /c:"PID.*COMMAND" %_TEMPFILE% | findstr /r /c:"^..*" > NUL:
        if ERRORLEVEL 1 goto :ignore
        echo %_PREFIX% Found running Cygwin processes
        type %_TEMPFILE%
        del %_TEMPFILE%
        :ask_abort_retry_ignore
            set /p _ANSWER=Abort, Retry, or Ignore?
            set _ANSWER=%_ANSWER:~0,1%
            if "%_ANSWER%" == "a" exit /b 1
            if "%_ANSWER%" == "A" exit /b 1
            if "%_ANSWER%" == "r" goto :retry
            if "%_ANSWER%" == "R" goto :retry
            if "%_ANSWER%" == "i" goto :ignore
            if "%_ANSWER%" == "I" goto :ignore
        goto :ask_abort_retry_ignore
    :ignore
exit /b 0

:remove_services
    echo %_PREFIX% Removing Cygwin services
    for /f "usebackq" %%s in (`%_ROOTDIR%\bin\cygrunsrv.exe --list`) do %_ROOTDIR%\bin\cygrunsrv --remove %%s
goto :eof

:clean_registry
    echo %_PREFIX% Removing Software\Cygwin from registry
    reg delete HKLM\Software\Cygwin /va /f > NUL: 2>&1
    reg delete HKLM\Software\Wow6432Node\Cygwin /va /f > NUL: 2>&1
    reg delete HKCU\Software\Cygwin /va /f > NUL: 2>&1
goto :eof

:remove_cygwin_dir
    echo %_PREFIX% Removing %_ROOTDIR%
    rd /s /q %_ROOTDIR%
goto :eof

:remove_shortcuts
    echo %_PREFIX% Remove Cygwin shell shortcuts from Desktop and Start menu!
goto :eof

:remove_local_users
    echo %_PREFIX% Remove sshd and cyg_server local users!
goto :eof

:main
    call :check_rootdir ||exit /b 1
    call :check_admin ||exit /b 1
    call :uninstall_lsa ||exit /b 1
    call :stop_services
    call :check_for_cygwin_proc ||exit /b 1
    call :remove_services
    call :clean_registry
    call :remove_cygwin_dir
    call :remove_shortcuts
    call :remove_local_users

add file comments

cygwin_uninstall.bat: add file comments


.nuget\nuget push Yort.Ntp.Portable.1.0.11.nupkg -Source https://www.nuget.org/api/v2/package
pause

.nuget\nuget push Yort.Ntp.Portable.1.0.12.nupkg -Source https://www.nuget.org/api/v2/package
pause

Update nuget-push cmd for new version.

Update nuget-push cmd for new version.


@ECHO ON

REM This is based on Scott Hanselman's GetRuby.cmd
REM https://github.com/shanselman/march-is-for-makers/blob/master/getruby.cmd

REM Put Tex in Path
REM You can also use %TEMP% but it is cleared on site restart. Tools is persistent.
SET PATH=%PATH%;D:\home\site\deployments\tools\t\miktex-portable\miktex\bin

REM I am in the repository folder
pushd D:\home\site\deployments\tools
if not exist t md t
cd t
if exist miktex-portable goto end

echo No LaTeX, need to get it!

REM Get Ruby and Rails
REM 32bit
REM  get miktex portable from https://miktex.org/download/ctan/systems/win32/miktex/setup/windows-x86/miktex-portable-2.9.6942.exe
curl -o miktex-portable.exe https://miktex.org/download/ctan/systems/win32/miktex/setup/windows-x86/miktex-portable-2.9.6942.exe
REM Azure puts 7zip here!
EcHO START Unzipping MikTex
d:\7zip\7za x -y -omiktex-portable miktex-portable> outmiktex
EcHO DONE Unzipping MikTex

:end
popd
REM Install the url package
mpm --install=url
REM Build the pdf
pdflatex.exe resume.tex -halt-on-error

REM KuduSync is after this!

@ECHO ON

REM This is based on Scott Hanselman's GetRuby.cmd
REM https://github.com/shanselman/march-is-for-makers/blob/master/getruby.cmd

REM Put Tex in Path
REM You can also use %TEMP% but it is cleared on site restart. Tools is persistent.
SET PATH=%PATH%;D:\home\site\deployments\tools\t\miktex-portable\miktex\bin

REM I am in the repository folder
pushd D:\home\site\deployments\tools
if not exist t md t
cd t
if exist miktex-portable goto end

echo No LaTeX, need to get it!

REM Get Ruby and Rails
REM 32bit
REM  get miktex portable from https://miktex.org/download/ctan/systems/win32/miktex/setup/windows-x86/miktex-portable-2.9.6942.exe
curl -L -o miktex-portable.exe https://miktex.org/download/ctan/systems/win32/miktex/setup/windows-x86/miktex-portable-2.9.6942.exe
REM Azure puts 7zip here!
EcHO START Unzipping MikTex
d:\7zip\7za x -y -omiktex-portable miktex-portable> outmiktex
EcHO DONE Unzipping MikTex

:end
popd
REM Install the url package
mpm --install=url
REM Build the pdf
pdflatex.exe resume.tex -halt-on-error

REM KuduSync is after this!

Fix miktex install, handle redirect to the mirror


set ThemeRepository=%1
set ProjectToBuild=%2
set OutputDirectory=%3

git clone %ThemeRepository% --recurse-submodules

git pull %ThemeRepository%

git submodule update --remote --merge

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

msbuild %ProjectToBuild% /p:Configuration="Release" /p:OutputPath="%OutputDirectory%"

set ThemeRepository=%1
set ProjectToBuild=%2
set OutputDirectory=%3
set ThemeDirectory=%4

IF EXIST %ThemeDirectory% (
   rd %ThemeDirectory% /s /Q
)

git clone %ThemeRepository% --recurse-submodules

git pull %ThemeRepository%

cd %ThemeDirectory%

git submodule update --remote --merge

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

msbuild %ProjectToBuild% /p:Configuration="Release" /p:OutputPath="%OutputDirectory%"

clean theme directory if it exists

clean theme directory if it exists


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

@echo "Starting Windows build"

cd /d %~dp0
cd ..

@rem The image we're currently running has a broken version of Node.js enabled
@rem by nvm (v10.15.3), which has no npm bin. This hack uses the functional
@rem Node v8.9.1 to install npm@latest, it then uses this version of npm to
@rem install npm for v10.15.3.
call nvm use v8.9.1 || goto :error
call node C:\Users\kbuilder\AppData\Roaming\nvm-ps\versions\v8.9.1\node_modules\npm-bootstrap\bin\npm-cli.js i npm -g || goto :error
call nvm use v10.15.3 || goto :error
call node C:\Users\kbuilder\AppData\Roaming\nvm-ps\versions\v8.9.1\node_modules\npm\bin\npm-cli.js i npm -g || goto :error

call npm install || goto :error
call npm run test || goto :error

goto :EOF

:error
exit /b 1

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

@echo "Starting Windows build"

cd /d %~dp0
cd ..

@rem npm path is not currently set in our image, we should fix this next time
@rem we upgrade Node.js in the image:
SET PATH=%PATH%;/cygdrive/c/Program Files/nodejs/npm

call nvm use v12.14.1
call which node

call npm install || goto :error
call npm run test || goto :error

goto :EOF

:error
exit /b 1

build: update windows configuration to match new vm


pushd %~dp0

"%PROGRAMFILES(X86)%\MSBuild\14.0\Bin\MSBuild.exe" /p:InstallAddin=True %*
if not %ERRORLEVEL% == 0 goto Error

goto Exit

:Error
echo ERROR
pause
goto Exit

:Exit
popd

@echo off
setlocal enableextensions enabledelayedexpansion

pushd %~dp0

rem try to find MSBuild in VS2017
rem the "correct" way is to use a COM API. not easy here.

FOR %%E in (Enterprise, Professional, Community) DO (
	set "MSBUILD_EXE=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\%%E\MSBuild\15.0\Bin\MSBuild.exe"
	if exist "!MSBUILD_EXE!" goto :build
)

echo Could not find MSBuild 15
popd
exit /b 1

:build

set "CONFIG=Release"
set "PLATFORM=Any CPU"

"%MSBUILD_EXE%" /target:Restore %* || goto :error
"%MSBUILD_EXE%" /m "/p:Configuration=%CONFIG%" "/p:Platform=%PLATFORM%" /p:InstallAddin=True %* || goto :error

goto :exit

:error

for %%x in (%CMDCMDLINE%) do if /i "%%~x" == "/c" pause
popd
exit /b %ERRORLEVEL%

:exit
popd

Update Install.bat

Update Install.bat


nuget pack AgateLib/AgateLib.csproj
nuget pack AgateLib.AgateSDL/AgateLib.SDL.csproj
nuget pack AgateLib.OpenGL/AgateLib.OpenGL.csproj
nuget pack AgateLib.Platform.WinForms/AgateLib.Platform.WinForms.csproj
nuget pack AgateLib.Platform.Test/AgateLib.Platform.Test.csproj
nuget pack AgateLib.Platform.IntegrationTest/AgateLib.Platform.IntegrationTest.csproj

mkdir packages
move *.nupkg packages

nuget pack AgateLib/AgateLib.csproj
if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%

nuget pack AgateLib.AgateSDL/AgateLib.SDL.csproj
if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%

nuget pack AgateLib.OpenGL/AgateLib.OpenGL.csproj
if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%

nuget pack AgateLib.Platform.WinForms/AgateLib.Platform.WinForms.csproj
if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%

nuget pack AgateLib.Platform.Test/AgateLib.Platform.Test.csproj
if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%

nuget pack AgateLib.Platform.IntegrationTest/AgateLib.Platform.IntegrationTest.csproj
if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%

Add error checking to package.bat.

Add error checking to package.bat.


echo on

go get -d -v -t ./...

pushd %0\..\..

call build.bat

pushd %0\..

go get github.com/mackerelio/mackerel-agent/wix/wrapper
go get github.com/mackerelio/mackerel-agent/wix/replace

go build -o ..\build\wrapper.exe wrapper\wrapper_windows.go
go build -o ..\build\replace.exe replace\replace_windows.go

REM retrieve numeric version from git tag
FOR /F "usebackq" %%w IN (`git describe --tags --abbrev^=0`) DO SET VERSION=%%w
set VERSION=%VERSION:v=%
FOR /F "tokens=1 delims=-+" %%w IN ('ECHO %%VERSION%%') DO SET VERSION=%%w
IF "%VERSION%"=="staging" (
  EXIT /B
)

del /F mackerel-agent.wxs
..\build\replace.exe mackerel-agent.wxs.template mackerel-agent.wxs "___VERSION___" "%VERSION%"

"%WIX%bin\candle.exe" mackerel-agent.wxs
"%WIX%bin\light.exe" -ext WixUIExtension -out "..\build\mackerel-agent.msi" mackerel-agent.wixobj

REM code signing if build on tags
if defined APPVEYOR_REPO_TAG_NAME (
  certutil -f -decode c:\mackerel-secure\cert.p12.base64 c:\mackerel-secure\cert.p12

  FOR /F "usebackq" %%w IN (`type c:\mackerel-secure\certpass`) DO "%SIGNTOOL%" sign /fd sha256 /t "http://timestamp.verisign.com/scripts/timestamp.dll" /f "c:\mackerel-secure\cert.p12" /p "%%w" /v "..\build\mackerel-agent.msi"
)

echo on

go get -d -v -t ./...

pushd %0\..\..

call build.bat

pushd %0\..

go get github.com/mackerelio/mackerel-agent/wix/wrapper
go get github.com/mackerelio/mackerel-agent/wix/replace

go build -o ..\build\wrapper.exe wrapper\wrapper_windows.go
go build -o ..\build\replace.exe replace\replace_windows.go

REM retrieve numeric version from git tag
FOR /F "usebackq" %%w IN (`git tag -l --sort=-version:refname "v*" | head -1`) DO SET VERSION=%%w
set VERSION=%VERSION:v=%
FOR /F "tokens=1 delims=-+" %%w IN ('ECHO %%VERSION%%') DO SET VERSION=%%w
IF "%VERSION%"=="staging" (
  EXIT /B
)

del /F mackerel-agent.wxs
..\build\replace.exe mackerel-agent.wxs.template mackerel-agent.wxs "___VERSION___" "%VERSION%"

"%WIX%bin\candle.exe" mackerel-agent.wxs
"%WIX%bin\light.exe" -ext WixUIExtension -out "..\build\mackerel-agent.msi" mackerel-agent.wixobj

REM code signing if build on tags
if defined APPVEYOR_REPO_TAG_NAME (
  certutil -f -decode c:\mackerel-secure\cert.p12.base64 c:\mackerel-secure\cert.p12

  FOR /F "usebackq" %%w IN (`type c:\mackerel-secure\certpass`) DO "%SIGNTOOL%" sign /fd sha256 /t "http://timestamp.verisign.com/scripts/timestamp.dll" /f "c:\mackerel-secure\cert.p12" /p "%%w" /v "..\build\mackerel-agent.msi"
)

change git log

change git log


:: Copyright 2018 The Outline Authors
::
:: 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 off

set DEVICE_NAME=outline-tap0
set DEVICE_HWID=tap0901

:: Check whether the device already exists.
netsh interface show interface name=%DEVICE_NAME% >nul
if %errorlevel% equ 0 (
  echo %DEVICE_NAME% already exists.
  exit /b
)

:: Add the device, recording the names of devices before and after to help
:: us find the name of the new device.
::
:: Note:
::  - While we could limit the search to devices having ServiceName=%DEVICE_HWID%,
::    that will cause wmic to output just "no instances available" when there
::    are no other TAP devices present, messing up the diff.
::  - We do not use findstr, etc., to strip blank lines because those ancient tools
::    typically don't understand/output non-Latin characters (wmic *does*, even on
::    Windows 7).
set BEFORE_DEVICES=%tmp%\outlineinstaller-tap-devices-before.txt
set AFTER_DEVICES=%tmp%\outlineinstaller-tap-devices-after.txt

echo Storing current network device list...
wmic nic where "netconnectionid is not null" get netconnectionid > "%BEFORE_DEVICES%"
if %errorlevel% neq 0 (
  echo Could not store network device list. >&2
  exit /b 1
)
type "%BEFORE_DEVICES%"

echo Creating TAP network device...
tap-windows6\tapinstall install tap-windows6\OemVista.inf %DEVICE_HWID%
if %errorlevel% neq 0 (
  echo Could not create TAP network device. >&2
  exit /b 1
)
echo Storing new network device list...
wmic nic where "netconnectionid is not null" get netconnectionid > "%AFTER_DEVICES%"
if %errorlevel% neq 0 (
  echo Could not store network device list. >&2
  exit /b 1
)
type "%AFTER_DEVICES%"

:: Find the name of the new device and rename it.
::
:: Obviously, this command is a beast; roughly what it does, in this order, is:
::  - perform a diff on the *trimmed* (in case wmic uses different column widths) before and after
::    text files
::  - remove leading/trailing space and blank lines with trim()
::  - store the result in NEW_DEVICE
::  - print NEW_DEVICE, for debugging (though non-Latin characters may appear as ?)
::  - invoke netsh
::
:: Running all this in one go helps reduce the need to deal with temporary
:: files and the character encoding headaches that follow.
::
:: Note that we pipe input from /dev/null to prevent Powershell hanging forever
:: waiting on EOF.
echo Searching for new TAP network device name...
powershell "(compare-object (cat \"%BEFORE_DEVICES%\" | foreach-object {$_.trim()}) (cat \"%AFTER_DEVICES%\" | foreach-object {$_.trim()}) | format-wide -autosize | out-string).trim() | set-variable NEW_DEVICE; write-host \"New TAP device name: ${NEW_DEVICE}\"; netsh interface set interface name = \"${NEW_DEVICE}\" newname = \"%DEVICE_NAME%\"" <nul
if %errorlevel% neq 0 (
  echo Could not find or rename new TAP network device. >&2
  exit /b 1
)

:: We've occasionally seen delays before netsh will "see" the new device, at least for
:: purposes of configuring IP and DNS ("netsh interface show interface name=xxx" does not
:: seem to be affected).
echo Testing that the new TAP network device is visible to netsh...
netsh interface show interface name=%DEVICE_NAME% >nul
if %errorlevel% equ 0 goto :configure

:loop
echo waiting...
timeout /t 1 >nul
netsh interface show interface name=%DEVICE_NAME% >nul
if %errorlevel% neq 1 goto :loop

:configure
echo Configuring new TAP network device...

:: Give the device an IP address.
:: 10.0.85.x is a guess which we hope will work for most users (Docker for
:: Windows uses 10.0.75.x by default): if the address is already in use the
:: script will fail and the installer will show an error message to the user.
:: TODO: Actually search the system for an unused subnet or make the subnet
::       configurable in the Outline client.
netsh interface ip set address %DEVICE_NAME% static 10.0.85.2 255.255.255.0
if %errorlevel% neq 0 (
  echo Could not set TAP network device subnet. >&2
  exit /b 1
)

:: Windows has no system-wide DNS server; each network device can have its
:: "own" set of DNS servers. Windows seems to use the DNS server(s) of the
:: network device associated with the default gateway. This is good for us
:: as it means we do not have to modify the DNS settings of any other network
:: device in the system. Configure with OpenDNS and Dyn resolvers.
netsh interface ip set dnsservers %DEVICE_NAME% static address=208.67.222.222
if %errorlevel% neq 0 (
  echo Could not configure TAP device primary DNS. >&2
  exit /b 1
)
netsh interface ip add dnsservers %DEVICE_NAME% 216.146.35.35 index=2
if %errorlevel% neq 0 (
  echo Could not configure TAP device secondary DNS. >&2
  exit /b 1
)

:: Copyright 2018 The Outline Authors
::
:: 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 off

set DEVICE_NAME=outline-tap0
set DEVICE_HWID=tap0901

:: Check whether the device already exists.
netsh interface show interface name=%DEVICE_NAME% >nul
if %errorlevel% equ 0 (
  echo %DEVICE_NAME% already exists.
  exit /b
)

:: Add the device, recording the names of devices before and after to help
:: us find the name of the new device.
::
:: Note:
::  - While we could limit the search to devices having ServiceName=%DEVICE_HWID%,
::    that will cause wmic to output just "no instances available" when there
::    are no other TAP devices present, messing up the diff.
::  - We do not use findstr, etc., to strip blank lines because those ancient tools
::    typically don't understand/output non-Latin characters (wmic *does*, even on
::    Windows 7).
set BEFORE_DEVICES=%tmp%\outlineinstaller-tap-devices-before.txt
set AFTER_DEVICES=%tmp%\outlineinstaller-tap-devices-after.txt

echo Storing current network device list...
wmic nic where "netconnectionid is not null" get netconnectionid > "%BEFORE_DEVICES%"
if %errorlevel% neq 0 (
  echo Could not store network device list. >&2
  exit /b 1
)
type "%BEFORE_DEVICES%"

echo Creating TAP network device...
tap-windows6\tapinstall install tap-windows6\OemVista.inf %DEVICE_HWID%
if %errorlevel% neq 0 (
  echo Could not create TAP network device. >&2
  exit /b 1
)
echo Storing new network device list...
wmic nic where "netconnectionid is not null" get netconnectionid > "%AFTER_DEVICES%"
if %errorlevel% neq 0 (
  echo Could not store network device list. >&2
  exit /b 1
)
type "%AFTER_DEVICES%"

:: Find the name of the new device and rename it.
::
:: Obviously, this command is a beast; roughly what it does, in this order, is:
::  - perform a diff on the *trimmed* (in case wmic uses different column widths) before and after
::    text files
::  - remove leading/trailing space and blank lines with trim()
::  - store the result in NEW_DEVICE
::  - print NEW_DEVICE, for debugging (though non-Latin characters may appear as ?)
::  - invoke netsh
::
:: Running all this in one go helps reduce the need to deal with temporary
:: files and the character encoding headaches that follow.
::
:: Note that we pipe input from /dev/null to prevent Powershell hanging forever
:: waiting on EOF.
echo Searching for new TAP network device name...
powershell "(compare-object (cat \"%BEFORE_DEVICES%\" | foreach-object {$_.trim()}) (cat \"%AFTER_DEVICES%\" | foreach-object {$_.trim()}) | format-wide -autosize | out-string).trim() | set-variable NEW_DEVICE; write-host \"New TAP device name: ${NEW_DEVICE}\"; netsh interface set interface name = \"${NEW_DEVICE}\" newname = \"%DEVICE_NAME%\"" <nul
if %errorlevel% neq 0 (
  echo Could not find or rename new TAP network device. >&2
  exit /b 1
)

:: We've occasionally seen delays before netsh will "see" the new device, at least for
:: purposes of configuring IP and DNS ("netsh interface show interface name=xxx" does not
:: seem to be affected).
echo Testing that the new TAP network device is visible to netsh...
netsh interface show interface name=%DEVICE_NAME% >nul
if %errorlevel% equ 0 goto :configure

:loop
echo waiting...
timeout /t 1 >nul
netsh interface show interface name=%DEVICE_NAME% >nul
if %errorlevel% neq 1 goto :loop

:configure
echo Configuring new TAP network device...

:: Give the device an IP address.
:: 10.0.85.x is a guess which we hope will work for most users (Docker for
:: Windows uses 10.0.75.x by default): if the address is already in use the
:: script will fail and the installer will show an error message to the user.
:: TODO: Actually search the system for an unused subnet or make the subnet
::       configurable in the Outline client.
netsh interface ip set address %DEVICE_NAME% static 10.0.85.2 255.255.255.0
if %errorlevel% neq 0 (
  echo Could not set TAP network device subnet. >&2
  exit /b 1
)

:: Windows has no system-wide DNS server; each network device can have its
:: "own" set of DNS servers. Windows seems to use the DNS server(s) of the
:: network device associated with the default gateway. This is good for us
:: as it means we do not have to modify the DNS settings of any other network
:: device in the system. Configure with OpenDNS and Dyn resolvers.
echo Configuring primary DNS...
netsh interface ip set dnsservers %DEVICE_NAME% static address=208.67.222.222
if %errorlevel% neq 0 (
  echo Could not configure TAP device primary DNS. >&2
  exit /b 1
)
echo Configuring secondary DNS...
netsh interface ip add dnsservers %DEVICE_NAME% 216.146.35.35 index=2
if %errorlevel% neq 0 (
  echo Could not configure TAP device secondary DNS. >&2
  exit /b 1
)
echo TAP network device added and configured successfully

add echo for easier debugging

add echo for easier debugging