In discussion on Clarion Live with @PeterPetropoulos about this topic hereās an example of Build and BAT files I use often.
These BAT files have had lots of problem checking added making them longggggg.
00BldEisPayroll.msbuild file is specified in the call to MS Build in 00Bld2Compile.BAT
<Project DefaultTargets="Circular" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<!-- put problems in Pass 0 to be done manually (optionally) -->
<Pass0PrjDLL Include="
pr00.cwproj;
pr01.cwproj;
"/>
</ItemGroup>
<ItemGroup>
<Pass1PrjDLL Include="
LibCreate_ImpLib.cwproj;
prmsgbx.cwproj;
pr03.cwproj;
pr05.cwproj;
pr06.cwproj;
pr07.cwproj;
pr08.cwproj;
pr20.cwproj;
pr21.cwproj;
pr22.cwproj;
pr23.cwproj;
pr25.cwproj;
pr02.cwproj;
"/>
</ItemGroup>
<!-- Build again Pass 1 Proj with Mutual Imports / Circle Call Refs -->
<!-- This should NOT be required now that the LibCreate_ImpLib.cwproj above uses #implib to make LIBs from EXP -->
<ItemGroup>
<Pass2PrjCircle Include="
pr03.cwproj;
pr05.cwproj;
pr06.cwproj;
pr07.cwproj;
pr08.cwproj;
pr20.cwproj;
pr21.cwproj;
pr23.cwproj;
pr25.cwproj;
"/>
</ItemGroup>
<ItemGroup>
<Pass3PrjEXE Include="
pr04.cwproj;
pr05exe.cwproj;
pr10.cwproj;
pr30.cwproj;
prCON.cwproj;
Gemini.cwproj;
RebuildEisPR.cwproj;
"/>
<!-- PrCON.cwproj; -->
</ItemGroup>
<Target Name="Pass0BuildDLL">
<MSBuild Projects="@(Pass0PrjDLL)"
Targets="Build" ContinueOnError="true" />
</Target>
<Target Name="Pass1BuildDLL">
<MSBuild Projects="@(Pass1PrjDLL)"
Targets="Build" ContinueOnError="true" />
</Target>
<Target Name="Pass2BuildCircle">
<MSBuild Projects="@(Pass2PrjCircle)"
Targets="Build" ContinueOnError="true" />
</Target>
<Target Name="Pass3BuildEXE">
<MSBuild Projects="@(Pass3PrjEXE)"
Targets="Build" ContinueOnError="true" />
</Target>
</Project>
00BldxSetClaVars.BAT file is Call by most BAT files here to set %Variables for Clarion IDE Paths. That way I can move to other machines where the IDE may not be in C:\Clarion
SET ClaBinPath=X:\Clarion11\bin
IF EXIST C:\Clarion11\bin SET ClaBinPath=C:\Clarion11\bin
IF EXIST D:\Clarion11\bin SET ClaBinPath=D:\Clarion11\bin
IF EXIST "%ClaBinPath%" GOTO :GotClaBP
ECHO+
ECHO ????????????????????????????????????????????????????????????
ECHO ------------------------------------------------------------
ECHO Clarion Path "%ClaBinPath%" does NOT exist
ECHO ClarionCl.exe will fail.
ECHO Edit "SET ClaBinPath=" in %0%
ECHO ------------------------------------------------------------
PAUSE
GOTO :EndBadly
:GotClaBP
SET ClaClExe=%ClaBinPath%\ClarionCl.exe
IF EXIST "%ClaClExe%" GOTO :GotClaCL
ECHO+
ECHO ????????????????????????????????????????????????????????????
ECHO ------------------------------------------------------------
ECHO Clarion "%ClaClExe%" does NOT exist in "%ClaBinPath%"
ECHO Check what's wrong in "SET ClaBinPath=" in %0%
ECHO ------------------------------------------------------------
PAUSE
GOTO :EndBadly
:GotClaCL
GOTO :ExitBat
:EndBadly
:ExitBat
@REM cannot EXIT or CALL doesn't return
00Bld0Gen+Compile.BAT file drives the entire process of Generate and Build:
@REM Under Domain %~d0 & CD %~p0 set current drive & path to BAT Path
@%~d0
@CD %~p0
@Color 5e
@echo ==============================================================
@echo+
@echo Ready to Genarate using 00Bld1Generate.BAT
@echo then Compile using 00Bld2Compile.BAT
@echo+
@echo When done Log files will be opened in Notepad
@echo+
@echo+
@echo Pr00 and Pr01 tend to fail in this batch compile, so do you do again after.
@Echo Best for you to do BEFORE manually in IDE, then answer NO to below question.
@echo+
@Set BuildPassZero=Y
@CHOICE /C YN /M "???? Build Pr00 and Pr01 now in batch ??? "
@IF ERRORLEVEL 2 Set BuildPassZero=N
@IF (%BuildPassZero%)==(N) ECHO ..... Will Skip Building Pr00 and Pr01. BuildPassZero=%BuildPassZero%
@echo+
@REM moved to CLean--> @ECHO Delete QPR*.EXE QPR*.DLL QUSEREDIT.EXE to be re-compiled.
@REM moved to CLean--> @DEL QPR*.EXE QPR*.DLL QUSEREDIT.EXE
@REM moved to CLean--> @PAUSE
@DEL 00BuildGen.Log > nul
@DEL 00BUILD_PASS.log > nul
@DEL 00BUILD_Pass0.log > nul
@DEL 00BUILD_Pass1.log > nul
@DEL 00BUILD_Pass2.log > nul
@DEL 00BUILD_Pass3.log > nul
@DEL 00BUILD_ResultsEIS.log > nul
ECHO Results of build on %DATE% at %TIME% > 00BUILD_ResultsEIS.log
echo+ >> 00BUILD_ResultsEIS.log
echo Files before the Build >> 00BUILD_ResultsEIS.log
echo+ >> 00BUILD_ResultsEIS.log
@DIR Q*.DLL /on | Find "/" >> 00BUILD_ResultsEIS.log
@DIR *.EXE /on | Find "/" >> 00BUILD_ResultsEIS.log
@REM Carl trying to debug Build wants to Skip Generate. The GOTO skips the question
@GOTO :YesGenerate
@CHOICE /C YN /M "???? Skip Generate APPs (i.e. answer Y to just Compile)"
@IF ERRORLEVEL 1 GOTO :NoGenerate
:YesGenerate
@TITLE Generate in %CD%
CALL 00Bld1Generate.BAT nostop
:NoGenerate
@TITLE Clean Exiting in %CD%
CALL 00Bld2Clean.BAT
@TITLE Compile in %CD%
CALL 00Bld2Compile.BAT nostop
@TITLE Generate and Compile Complete in %CD%
ECHO+ >> 00BUILD_ResultsEIS.log
@echo ============================================================== >> 00BUILD_ResultsEIS.log
@IF NOT EXIST PrMsgBx.dll ECHO ???? MISSING ???? PrMsgBx.dll ?? File was NOT Built ?? >> 00BUILD_ResultsEIS.log
@IF NOT EXIST Qpr00.dll ECHO ???? MISSING ???? Qpr00.dll ?? File was NOT Built ?? >> 00BUILD_ResultsEIS.log
@IF NOT EXIST QPr01.dll ECHO ???? MISSING ???? QPr01.dll ?? File was NOT Built ?? >> 00BUILD_ResultsEIS.log
@IF NOT EXIST QPr02.dll ECHO ???? MISSING ???? QPr02.dll ?? File was NOT Built ?? >> 00BUILD_ResultsEIS.log
@IF NOT EXIST QPr03.dll ECHO ???? MISSING ???? QPr03.dll ?? File was NOT Built ?? >> 00BUILD_ResultsEIS.log
@IF NOT EXIST QPr06.dll ECHO ???? MISSING ???? QPr06.dll ?? File was NOT Built ?? >> 00BUILD_ResultsEIS.log
@IF NOT EXIST QPr07.dll ECHO ???? MISSING ???? QPr07.dll ?? File was NOT Built ?? >> 00BUILD_ResultsEIS.log
@IF NOT EXIST QPr08.dll ECHO ???? MISSING ???? QPr08.dll ?? File was NOT Built ?? >> 00BUILD_ResultsEIS.log
@IF NOT EXIST QPr20.dll ECHO ???? MISSING ???? QPr20.dll ?? File was NOT Built ?? >> 00BUILD_ResultsEIS.log
@IF NOT EXIST QPr21.dll ECHO ???? MISSING ???? QPr21.dll ?? File was NOT Built ?? >> 00BUILD_ResultsEIS.log
@IF NOT EXIST QPr22.dll ECHO ???? MISSING ???? QPr22.dll ?? File was NOT Built ?? >> 00BUILD_ResultsEIS.log
@IF NOT EXIST QPr23.dll ECHO ???? MISSING ???? QPr23.dll ?? File was NOT Built ?? >> 00BUILD_ResultsEIS.log
@IF NOT EXIST Qpr25.dll ECHO ???? MISSING ???? Qpr25.dll ?? File was NOT Built ?? >> 00BUILD_ResultsEIS.log
@IF NOT EXIST QPr04.exe ECHO ???? MISSING ???? QPr04.exe ?? File was NOT Built ?? >> 00BUILD_ResultsEIS.log
@IF NOT EXIST QPr05dll.dll ECHO ???? MISSING ???? QPr05dll.dll ?? File was NOT Built ?? Pr05.CwProj >> 00BUILD_ResultsEIS.log
@IF NOT EXIST QPr05.exe ECHO ???? MISSING ???? QPr05.exe ?? File was NOT Built ?? Pr05exe.CwProj >> 00BUILD_ResultsEIS.log
@IF NOT EXIST QPr10.exe ECHO ???? MISSING ???? QPr10.exe ?? File was NOT Built ?? >> 00BUILD_ResultsEIS.log
@IF NOT EXIST QPr30.exe ECHO ???? MISSING ???? QPr30.exe ?? File was NOT Built ?? >> 00BUILD_ResultsEIS.log
@IF NOT EXIST QPrCON.exe ECHO ???? MISSING ???? QPrCON.exe ?? File was NOT Built ?? >> 00BUILD_ResultsEIS.log
@IF NOT EXIST Gemini.exe ECHO ???? MISSING ???? Gemini.exe ?? File was NOT Built ?? >> 00BUILD_ResultsEIS.log
@IF NOT EXIST QUserEdit.exe ECHO ???? MISSING FILE ???? QUserEdit.exe ?? File was NOT Built ?? >> 00BUILD_ResultsEIS.log
@IF NOT EXIST QDoorEdit.exe ECHO ???? MISSING FILE ???? QDoorEdit.exe ?? File was NOT Built ?? >> 00BUILD_ResultsEIS.log
@echo ============================================================== >> 00BUILD_ResultsEIS.log
echo+ >> 00BUILD_ResultsEIS.log
echo Files after the Build >> 00BUILD_ResultsEIS.log
@DIR Q*.DLL /on | Find "/" >> 00BUILD_ResultsEIS.log
@DIR *.EXE /on | Find "/" >> 00BUILD_ResultsEIS.log
echo+ >> 00BUILD_ResultsEIS.log
ECHO Build complete on %DATE% at %TIME% >> 00BUILD_ResultsEIS.log
START NOTEPAD.EXE 00BUILD_ResultsEIS.log
Color e5
@Echo+
@Echo Gen + Compile All Done. Review the Logs opened in Notepad.
@echo+
@Pause
DEL %0.bak
00Bld1Generate.BAT file generates the CLWE using ClarionCl.exe which is actually in a Call to 00BldxClarionCLGen1.BAT
@REM Under Domain %~d0 & CD %~p0 set current drive & path to BAT Path
@%~d0
@CD %~p0
@SET BldGenLog=00BuildGen.Log
@REM @SET ClaBinPath=X:\Clarion10\bin
@REM @IF EXIST C:\Clarion10\bin SET ClaBinPath=C:\Clarion10\bin
@REM @IF EXIST D:\Clarion10\bin SET ClaBinPath=D:\Clarion10\bin
@REM IF EXIST "%ClaBinPath%" GOTO :GotCla
@REM ECHO Clarion Path "%ClaBinPath%" does NOT exist
@REM ECHO ClarionCl.exe will fail. Edit "SET ClaBinPath=" in %0%
@REM PAUSE
@REM GOTO :EndBat
@REM :GotCla
@CALL 00BldxSetClaVars.BAT
@IF NOT EXIST "%ClaBinPath%" GOTO :EndBat
SET ClaClExe=%ClaBinPath%\ClarionCl.exe
SET ClaGenCmd=%ClaClExe% -ag
@echo ==============================================================
@echo+
@echo Ready to Genarate all using %ClaGenCmd% %CD%\xxx.sln
@echo+
@IF (%1)==(nostop) GOTO :NoStop1
@pause
:NoStop1
@echo Building all
Echo Generation in %CD% at %TIME% on %date% using %0 > %BldGenLog%
SET ClGenBat=00BldxClarionCLGen1.BAT
Echo Generate with CALL to %ClGenBat%
REM VerSontrol software is setting my APVs to ReadOnly so strip all those right now!
ATTRIB -R *.APV > nul
@rem in Alpha order because for generate should not matter
CALL %ClGenBat% PRMsgBx %BldGenLog%
IF (%BuildPassZero%)==(N) GOTO :SkipZeroPass
CALL %ClGenBat% Pr00 %BldGenLog%
CALL %ClGenBat% Pr01 %BldGenLog%
:SkipZeroPass
CALL %ClGenBat% pr02 %BldGenLog%
CALL %ClGenBat% Pr03 %BldGenLog%
CALL %ClGenBat% pr04 %BldGenLog%
CALL %ClGenBat% pr05 %BldGenLog%
CALL %ClGenBat% pr05exe %BldGenLog%
CALL %ClGenBat% pr06 %BldGenLog%
CALL %ClGenBat% pr07 %BldGenLog%
CALL %ClGenBat% pr08 %BldGenLog%
CALL %ClGenBat% pr10 %BldGenLog%
CALL %ClGenBat% pr20 %BldGenLog%
CALL %ClGenBat% pr21 %BldGenLog%
CALL %ClGenBat% pr22 %BldGenLog%
CALL %ClGenBat% pr23 %BldGenLog%
CALL %ClGenBat% pr25 %BldGenLog%
CALL %ClGenBat% pr30 %BldGenLog%
CALL %ClGenBat% prCON %BldGenLog%
CALL %ClGenBat% Gemini %BldGenLog%
CALL %ClGenBat% RebuildEisPR %BldGenLog%
REM CALL %ClGenBat% useredit %BldGenLog%
REM CALL %ClGenBat% PrCON %BldGenLog%
REM PrCon raely changes so no need to be in Batch, plus it is likely to have errors if files changed
:AllDone
ECHO ========================================== >> %BldGenLog%
ECHO All Done %TIME% >> %BldGenLog%
DIR *.APP | Find /I ".APP" >> %BldGenLog%
ECHO+ >> %BldGenLog%
DIR *.CWPROJ | Find /I ".CWPROJ" >> %BldGenLog%
@echo --------------------------------------
start notepad.exe %BldGenLog%
@Echo+
@Echo All Done. Review the %BldGenLog% opened in Notepad.
@Echo If Gen was ok then run the BldCompile
@echo+
@IF (%1)==(nostop) GOTO :NoStop2
@Pause
:NoStop2
@REM DEL %0.bak
@REM DEL %ClGenBat%.BAK
00BldxClarionCLGen1.BAT file is called to run ClarionCl.exe for the passed APP
@REM was 00Bld1xClarionCLGen.BAT
@REM ren 00BldxClarionCLGen1.BAT
@REM Under Domain %~d0 & CD %~p0 set current drive & path to BAT Path
@%~d0
@CD %~p0
@TITLE Generate %1.APP in %CD%
@REM 5/23/17 changed from .APV to .APP since DecSys does not use APVs
ECHO OFF
REM Pass %1=File Name w/o Extension %2=LogFile
SET ApvSavePath=.\BldGenAppSave
@REM SET ClaBinPath=X:\Clarion10\bin
@REM IF EXIST C:\Clarion10\bin SET ClaBinPath=C:\Clarion10\bin
@REM IF EXIST D:\Clarion10\bin SET ClaBinPath=D:\Clarion10\bin
IF EXIST "%ClaBinPath%" GOTO :GotCla
ECHO Clarion Path "%ClaBinPath%" does NOT exist
ECHO ClarionCl.exe will fail. Edit "SET ClaBinPath=" in %0%
PAUSE
GOTO :EndBadly
:GotCla
SET ClaClExe=%ClaBinPath%\ClarionCl.exe
SET ClaGenCmd=%ClaClExe% -ag
ECHO ================================== Generate %1 ==================================
ECHO ================================== Generate %1 ================================== %TIME% >> %2
ECHO Generate with: %0
ECHO Folder: %CD%
ECHO Solution: %1
ECHO LogFile: %2
rem DIR %1.*
rem pause
IF NOT EXIST %1.sln ECHO Error SLN file does not exist %1.sln
IF NOT EXIST %1.sln GOTO :EndBadly
REM Save a Backup APV so can restore Date. Make sure and Del ApvSave incase orphan
IF NOT EXIST %ApvSavePath% MD %ApvSavePath%
REM do APP instead --> IF NOT EXIST %1.APV GOTO :NoApvFile
ECHO COPY %1.APP %ApvSavePath% - Save APP to restore date
IF EXIST %ApvSavePath%\%1.APP del %ApvSavePath%\%1.APP
copy %1.APP %ApvSavePath% /v
IF ERRORLEVEL 1 PAUSE
IF ERRORLEVEL 1 GOTO :EndBadly
IF NOT EXIST %ApvSavePath% ECHO Unexpected! %1.SLN does not exist in %ApvSavePath%
IF NOT EXIST %ApvSavePath% GOTO :EndBadly
rem Attrib +R %1.apv ClarionCL does not work if APV is RO so above made copy
:NoApvFile
REM Keep copy of SLN & CwProj with
copy %1.CwProj %ApvSavePath%
rem copy %1.SLN %ApvSavePath%
REM Attrib +R %1.CwProj
DIR %1.APP | Find /I "%1.APP" >> %2
@echo -------------------------------------- Gen Begin %TIME%
@echo+
@echo Generate %1 using %ClaGenCmd% %CD%\%1.sln
@echo Generate %1.sln >> %2
@echo %ClaGenCmd% %CD%\%1.sln >> %2
@echo+
ATTRIB -R %1.APP
%ClaGenCmd% %CD%\%1.sln >> %2
@REM ----- pause on error -----
@REM @ECHO ClarionCL returned ErrorLevel=%ErrorLevel% for %1.sln
@REM 03/09/20 saw this error: Error GENE000: The application C:\C11APPS\EisTrsTier2\Pr21.app cannot be load.
@IF NOT ERRORLEVEL 1 GOTO :NoErrz
@ECHO Error ???????????????????????????????????????????????????????????????????????
@ECHO ClarionCL returned ErrorLevel=%ErrorLevel% for %1.sln.
@ECHO To see the error messages view the log file: %2
@ECHO Error ???????????????????????????????????????????????????????????????????????
PAUSE
:NoErrz
@REM ----- pause on error -----
ECHO Generation done @ %TIME% >> %2
@GOTO :SkipVerbose
DIR %1.APP | Find /I "%1.APP" >> %2
DIR %1.CWPROJ | Find /I "%1.CWPROJ" >> %2
DIR %1.SLN | Find /I "%1.SLN" >> %2
:SkipVerbose
@echo -------------------------------------- Gen Done %TIME%
rem pause
Attrib -R %1.CWPROJ
REM do App instead of --> IF NOT EXIST %1.APV GOTO :NoApv2
REM --------- Copy APV back from %ApvSavePath% to restore date ----------
Echo After Generation copy APP backup to fix APP date
ECHO COPY %ApvSavePath%\%1.APP .\%1.APP - Restore APV from %ApvSavePath%
@REM ECHO Restore APP from %ApvSavePath% >> %2
copy %ApvSavePath%\%1.APP .\%1.APP
IF NOT ERRORLEVEL 1 GOTO :EndAOK
ECHO Error on restore APP from %ApvSavePath% - Level= %ErrorLevel% >> %2
ECHO Error on restore APP from %ApvSavePath% - Level= %ErrorLevel%
pause
goto :EndBadly
:NoApv2
:EndAOK
@REM DIR %1.APP | Find /I "%1.APP" >> %2
Echo Generation ended normally for %1.SLN
rem DIR %1.*
rem pause
GOTO :ExitBat
:EndBadly
ECHO ??????????????????? Generate %1 Ended BADLY? ??????????????????? >> %2
@ECHO+
@ECHO Ended Badly! Exiting Abnormally. Did not Generate %1.SLN
ECHO %1.APP in %CD%
DIR %1.APP | Find /I "%1.APP" >> %2
ECHO %1.APP in %ApvSavePath%
DIR %ApvSavePath%\%1.APP | Find /I "%1.APP" >> %2
ECHO+
Pause
Attrib -R %1.*
GOTO :ExitBat
:ExitBat
@REM cannot EXIT or CALL doesn't return
00Bld2Compile.BAT file runs MSBuild
@REM Under Domain %~d0 & CD %~p0 set current drive & path to BAT Path
@%~d0
@CD %~p0
SET BldProj=00BldEisPayroll.msbuild
SET BldConfig=DEBUG
@REM @SET ClaBinPath=X:\Clarion10\bin
@REM @IF EXIST C:\Clarion10\bin SET ClaBinPath=C:\Clarion10\bin
@REM @IF EXIST D:\Clarion10\bin SET ClaBinPath=D:\Clarion10\bin
@REM @IF EXIST "%ClaBinPath%" GOTO :GotCla
@REM ECHO Clarion Path "%ClaBinPath%" does NOT exist
@REM ECHO MSBuild will fail. Edit "SET ClaBinPath=" in %0%
@REM PAUSE
@REM GOTO :EndBat
@REM :GotCla
@CALL 00BldxSetClaVars.BAT
@IF NOT EXIST "%ClaBinPath%" GOTO :EndBat
SET BldSwitchz=/p:NoDependency="true" /p:CopyCoreFiles="true"
@echo off
@REM Other MSBuild switches of interest
@REM /detailedsummary or /ds Show detailed information at the end of the build log
@REM /verbosity:level or /v:level Information to display in the build log. levels: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].
@IF EXIST "%BldProj%" GOTO :GotBPrj
ECHO Build Project File "%BldProj%" does NOT exist
ECHO MSBuild will fail. Edit "SET BldProj=" in %0%
PAUSE
GOTO :EndBat
:GotBPrj
REM Find Newsest MsBuild.Exe In Win\Microsoft.NET\Framework
SET MsBuildExe=%windir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
IF Not Exist %MsBuildExe% SET MsBuildExe=%windir%\Microsoft.NET\Framework\v3.5\MSBuild.exe
IF Not Exist %MsBuildExe% SET MsBuildExe=%windir%\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe
IF Not Exist %MsBuildExe% ECHO Did Not Find MSBuild in %MsBuildExe%
IF Not Exist %MsBuildExe% PAUSE
ECHO+
Echo =======================================================================
ECHO+
ECHO Ready to MSBuild %BldProj% as "%BldConfig%" using %ClaBinPath%
ECHO Options: %BldSwitch%
ECHO MSBuild: %MsBuildExe%
ECHO+
@IF (%1)==(nostop) GOTO :NoStop
@PAUSE
:NoStop
DEL 00BUILD_PASS.log 2> NUL
DEL 00BUILD_Pass0.log 2> NUL
DEL 00BUILD_Pass1.log 2> NUL
DEL 00BUILD_Pass2.log 2> NUL
DEL 00BUILD_Pass3.log 2> NUL
REM Write (echo) info to 00BUILD_PASS.log
Echo Build in %CD% at %TIME% on %date% using %0 > 00BUILD_PASS.log
echo Project %BldProj% for "%BldConfig%" using %ClaBinPath% %BldSwitch% >> 00BUILD_PASS.LOG
ECHO MSBuild.exe is %MsBuildExe% >> 00BUILD_PASS.LOG
ECHO+ >> 00BUILD_PASS.LOG
ECHO The Build takes 3 passes: 1=DLLs; 2=DLL Circles; 3=EXEs. Each pass has a Build LOG >> 00BUILD_PASS.LOG
ECHO ******* Check the 1,2,3 Build_Pass#.LOG files at the bottom for "0 Errors" ******** >> 00BUILD_PASS.LOG
ECHO+ >> 00BUILD_PASS.LOG
IF (%BuildPassZero%)==(N) GOTO :SkipZeroPass
REM ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
@TITLE Compile Pass Zero (Problem APPs 00 and 01) in %CD%
@ECHO Pass0BuildDLL MSBuild %BldProj%
@SET Run1Bld=%MsBuildExe% %BldProj% /target:Pass0BuildDLL /p:ClarionBinPath="%ClaBinPath%" /p:Configuration="%BldConfig%" %BldSwitchz%
@ECHO %Run1Bld% >> 00BUILD_PASS.LOG
%Run1Bld% >> 00BUILD_Pass0.log
start notepad.exe 00BUILD_Pass0.log
REM ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
:SkipZeroPass
@echo ON
REM goto :pass3
@TITLE Compile Pass 1 of 3 in %CD%
@ECHO Pass1BuildDLL MSBuild %BldProj%
@SET Run1Bld=%MsBuildExe% %BldProj% /target:Pass1BuildDLL /p:ClarionBinPath="%ClaBinPath%" /p:Configuration="%BldConfig%" %BldSwitchz%
@ECHO %Run1Bld% >> 00BUILD_PASS.LOG
%Run1Bld% >> 00BUILD_Pass1.log
start notepad.exe 00BUILD_Pass1.log
REM 07/13/20 use LibCreate_ImpLib.cwproj and can Skip2Pass ========================================
@ECHO Skip Pass 2 because of LibCreate_ImpLib.cwproj made LIBs >> 00BUILD_PASS.LOG
@ECHO Skip Pass 2 because of LibCreate_ImpLib.cwproj made LIBs >> 00BUILD_Pass2.log
@Dir *.LIB /on >> 00BUILD_Pass2.log
GOTO :Skip2Pass
@SET Run2Bld=%MsBuildExe% %BldProj% /target:Pass2BuildCircle /p:ClarionBinPath="%ClaBinPath%" /p:Configuration="%BldConfig%" %BldSwitchz%
@TITLE Compile Pass 2 of 3 in %CD%
@ECHO %Run2Bld% >> 00BUILD_PASS.LOG
%Run2Bld% >> 00BUILD_Pass2.log
@start notepad.exe 00BUILD_Pass2.log
:Skip2Pass
REM 07/13/20 ========================================
:pass3
@SET Run3Bld=%MsBuildExe% %BldProj% /target:Pass3BuildEXE /p:ClarionBinPath="%ClaBinPath%" /p:Configuration="%BldConfig%" %BldSwitchz%
@TITLE Compile Pass 3 of 3 in %CD%
@ECHO %Run3Bld% >> 00BUILD_PASS.LOG
%Run3Bld% >> 00BUILD_Pass3.log
@start notepad.exe 00BUILD_Pass3.log
@Echo+ >> 00BUILD_PASS.LOG
@Echo ======== Search for "Error" in LOG files ========================== >> 00BUILD_PASS.LOG
@FIND /I /N "error" 00BUILD_Pass1.log >> 00BUILD_PASS.LOG
@FIND /I /N "error" 00BUILD_Pass2.log >> 00BUILD_PASS.LOG
@FIND /I /N "error" 00BUILD_Pass3.log >> 00BUILD_PASS.LOG
@Echo =================================================================== >> 00BUILD_PASS.LOG
@ECHO ===================================== Done %TIME% %DATE% >> 00BUILD_PASS.log
@ECHO --- DLL Files: (by Date) --- >> 00BUILD_PASS.log
@DIR *.dll /odn | Find /I ".DLL" >> 00BUILD_PASS.log
@ECHO+ >> 00BUILD_PASS.log
@ECHO --- EXE Files: (by Date) --- >> 00BUILD_PASS.log
@DIR *.exe /odn | Find /I ".EXE" >> 00BUILD_PASS.log
@start notepad.exe 00BUILD_Pass.log
@Echo OFF
Echo+
Echo Builds done, check 00BUILD_Pass*.log files
@IF (%1)==(nostop) GOTO :EndBat
Pause
:EndBat
@REM DEL %0.bak
00Bld2Clean.BAT file is called at the start to delete all the DLL and EXE files in the project:
@REM Under Domain %~d0 & CD %~p0 set current drive & path to BAT Path
@%~d0
@CD %~p0
Echo Clean EXE and DLL in %CD% at %TIME% on %date% using %0
DEL PrMsgBx.dll
IF (%BuildPassZero%)==(N) GOTO :SkipZeroPass
DEL Qpr00.dll
DEL QPr01.dll
:SkipZeroPass
DEL QPr02.dll
DEL QPr03.dll
DEL QPr05dll.dll
DEL QPr06.dll
DEL QPr07.dll
DEL QPr08.dll
DEL QPr20.dll
DEL QPr21.dll
DEL QPr22.dll
DEL QPr23.dll
DEL Qpr25.dll
DEL QPr04.exe
DEL QPr05.exe
DEL QPr10.exe
DEL QPr30.exe
DEL QPrCON.exe
DEL Gemini.exe
DEL RebuildEisPR.EXE
REM DEL qDoorEdit.exe
REM DEL qUSEREDIT.exe
DEL WinPreview????????-*.exe
@REM DEL %0.bak
LibCreate_ImpLib_prj.pr file was created using the BAT in my post above. This generates the LIBs from the generated EXPs for the Build can be done in one pass:
#noedit
-- #implib xxx.LIB xxx.EXP
#implib PRMSGBX.LIB PRMSGBX.EXP
-- #implib QPR00.LIB QPR00.EXP
-- #implib QPR01.LIB QPR01.EXP
#implib QPR02.LIB QPR02.EXP
#implib QPR03.LIB QPR03.EXP
#implib QPR06.LIB QPR06.EXP
#implib QPR07.LIB QPR07.EXP
#implib QPR08.LIB QPR08.EXP
#implib QPR20.LIB QPR20.EXP
#implib QPR21.LIB QPR21.EXP
#implib QPR22.LIB QPR22.EXP
#implib QPR23.LIB QPR23.EXP
#implib QPR25.LIB QPR25.EXP
LibCreate_ImpLib.cwproj is a simple Project to Include=āLibCreate_ImpLib_prj.prā to run #ImpLib. Donāt make this as XML, just add a simple Win EXE project and add the PR file.
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{396CA655-F1DB-47AE-AD97-463EB809F3D0}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">Win32</Platform>
<OutputType>Module</OutputType>
<RootNamespace>LibCreate_ImpLib</RootNamespace>
<AssemblyName>LibCreate_ImpLib</AssemblyName>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<Model>Dll</Model>
<DefineConstants>maincode=>on</DefineConstants>
<stack_size>16384</stack_size>
<CopyCore>True</CopyCore>
<OutputName>LibCreate_ImpLib</OutputName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>Full</DebugType>
<vid>full</vid>
<check_stack>True</check_stack>
<check_index>True</check_index>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<vid>off</vid>
<check_stack>False</check_stack>
<check_index>False</check_index>
<warnings>on</warnings>
<GenerateMap>True</GenerateMap>
<line_numbers>False</line_numbers>
</PropertyGroup>
<ItemGroup>
<Compile Include="LibCreate_ImpLib.clw" />
</ItemGroup>
<ItemGroup>
<Include Include="LibCreate_ImpLib_prj.pr" />
</ItemGroup>
<Import Project="$(ClarionBinPath)\SoftVelocity.Build.Clarion.targets" />
<PropertyGroup>
<PostBuildEvent>DEL LibCreate_ImpLib.LIB</PostBuildEvent>
</PropertyGroup>
</Project>
LibCreate_ImpLib.clw file is used in the above project that must exist but does nothing:
!Open LibCreate_ImpLib.PR under "Projects to Include" to see what this is really doing
!This makes the Import .LIBs from the .EXPs for this project. Just build this, it will NOT run
!Insert this project first in your bulk compile so all your LIBs are correct and you have no missing externals
PROGRAM
! MAP.
CODE
!Based on https://clarionmag.jira.com/wiki/spaces/clarion/pages/399918/Handling+circular+references+with+implib
!
!The TopSpeed / Clarion Project Laanguage is described in the AdvancedTopicsReferenceGuide.pdf
! Note this is WRONG syntax: #implib <ExpFilename> <LibFilename>
! The Right Syntax: #implib <LibFilename> <ExpFilename>
! Search #implib finds all examples with the right syntax: #implib %%drvname%%.lib %%drvname%%.exp
!This SLN under "Projects to Include" has LibCreate_ImpLib.PR Project file with lines like below that make the LIBs.
!-------------------------------------------------
! -- no need #implib ALLFILES.LIB ALLFILES.EXP -- no need to do first file built with no imports
! #implib REPORTS.LIB REPORTS.EXP
! #implib UPDATES.LIB UPDATES.EXP
!-------------------------------------------------
!Each line of the prj is simply an #implib statement followed by the name of the LIB to be created and the EXP to use when creating the LIB.
!
!So while this CLW has no code that does anything, it is set to create a LIB that can be disposed
!So ths CwProj has Post Build Event to: DEL LibCreate_ImpLib.LIB
!If this makes an EXE then: DEL LibCreate_ImpLib.EXE & LibCreate_ImpLib.LIB
!
!Created by Carl Barnes based on Dave Harms article and posts. Thanks you Dave! I also recall Gordon Smith recommending #implib.