2 setlocal enabledelayedexpansion
4 REM ///////////////////////////////////////////////////////////////////////////
6 REM ///////////////////////////////////////////////////////////////////////////
8 set "MSVC_PATH=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC"
10 REM ###############################################
11 REM # DO NOT MODIFY ANY LINES BELOW THIS LINE !!! #
12 REM ###############################################
14 REM ///////////////////////////////////////////////////////////////////////////
15 REM // Setup environment
16 REM ///////////////////////////////////////////////////////////////////////////
20 if not exist "%JAVA_HOME%\bin\java.exe" (
21 echo Java could not be found, please make sure JAVA_HOME is set correctly!
25 call "%MSVC_PATH%\vcvarsall.bat" x86
27 if "%VCINSTALLDIR%"=="" (
28 echo %%VCINSTALLDIR%% not specified. Please check your MSVC_PATH var!
31 if not exist "%VCINSTALLDIR%\bin\cl.exe" (
32 echo C++ compiler not found. Please check your MSVC_PATH var!
36 REM ///////////////////////////////////////////////////////////////////////////
37 REM // Get current date and time (in ISO format)
38 REM ///////////////////////////////////////////////////////////////////////////
41 if not exist "%~dp0\..\Prerequisites\GnuWin32\date.exe" goto BuildError
43 for /F "tokens=1,2 delims=:" %%a in ('"%~dp0\..\Prerequisites\GnuWin32\date.exe" +ISODATE:%%Y-%%m-%%d') do (
44 if "%%a"=="ISODATE" set "ISO_DATE=%%b"
47 if "%ISO_DATE%"=="" goto BuildError
49 REM ///////////////////////////////////////////////////////////////////////////
50 REM // Build the binaries
51 REM ///////////////////////////////////////////////////////////////////////////
53 echo ---------------------------------------------------------------------
55 echo ---------------------------------------------------------------------
57 for %%p in (Win32, x64) do (
58 MSBuild.exe /property:Platform=%%p /property:Configuration=Release /target:clean "%~dp0\ClearClipboard.sln"
59 if not "!ERRORLEVEL!"=="0" goto BuildError
60 MSBuild.exe /property:Platform=%%p /property:Configuration=Release /target:rebuild "%~dp0\ClearClipboard.sln"
61 if not "!ERRORLEVEL!"=="0" goto BuildError
62 MSBuild.exe /property:Platform=%%p /property:Configuration=Release /target:build "%~dp0\ClearClipboard.sln"
63 if not "!ERRORLEVEL!"=="0" goto BuildError
66 REM ///////////////////////////////////////////////////////////////////////////
67 REM // Create documents
68 REM ///////////////////////////////////////////////////////////////////////////
70 for %%i in ("%~dp0\*.md") do (
72 "%~dp0\..\Prerequisites\Pandoc\pandoc.exe" --from markdown_github+pandoc_title_block+header_attributes+implicit_figures --to html5 --toc -N --standalone -H "%~dp0\..\Prerequisites\Pandoc\css\github-pandoc.inc" "%%~i" | "%JAVA_HOME%\bin\java.exe" -jar "%~dp0\..\Prerequisites\HTMLCompressor\bin\htmlcompressor-1.5.3.jar" --compress-css -o "%%~dpni.html"
73 if not "!ERRORLEVEL!"=="0" (
78 REM ///////////////////////////////////////////////////////////////////////////
79 REM // Copy base files
80 REM ///////////////////////////////////////////////////////////////////////////
82 echo ---------------------------------------------------------------------
84 echo ---------------------------------------------------------------------
86 set "PACK_PATH=%TMP%\~%RANDOM%%RANDOM%.tmp"
89 mkdir "%PACK_PATH%\x64"
91 copy "%~dp0\bin\Win32\Release\*.exe" "%PACK_PATH%"
92 copy "%~dp0\bin\.\x64\Release\*.exe" "%PACK_PATH%\x64"
93 copy "%~dp0\*.txt" "%PACK_PATH%"
94 copy "%~dp0\*.html" "%PACK_PATH%"
96 REM ///////////////////////////////////////////////////////////////////////////
98 REM ///////////////////////////////////////////////////////////////////////////
100 attrib +R "%PACK_PATH%\*.exe"
101 attrib +R "%PACK_PATH%\*.html"
102 attrib +R "%PACK_PATH%\*.txt"
104 REM ///////////////////////////////////////////////////////////////////////////
105 REM // Generate outfile name
106 REM ///////////////////////////////////////////////////////////////////////////
109 set "OUT_NAME=ClearClipboard.%ISO_DATE%"
112 if exist "%~dp0\out\%OUT_NAME%.zip" (
113 set "OUT_NAME=%OUT_NAME%.new"
117 REM ///////////////////////////////////////////////////////////////////////////
118 REM // Build the package
119 REM ///////////////////////////////////////////////////////////////////////////
122 "%~dp0\..\Prerequisites\GnuWin32\zip.exe" -9 -r -z "%~dp0\out\%OUT_NAME%.zip" "*.*" < "%~dp0\Copying.txt"
125 attrib +R "%~dp0\out\%OUT_NAME%.zip"
126 rmdir /Q /S "%PACK_PATH%"
128 REM ///////////////////////////////////////////////////////////////////////////
130 REM ///////////////////////////////////////////////////////////////////////////
133 echo Build completed.
139 REM ///////////////////////////////////////////////////////////////////////////
141 REM ///////////////////////////////////////////////////////////////////////////
146 echo Build has failed !!!