Improved compile.bat script

56 views
Skip to first unread message

Paul Edwards

unread,
Mar 20, 2013, 10:31:28 PM3/20/13
to noma...@googlegroups.com
I made some improvements to the compile.bat script which is below:

@echo off
CLS
set CompileScriptDebug=false
set FrmwrkPath=%windir%\Microsoft.NET\Framework\v2.0.50727\
set mode=install

:CheckCmdLine
if /i "%1" == "/?" goto Help
if /i "%1" == "/help" goto Help
if /i "%1" == "/debug" goto SetDebug
if /i "%1" == "/frmwrkpath" goto SetFrmwrkPath
if /i "%1" == "/sourcepath" goto SetSourcePath
if /i "%1" == "/queue" goto SetQueue
if /i "%1" == "/uninstall" goto SetUninstall
goto Compile

:Help
echo Nomad.NET assembly accelerator
echo.
echo By default this script generates native images for the Nomad.NET assemblies and its dependencies and installs them in the Native Images Cache.
echo.
echo You can optionally provide the following additional parameters:
echo.
echo./? or /Help  This message
echo /Debug       DEBUG: messages shown
echo /FrmwrkPath  Explicitly specify Microsoft.NET Framework version by path
echo /SourcePath  Explicitly specifiy source path rather than runtime path
echo /Queue       Compilation job is queued up for deferred processing
echo /Uninstall   Delete the native images of the Nomad.NET assemblies and
echo              dependencies from the Native Images Cache.
echo.
goto End

:SetDebug
shift
set CompileScriptDebug=true
if %CompileScriptDebug% == true echo DEBUG: messages enabled...
echo.
goto CheckCmdLine

:SetFrmwrkPath
shift
set FrmwrkPath=%1
if %CompileScriptDebug% == true echo DEBUG: Framework Path: %FrmwrkPath%
echo.
goto CheckCmdLine

:SetSourcePath
shift
set SourcePath=%~1
if %CompileScriptDebug% == true echo DEBUG: Source Path: %SourcePath%
echo.
goto CheckCmdLine

:SetQueue
shift
set NGenParams="/queue"
if %CompileScriptDebug% == true echo DEBUG: NGen Parameters: %NGenParams%
echo.
goto CheckCmdLine

:SetUninstall
shift
set mode=uninstall
echo Uninstalling...
echo.
goto CheckCmdLine


:Compile
set Ngen=%FrmwrkPath%ngen.exe
%Ngen% %mode% %sourcepath%Nomad.exe %NGenParams%
if not %errorlevel% == 0 goto Error
echo.
%Ngen% %mode% %sourcepath%Nomad.XmlSerializers.dll /ExeConfig:%sourcepath%Nomad.exe %NGenParams%
if not %errorlevel% == 0 goto Error
echo.
%Ngen% %mode% %sourcepath%CmdProxy.exe %NGenParams%
if not %errorlevel% == 0 goto Error
echo.
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" goto 64-bit
if not %errorlevel% == 0 goto Error
goto Success

:64-bit
if %CompileScriptDebug% == true echo DEBUG: 64-bit Architecture detected!
echo.
%Ngen% %mode% %sourcepath%Nomad_x86.exe %NGenParams%
if not %errorlevel% == 0 goto Error

:Success
echo.
echo.Nomad assembly %mode% complete.
echo.
goto End

:Error
echo.
echo Error encountered!
echo.
pause
exit /b -1


:End
pause


If you want to see a side-by-side diff, I suggest using the excellent Open Source WinMerge utility.

--
Reply all
Reply to author
Forward
0 new messages