• R/O
  • SSH
  • HTTPS

dzprepbuild: Commit


Commit MetaInfo

Révision68 (tree)
l'heure2017-09-04 02:19:37
Auteurtwm

Message de Log

(empty log message)

Change Summary

Modification

--- tags/1.3.2/src/PrepBuild.dpr (nonexistent)
+++ tags/1.3.2/src/PrepBuild.dpr (revision 68)
@@ -0,0 +1,31 @@
1+program PrepBuild;
2+
3+{$APPTYPE CONSOLE}
4+
5+uses
6+ SysUtils,
7+ Forms,
8+ d_XmlVersionInfo in 'd_XmlVersionInfo.pas' {dm_XmlVersionInfo: TDataModule},
9+ d_DprojVersionInfo in 'd_DprojVersionInfo.pas' {dm_DprojVersionInfo: TDataModule},
10+ d_BdsProjVersionInfo in 'd_BdsProjVersionInfo.pas' {dm_BdsProjVersionInfo: TDataModule},
11+ d_ManifestVersionInfo in 'd_ManifestVersionInfo.pas' {dm_ManifestVersionInfo: TDataModule},
12+ i_VersionInfoAccess in 'i_VersionInfoAccess.pas',
13+ u_DofVersionInfo in 'u_DofVersionInfo.pas',
14+ u_IniVersionInfo in 'u_IniVersionInfo.pas',
15+ u_CentralIniVersionInfo in 'u_CentralIniVersionInfo.pas',
16+ u_PrepBuildMain in 'u_PrepBuildMain.pas',
17+ u_VersionInfo in 'u_VersionInfo.pas',
18+ w_dzDialog in '..\libs\dzlib\forms\w_dzDialog.pas' {f_dzDialog},
19+ u_dzDefaultMain in '..\libs\dzlib\src\u_dzDefaultMain.pas';
20+
21+{$R *_icon.res}
22+{$R *_version.res}
23+{$R *_manifest.res}
24+
25+begin
26+ Application.Initialize;
27+ Application.Title := 'PrepBuild';
28+ MainClass := TPrepBuildMain;
29+ System.ExitCode := Main;
30+end.
31+
--- tags/1.3.2/src/PrepBuild.dproj (nonexistent)
+++ tags/1.3.2/src/PrepBuild.dproj (revision 68)
@@ -0,0 +1,215 @@
1+ <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+ <PropertyGroup>
3+ <ProjectGuid>{209412ac-0ec2-4f63-b92a-e78853ff142a}</ProjectGuid>
4+ <MainSource>PrepBuild.dpr</MainSource>
5+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+ <DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
7+ <DCC_DependencyCheckOutputName>..\PrepBuild.exe</DCC_DependencyCheckOutputName>
8+ <ProjectVersion>13.4</ProjectVersion>
9+ <Config Condition="'$(Config)'==''">Debug</Config>
10+ <Base>True</Base>
11+ <AppType>Application</AppType>
12+ <FrameworkType>VCL</FrameworkType>
13+ <Platform Condition="'$(Platform)'==''">Win32</Platform>
14+ <TargetedPlatforms>1</TargetedPlatforms>
15+ </PropertyGroup>
16+ <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
17+ <Base>true</Base>
18+ </PropertyGroup>
19+ <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
20+ <Base_Win32>true</Base_Win32>
21+ <CfgParent>Base</CfgParent>
22+ <Base>true</Base>
23+ </PropertyGroup>
24+ <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
25+ <Cfg_1>true</Cfg_1>
26+ <CfgParent>Base</CfgParent>
27+ <Base>true</Base>
28+ </PropertyGroup>
29+ <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
30+ <Cfg_1_Win32>true</Cfg_1_Win32>
31+ <CfgParent>Cfg_1</CfgParent>
32+ <Cfg_1>true</Cfg_1>
33+ <Base>true</Base>
34+ </PropertyGroup>
35+ <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
36+ <Cfg_2>true</Cfg_2>
37+ <CfgParent>Base</CfgParent>
38+ <Base>true</Base>
39+ </PropertyGroup>
40+ <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
41+ <Cfg_2_Win32>true</Cfg_2_Win32>
42+ <CfgParent>Cfg_2</CfgParent>
43+ <Cfg_2>true</Cfg_2>
44+ <Base>true</Base>
45+ </PropertyGroup>
46+ <PropertyGroup Condition="'$(Base)'!=''">
47+ <Manifest_File>None</Manifest_File>
48+ <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
49+ <DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
50+ <VerInfo_Locale>2057</VerInfo_Locale>
51+ <DCC_Define>no_translation;NO_TRANSLATION_HINT;$(DCC_Define)</DCC_Define>
52+ <DCC_ExeOutput>..</DCC_ExeOutput>
53+ <DCC_UNIT_PLATFORM>false</DCC_UNIT_PLATFORM>
54+ <DCC_SYMBOL_PLATFORM>false</DCC_SYMBOL_PLATFORM>
55+ <DCC_DcuOutput>..\$(Config)\$(Platform)\dcu</DCC_DcuOutput>
56+ <DCC_UnitSearchPath>..\libs\dzlib\src;..\libs\dzlib\templates;..\libs\jcl\source\include;..\libs\jcl\source\common;..\libs\jcl\source\windows;..\libs\jcl\source\vcl;..\libs\jcl\source\include\jedi;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
57+ <DCC_DependencyCheckOutputName>PrepBuild.exe</DCC_DependencyCheckOutputName>
58+ </PropertyGroup>
59+ <PropertyGroup Condition="'$(Base_Win32)'!=''">
60+ <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
61+ <PreBuildEvent><![CDATA[..\buildtools\prebuild.cmd $(PROJECTPATH)
62+$(PreBuildEvent)]]></PreBuildEvent>
63+ <DCC_Namespace>System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
64+ <Debugger_RunParams>--incbuild --readini=testdata\testproject --updateini=testdata\testproject --writerc=testdata\testproject</Debugger_RunParams>
65+ <VerInfo_Locale>1033</VerInfo_Locale>
66+ <PostBuildEvent><![CDATA[..\buildtools\postbuild.cmd $(OUTPUTDIR)$(OUTPUTNAME)
67+$(PostBuildEvent)]]></PostBuildEvent>
68+ </PropertyGroup>
69+ <PropertyGroup Condition="'$(Cfg_1)'!=''">
70+ <DCC_ExeOutput>..</DCC_ExeOutput>
71+ <Version>7.0</Version>
72+ <DCC_DebugInformation>False</DCC_DebugInformation>
73+ <DCC_LocalDebugSymbols>False</DCC_LocalDebugSymbols>
74+ <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
75+ <DCC_ObjOutput>dcu</DCC_ObjOutput>
76+ <DCC_HppOutput>dcu</DCC_HppOutput>
77+ <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
78+ </PropertyGroup>
79+ <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
80+ <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
81+ <VerInfo_Locale>1033</VerInfo_Locale>
82+ </PropertyGroup>
83+ <PropertyGroup Condition="'$(Cfg_2)'!=''">
84+ <DCC_DebugDCUs>true</DCC_DebugDCUs>
85+ <DCC_DependencyCheckOutputName>..\PrepBuild.exe</DCC_DependencyCheckOutputName>
86+ <Version>7.0</Version>
87+ <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
88+ <DCC_ExeOutput>..</DCC_ExeOutput>
89+ <DCC_ResourcePath>$(BDS)\lib\Debug;..\libs\dzlib\src;..\libs\dztemplates\templates;..\libs\dztemplates\units;..\libs\dzCmdLineParser\src;..\libs\jcl\source;..\libs\jcl\source\common;..\libs\jcl\source\windows;..\libs\jcl\source\vcl;$(DCC_ResourcePath)</DCC_ResourcePath>
90+ <DCC_ObjPath>$(BDS)\lib\Debug;..\libs\dzlib\src;..\libs\dztemplates\templates;..\libs\dztemplates\units;..\libs\dzCmdLineParser\src;..\libs\jcl\source;..\libs\jcl\source\common;..\libs\jcl\source\windows;..\libs\jcl\source\vcl;$(DCC_ObjPath)</DCC_ObjPath>
91+ <DCC_IncludePath>$(BDS)\lib\Debug;..\libs\dzlib\src;..\libs\dztemplates\templates;..\libs\dztemplates\units;..\libs\dzCmdLineParser\src;..\libs\jcl\source;..\libs\jcl\source\common;..\libs\jcl\source\windows;..\libs\jcl\source\vcl;$(DCC_IncludePath)</DCC_IncludePath>
92+ <DCC_SYMBOL_PLATFORM>False</DCC_SYMBOL_PLATFORM>
93+ <DCC_UNIT_PLATFORM>False</DCC_UNIT_PLATFORM>
94+ <DCC_Optimize>False</DCC_Optimize>
95+ </PropertyGroup>
96+ <PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
97+ <Debugger_RunParams>--ReadDof=testdata\Testproject --IncBuild --updatedof=testdata\Testproject --writerc=testdata\Testproject</Debugger_RunParams>
98+ <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
99+ <VerInfo_Locale>1033</VerInfo_Locale>
100+ </PropertyGroup>
101+ <ProjectExtensions>
102+ <Borland.Personality>Delphi.Personality.12</Borland.Personality>
103+ <Borland.ProjectType/>
104+ <BorlandProject>
105+ <Delphi.Personality>
106+ <Parameters>
107+ <Parameters Name="RunParams">--incbuild --readini=testdata\testproject --updateini=testdata\testproject --writerc=testdata\testproject</Parameters>
108+ </Parameters>
109+ <VersionInfo>
110+ <VersionInfo Name="IncludeVerInfo">False</VersionInfo>
111+ <VersionInfo Name="AutoIncBuild">False</VersionInfo>
112+ <VersionInfo Name="MajorVer">1</VersionInfo>
113+ <VersionInfo Name="MinorVer">0</VersionInfo>
114+ <VersionInfo Name="Release">0</VersionInfo>
115+ <VersionInfo Name="Build">0</VersionInfo>
116+ <VersionInfo Name="Debug">False</VersionInfo>
117+ <VersionInfo Name="PreRelease">False</VersionInfo>
118+ <VersionInfo Name="Special">False</VersionInfo>
119+ <VersionInfo Name="Private">False</VersionInfo>
120+ <VersionInfo Name="DLL">False</VersionInfo>
121+ <VersionInfo Name="Locale">2057</VersionInfo>
122+ <VersionInfo Name="CodePage">1252</VersionInfo>
123+ </VersionInfo>
124+ <Excluded_Packages>
125+ <Excluded_Packages Name="$(BDSBIN)\bcboffice2k160.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
126+ <Excluded_Packages Name="$(BDSBIN)\bcbofficexp160.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages>
127+ <Excluded_Packages Name="$(BDSBIN)\dcloffice2k160.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
128+ <Excluded_Packages Name="$(BDSBIN)\dclofficexp160.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
129+ </Excluded_Packages>
130+ <Source>
131+ <Source Name="MainSource">PrepBuild.dpr</Source>
132+ </Source>
133+ <VersionInfoKeys>
134+ <VersionInfoKeys Name="CompanyName"/>
135+ <VersionInfoKeys Name="FileDescription"/>
136+ <VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
137+ <VersionInfoKeys Name="InternalName"/>
138+ <VersionInfoKeys Name="LegalCopyright"/>
139+ <VersionInfoKeys Name="LegalTrademarks"/>
140+ <VersionInfoKeys Name="OriginalFilename"/>
141+ <VersionInfoKeys Name="ProductName"/>
142+ <VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
143+ <VersionInfoKeys Name="Comments"/>
144+ </VersionInfoKeys>
145+ </Delphi.Personality>
146+ <ModelSupport>False</ModelSupport>
147+ <Platforms>
148+ <Platform value="Win64">False</Platform>
149+ <Platform value="Win32">True</Platform>
150+ </Platforms>
151+ </BorlandProject>
152+ <ProjectFileVersion>12</ProjectFileVersion>
153+ </ProjectExtensions>
154+ <ItemGroup>
155+ <DelphiCompile Include="$(MainSource)">
156+ <MainSource>MainSource</MainSource>
157+ </DelphiCompile>
158+ <DCCReference Include="d_XmlVersionInfo.pas">
159+ <Form>dm_XmlVersionInfo</Form>
160+ <DesignClass>TDataModule</DesignClass>
161+ </DCCReference>
162+ <DCCReference Include="d_DprojVersionInfo.pas">
163+ <Form>dm_DprojVersionInfo</Form>
164+ <DesignClass>TDataModule</DesignClass>
165+ </DCCReference>
166+ <DCCReference Include="d_BdsProjVersionInfo.pas">
167+ <Form>dm_BdsProjVersionInfo</Form>
168+ <DesignClass>TDataModule</DesignClass>
169+ </DCCReference>
170+ <DCCReference Include="d_ManifestVersionInfo.pas">
171+ <Form>dm_ManifestVersionInfo</Form>
172+ <DesignClass>TDataModule</DesignClass>
173+ </DCCReference>
174+ <DCCReference Include="i_VersionInfoAccess.pas"/>
175+ <DCCReference Include="u_DofVersionInfo.pas"/>
176+ <DCCReference Include="u_IniVersionInfo.pas"/>
177+ <DCCReference Include="u_CentralIniVersionInfo.pas"/>
178+ <DCCReference Include="u_PrepBuildMain.pas"/>
179+ <DCCReference Include="u_VersionInfo.pas"/>
180+ <DCCReference Include="..\libs\dzlib\forms\w_dzDialog.pas">
181+ <Form>f_dzDialog</Form>
182+ </DCCReference>
183+ <DCCReference Include="..\libs\dzlib\src\u_dzDefaultMain.pas"/>
184+ <BuildConfiguration Include="Debug">
185+ <Key>Cfg_2</Key>
186+ <CfgParent>Base</CfgParent>
187+ </BuildConfiguration>
188+ <BuildConfiguration Include="Base">
189+ <Key>Base</Key>
190+ </BuildConfiguration>
191+ <BuildConfiguration Include="Release">
192+ <Key>Cfg_1</Key>
193+ <CfgParent>Base</CfgParent>
194+ </BuildConfiguration>
195+ </ItemGroup>
196+ <Import Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')" Project="$(BDS)\Bin\CodeGear.Delphi.Targets"/>
197+ <Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\8.0\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\8.0\UserTools.proj"/>
198+ <Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj"/>
199+ <PropertyGroup Condition="'$(Config)'=='Release' And '$(Platform)'=='Win32'">
200+ <PreBuildEvent>..\buildtools\prebuild.cmd $(PROJECTPATH)</PreBuildEvent>
201+ <PreBuildEventIgnoreExitCode>False</PreBuildEventIgnoreExitCode>
202+ <PreLinkEvent/>
203+ <PreLinkEventIgnoreExitCode>False</PreLinkEventIgnoreExitCode>
204+ <PostBuildEvent>..\buildtools\postbuild.cmd $(OUTPUTDIR)$(OUTPUTNAME)</PostBuildEvent>
205+ <PostBuildEventIgnoreExitCode>False</PostBuildEventIgnoreExitCode>
206+ </PropertyGroup>
207+ <PropertyGroup Condition="'$(Config)'=='Debug' And '$(Platform)'=='Win32'">
208+ <PreBuildEvent>..\buildtools\prebuild.cmd $(PROJECTPATH)</PreBuildEvent>
209+ <PreBuildEventIgnoreExitCode>False</PreBuildEventIgnoreExitCode>
210+ <PreLinkEvent/>
211+ <PreLinkEventIgnoreExitCode>False</PreLinkEventIgnoreExitCode>
212+ <PostBuildEvent>..\buildtools\postbuild.cmd $(OUTPUTDIR)$(OUTPUTNAME)</PostBuildEvent>
213+ <PostBuildEventIgnoreExitCode>False</PostBuildEventIgnoreExitCode>
214+ </PropertyGroup>
215+ </Project>
--- tags/1.3.2/src/PrepBuild.manifest.in (nonexistent)
+++ tags/1.3.2/src/PrepBuild.manifest.in (revision 68)
@@ -0,0 +1,48 @@
1+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+<!--
3+ This manifest tells Windows Vista (and Windows 7/8) not to virtualize any file
4+ or registry access. Also, it disables themes support.
5+ -->
6+ <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
7+ <assemblyIdentity version="1.0.0.0"
8+ processorArchitecture="*"
9+ name="template from dzlib build tools"
10+ type="win32"/>
11+<!-- We do not want themes support
12+ <dependency>
13+ <dependentassembly>
14+ <assemblyidentity type="win32"
15+ name="Microsoft.Windows.Common-Controls"
16+ version="6.0.0.0"
17+ publickeytoken="6595b64144ccf1df"
18+ language="*" processorarchitecture="*">
19+ </assemblyidentity>
20+ </dependentassembly>
21+ <dependency>
22+ -->
23+ <description>This application was built using buildtools from dzlib</description>
24+ <!-- COMPATIBILITY SECTION SPECIFIES IF APP IS COMPLIANT
25+ DISABLES PCA IF SPECIFIED -->
26+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
27+ <application>
28+ <!-- We support Windows Vista -->
29+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
30+ <!-- We support Windows 7 -->
31+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
32+ <!-- We support Windows 8 -->
33+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
34+ </application>
35+ </compatibility>
36+
37+ <!-- TRUSTINFO SECTION SPECIFIES REQUESTED PERMISSIONS AND
38+ UIPI DISABLEMENT (SPECIAL CONDITIONS APPLY TO UIPI DISABLEMENT)-->
39+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
40+ <security>
41+ <requestedPrivileges>
42+ <requestedExecutionLevel
43+ level="asInvoker"
44+ uiAccess="false"/>
45+ </requestedPrivileges>
46+ </security>
47+ </trustInfo>
48+</assembly>
\ No newline at end of file
--- tags/1.3.2/src/PrepBuild_BuildNo.ini (nonexistent)
+++ tags/1.3.2/src/PrepBuild_BuildNo.ini (revision 68)
@@ -0,0 +1,4 @@
1+[Version Info]
2+Build=519
3+FileVersion=1.3.2.519
4+
--- tags/1.3.2/src/PrepBuild_Version.ini (nonexistent)
+++ tags/1.3.2/src/PrepBuild_Version.ini (revision 68)
@@ -0,0 +1,21 @@
1+[Version Info]
2+MajorVer=1
3+MinorVer=3
4+Release=2
5+Build=redirect:PrepBuild_BuildNo.ini,Version Info,Build
6+AutoIncBuild=0
7+Revision=0
8+
9+[Version Info Keys]
10+CompanyName=dummzeuch.de
11+FileDescription=dzlib PrepBuild commandline and IDE prebuild tool
12+FileVersion=redirect:PrepBuild_BuildNo.ini,Version Info,FileVersion
13+InternalName=PrepBuild
14+LegalCopyright=Copyright 2002-{ThisYear} by Thomas Mueller
15+LegalTrademarks=
16+OriginalFilename=PrepBuild.exe
17+ProductName=PrepBuild
18+ProductVersion={today}
19+Comments=<svn range=\"{read:svn_version.ini,SVN,VersionRange}\" modified=\"{read:svn_version.ini,SVN,LocalModifications}\" url=\"{read:svn_version.ini,SVN,url}\" />
20+BuildDateTime={today}
21+
--- tags/1.3.2/src/d_BdsProjVersionInfo.pas (nonexistent)
+++ tags/1.3.2/src/d_BdsProjVersionInfo.pas (revision 68)
@@ -0,0 +1,46 @@
1+unit d_BdsProjVersionInfo;
2+
3+interface
4+
5+uses
6+ Windows,
7+ SysUtils,
8+ Classes,
9+ d_XmlVersionInfo,
10+ xmldom,
11+ XMLIntf,
12+ msxmldom,
13+ XMLDoc;
14+
15+type
16+ Tdm_BdsProjVersionInfo = class(Tdm_XmlVersionInfo)
17+ protected
18+ procedure InitVersionNodes; override;
19+ public
20+ constructor Create(const _Project: string);
21+ end;
22+
23+implementation
24+
25+{$R *.dfm}
26+
27+{ Tdm_BdsProjVersionInfo }
28+
29+constructor Tdm_BdsProjVersionInfo.Create(const _Project: string);
30+begin
31+ inherited Create(ChangeFileExt(_Project, '.bdsproj'));
32+end;
33+
34+procedure Tdm_BdsProjVersionInfo.InitVersionNodes;
35+var
36+ BorlandProject: IXMLNode;
37+ DelphiPersonality: IXMLNode;
38+begin
39+ BorlandProject := ProjDoc.DocumentElement;
40+ DelphiPersonality := BorlandProject.childNodes['Delphi.Personality'];
41+ FVersionInfo := DelphiPersonality.childNodes['VersionInfo'];
42+ FVersionInfoKeys := DelphiPersonality.childNodes['VersionInfoKeys'];
43+end;
44+
45+end.
46+
--- tags/1.3.2/src/d_DProjVersionInfo.pas (nonexistent)
+++ tags/1.3.2/src/d_DProjVersionInfo.pas (revision 68)
@@ -0,0 +1,49 @@
1+unit d_DprojVersionInfo;
2+
3+interface
4+
5+uses
6+ Windows,
7+ SysUtils,
8+ Classes,
9+ d_XmlVersionInfo,
10+ xmldom,
11+ XMLIntf,
12+ msxmldom,
13+ XMLDoc;
14+
15+type
16+ Tdm_DprojVersionInfo = class(Tdm_XmlVersionInfo)
17+ private
18+ protected
19+ procedure InitVersionNodes; override;
20+ public
21+ constructor Create(const _Project: string);
22+ end;
23+
24+implementation
25+
26+{$R *.dfm}
27+
28+constructor Tdm_DprojVersionInfo.Create(const _Project: string);
29+begin
30+ inherited Create(ChangeFileExt(_Project, '.dproj'));
31+end;
32+
33+procedure Tdm_DprojVersionInfo.InitVersionNodes;
34+var
35+ ProjectExtensions: IXMLNode;
36+ DelphiPersonality: IXMLNode;
37+ BorlandProject: IXMLNode;
38+ Project: IXMLNode;
39+begin
40+ Project := ProjDoc.DocumentElement;
41+ ProjectExtensions := Project.ChildNodes['ProjectExtensions'];
42+ BorlandProject := ProjectExtensions.ChildNodes['BorlandProject'];
43+ DelphiPersonality := BorlandProject.ChildNodes['Delphi.Personality'];
44+ FVersionInfo := DelphiPersonality.ChildNodes['VersionInfo'];
45+ FVersionInfoKeys := DelphiPersonality.ChildNodes['VersionInfoKeys'];
46+end;
47+
48+end.
49+
--- tags/1.3.2/src/d_ManifestVersionInfo.pas (nonexistent)
+++ tags/1.3.2/src/d_ManifestVersionInfo.pas (revision 68)
@@ -0,0 +1,158 @@
1+unit d_ManifestVersionInfo;
2+
3+interface
4+
5+uses
6+ Windows,
7+ SysUtils,
8+ Classes,
9+ xmldom,
10+ XMLIntf,
11+ msxmldom,
12+ XMLDoc,
13+ u_VersionInfo,
14+ i_VersionInfoAccess;
15+
16+type
17+ Tdm_ManifestVersionInfo = class(TDataModule, IVersionInfoAccess)
18+ ProjDoc: TXMLDocument;
19+ private
20+ FInputFilename: string;
21+ FOutputFilename: string;
22+ FDescriptionNode: IXMLNode;
23+ protected // IInterface
24+ FRefCount: Integer;
25+ function QueryInterface(const IID: TGUID; out Obj): HResult; override; stdcall;
26+ function _AddRef: Integer; stdcall;
27+ function _Release: Integer; stdcall;
28+ protected // IVersionInfoAccess
29+ function VerInfoFilename: string;
30+ procedure ReadFromFile(_VerInfo: TVersionInfo);
31+ procedure WriteToFile(_VerInfo: TVersionInfo);
32+ protected
33+ FAssemblyIdentityNode: IXMLNode;
34+ procedure InitVersionNodes; virtual;
35+ public
36+ constructor Create(const _ManifestFile: string; const _InputFile: string = ''); reintroduce;
37+ end;
38+
39+implementation
40+
41+{$R *.dfm}
42+
43+uses
44+ StrUtils,
45+ u_dzFileUtils,
46+ u_dzStringUtils,
47+ u_dzVariantUtils,
48+ u_dzConvertUtils,
49+ u_dzTranslator;
50+
51+{ Tdm_ManifestVersionInfo }
52+
53+constructor Tdm_ManifestVersionInfo.Create(const _ManifestFile: string; const _InputFile: string = '');
54+begin
55+ inherited Create(nil);
56+
57+ FOutputFilename := ChangeFileExt(_ManifestFile, '.manifest');
58+ FInputFilename := _InputFile;
59+ if FInputFilename = '' then
60+ FInputFilename := FOutputFilename;
61+
62+ TFileSystem.FileExists(FInputFilename, True);
63+
64+ ProjDoc.FileName := FInputFilename;
65+ ProjDoc.Active := True;
66+
67+ InitVersionNodes;
68+end;
69+
70+//procedure EnumNodes(_Root: IXMLNode; const _Indent: string = '');
71+//var
72+// i: Integer;
73+//begin
74+// WriteLn(_Indent, _Root.NodeName);
75+// for i := 0 to _Root.AttributeNodes.Count - 1 do begin
76+// WriteLn(_Indent, ':', _Root.AttributeNodes[i].NodeName, '=', _Root.AttributeNodes[i].NodeValue);
77+// end;
78+// for i := 0 to _Root.ChildNodes.Count - 1 do begin
79+// EnumNodes(_Root.ChildNodes.Nodes[i], _Indent + ' ');
80+// end;
81+//end;
82+
83+procedure Tdm_ManifestVersionInfo.InitVersionNodes;
84+var
85+ Assembly: IXMLNode;
86+begin
87+ Assembly := ProjDoc.DocumentElement;
88+
89+ FAssemblyIdentityNode := Assembly.ChildNodes['assemblyIdentity'];
90+ FDescriptionNode := Assembly.ChildNodes['description'];
91+end;
92+
93+function Tdm_ManifestVersionInfo.VerInfoFilename: string;
94+begin
95+ Result := FOutputFilename;
96+end;
97+
98+procedure Tdm_ManifestVersionInfo.ReadFromFile(_VerInfo: TVersionInfo);
99+var
100+ Version: string;
101+ Major: string;
102+ Minor: string;
103+ Release: string;
104+ Build: string;
105+begin
106+ raise Exception.Create(_('Reading version info from Manifest files is not supported.'));
107+
108+ _VerInfo.Source := VerInfoFilename;
109+ _VerInfo.InternalName := Var2Str(FAssemblyIdentityNode.Attributes['name'], '');
110+ Version := Var2Str(FAssemblyIdentityNode.Attributes['version'], '');
111+ _VerInfo.FileVersion := Version;
112+ _VerInfo.FileDescription := FDescriptionNode.Text;
113+ Major := ExtractStr(Version, '.');
114+ Minor := ExtractStr(Version, '.');
115+ Release := ExtractStr(Version, '.');
116+ Build := ExtractStr(Version, '.');
117+ _VerInfo.MajorVer := StrToIntDef(Major, 0);
118+ _VerInfo.MinorVer := StrToIntDef(Minor, 0);
119+ _VerInfo.Release := StrToIntDef(Release, 0);
120+ _VerInfo.Build := StrToIntDef(Build, 0);
121+end;
122+
123+procedure Tdm_ManifestVersionInfo.WriteToFile(_VerInfo: TVersionInfo);
124+begin
125+ if _VerInfo.InternalName = '' then
126+ raise Exception.Create(_('InternalName must not be empty because assemblyIdentity.name requires a value'));
127+ if _VerInfo.FileVersion = '' then
128+ raise Exception.Create(_('FileVersion must not be empty because assemblyIdentity.version requires a value'));
129+ FAssemblyIdentityNode.Attributes['name'] := _VerInfo.InternalName;
130+ FAssemblyIdentityNode.Attributes['version'] := _VerInfo.FileVersion;
131+ FDescriptionNode.Text := _VerInfo.FileDescription;
132+ ProjDoc.SaveToFile(FOutputFilename);
133+end;
134+
135+// standard TInterfacedObject implementation of IInterface
136+
137+function Tdm_ManifestVersionInfo.QueryInterface(const IID: TGUID; out Obj): HResult;
138+begin
139+ if GetInterface(IID, Obj) then
140+ Result := S_OK
141+ else
142+ Result := E_NOINTERFACE
143+end;
144+
145+function Tdm_ManifestVersionInfo._AddRef: Integer;
146+begin
147+ Result := InterlockedIncrement(FRefCount);
148+end;
149+
150+function Tdm_ManifestVersionInfo._Release: Integer;
151+begin
152+ Result := InterlockedDecrement(FRefCount);
153+ if Result = 0 then
154+ Destroy;
155+end;
156+
157+end.
158+
--- tags/1.3.2/src/d_XmlVersionInfo.pas (nonexistent)
+++ tags/1.3.2/src/d_XmlVersionInfo.pas (revision 68)
@@ -0,0 +1,217 @@
1+unit d_XmlVersionInfo;
2+
3+interface
4+
5+uses
6+ Windows,
7+ SysUtils,
8+ Classes,
9+ xmldom,
10+ XMLIntf,
11+ msxmldom,
12+ XMLDoc,
13+ u_VersionInfo,
14+ i_VersionInfoAccess;
15+
16+type
17+ Tdm_XmlVersionInfo = class(TDataModule, IVersionInfoAccess)
18+ ProjDoc: TXMLDocument;
19+ private
20+ FProjectFilename: string;
21+ function GetChildNodeContent(_Parent: IXMLNode; const _NodeName, _AttrName: string): string;
22+ function GetVersionInfo(const _Name: string): string;
23+ function GetVersionInfoKey(const _Name: string): string;
24+ procedure SetChildNodeContent(_Parent: IXMLNode; const _NodeName, _AttrName, _Value: string);
25+ procedure SetVersionInfo(const _Name, _Value: string);
26+ procedure SetVersionInfoKey(const _Name, _Value: string);
27+ protected // IInterface
28+ FRefCount: Integer;
29+ function QueryInterface(const IID: TGUID; out Obj): HResult; override; stdcall;
30+ function _AddRef: Integer; stdcall;
31+ function _Release: Integer; stdcall;
32+ protected // implementation of IVersionInfo
33+ function VerInfoFilename: string;
34+ procedure ReadFromFile(_VerInfo: TVersionInfo);
35+ procedure WriteToFile(_VerInfo: TVersionInfo);
36+ protected
37+ FXmlFilename: string;
38+ FVersionInfo: IXMLNode;
39+ FVersionInfoKeys: IXMLNode;
40+ procedure InitVersionNodes; virtual; abstract;
41+ public
42+ constructor Create(const _FullFilename: string); reintroduce;
43+ destructor Destroy; override;
44+ end;
45+
46+implementation
47+
48+{$R *.dfm}
49+
50+uses
51+ StrUtils,
52+ u_dzTranslator;
53+
54+{ Tdm_XmlVersionInfo }
55+
56+function Tdm_XmlVersionInfo.GetChildNodeContent(_Parent: IXMLNode; const _NodeName, _AttrName: string): string;
57+var
58+ Node: IXMLNode;
59+begin
60+ // <VersionInfo Name="IncludeVerInfo">True</VersionInfo>
61+ Node := _Parent.ChildNodes.First;
62+ while Assigned(Node) do begin
63+ if Node.nodeName = _NodeName then begin
64+ if SameText(Node.Attributes['Name'], _AttrName) then begin
65+ Result := Node.Text;
66+ Exit;
67+ end;
68+ end;
69+ Node := Node.nextSibling;
70+ end;
71+end;
72+
73+function Tdm_XmlVersionInfo.GetVersionInfo(const _Name: string): string;
74+begin
75+ Result := GetChildNodeContent(FVersionInfo, 'VersionInfo', _Name);
76+end;
77+
78+function Tdm_XmlVersionInfo.GetVersionInfoKey(const _Name: string): string;
79+begin
80+ Result := GetChildNodeContent(FVersionInfoKeys, 'VersionInfoKeys', _Name);
81+end;
82+
83+procedure Tdm_XmlVersionInfo.SetChildNodeContent(_Parent: IXMLNode; const _NodeName, _AttrName, _Value: string);
84+var
85+ Node: IXMLNode;
86+begin
87+ // <*NodeName* Name="*AttrName*">*Value*</VersionInfo>
88+ Node := _Parent.ChildNodes.First;
89+ while Assigned(Node) do begin
90+ if Node.nodeName = _NodeName then begin
91+ if SameText(Node.Attributes['Name'], _AttrName) then begin
92+ Node.Text := _Value;
93+ Exit;
94+ end;
95+ end;
96+ Node := Node.nextSibling;
97+ end;
98+end;
99+
100+constructor Tdm_XmlVersionInfo.Create(const _FullFilename: string);
101+begin
102+ inherited Create(nil);
103+ FProjectFilename := _FullFilename;
104+ FXmlFilename := VerInfoFilename;
105+ ProjDoc.FileName := FXmlFilename;
106+ ProjDoc.Active := True;
107+
108+ InitVersionNodes;
109+
110+ if not SameText(GetChildNodeContent(FVersionInfo, 'VersionInfo', 'IncludeVerInfo'), 'True') then
111+ raise ENoVersionInfo.Create(_('.dproj file does not contain version information'));
112+end;
113+
114+destructor Tdm_XmlVersionInfo.Destroy;
115+begin
116+ FVersionInfo := nil;
117+ inherited;
118+end;
119+
120+procedure Tdm_XmlVersionInfo.ReadFromFile(_VerInfo: TVersionInfo);
121+begin
122+ _VerInfo.Source := VerInfoFilename;
123+
124+ _VerInfo.AutoIncBuild := SameText(GetVersionInfo('AutoIncBuild'), 'True');
125+
126+ _VerInfo.MajorVer := StrToIntDef(GetVersionInfo('MajorVer'), 0);
127+ _VerInfo.MinorVer := StrToIntDef(GetVersionInfo('MinorVer'), 0);
128+ _VerInfo.Release := StrToIntDef(GetVersionInfo('Release'), 0);
129+ _VerInfo.Build := StrToIntDef(GetVersionInfo('Build'), 0);
130+
131+ _VerInfo.Comments := GetVersionInfoKey('Comments');
132+ _VerInfo.CompanyName := GetVersionInfoKey('CompanyName');
133+ _VerInfo.FileDescription := GetVersionInfoKey('FileDescription');
134+ _VerInfo.FileVersion := GetVersionInfoKey('FileVersion');
135+ _VerInfo.InternalName := GetVersionInfoKey('InternalName');
136+ _VerInfo.LegalCopyRight := GetVersionInfoKey('LegalCopyright');
137+ _VerInfo.LegalTrademarks := GetVersionInfoKey('LegalTrademarks');
138+ _VerInfo.OriginalFilename := GetVersionInfoKey('OriginalFilename');
139+ _VerInfo.ProductName := GetVersionInfoKey('ProductName');
140+ _VerInfo.ProductVersion := GetVersionInfoKey('ProductVersion');
141+ _VerInfo.SCMRevision := GetVersionInfoKey('Revision');
142+ _VerInfo.BuildDateTime := GetVersionInfoKey('BuildDateTime');
143+
144+ _VerInfo.IsPrivateBuild := StrToBool(GetVersionInfo('IsPrivateBuild'));
145+ _VerInfo.IsSpecialBuild := StrToBool(GetVersionInfo('IsSpecialBuild'));
146+ _VerInfo.PrivateBuildComments := GetVersionInfoKey('PrivateBuild');
147+ _VerInfo.SpecialBuildComments := GetVersionInfoKey('SpecialBuild');
148+
149+end;
150+
151+procedure Tdm_XmlVersionInfo.WriteToFile(_VerInfo: TVersionInfo);
152+begin
153+ SetVersionInfo('AutoIncBuild', IfThen(_VerInfo.AutoIncBuild, 'True', 'False'));
154+ SetVersionInfo('Build', IntToStr(_VerInfo.Build));
155+ SetVersionInfoKey('Comments', _VerInfo.Comments);
156+ SetVersionInfoKey('CompanyName', _VerInfo.CompanyName);
157+ SetVersionInfoKey('FileDescription', _VerInfo.FileDescription);
158+ SetVersionInfoKey('FileVersion', _VerInfo.FileVersion);
159+ SetVersionInfoKey('InternalName', _VerInfo.InternalName);
160+ SetVersionInfoKey('LegalCopyright', _VerInfo.LegalCopyRight);
161+ SetVersionInfoKey('LegalTrademarks', _VerInfo.LegalTrademarks);
162+ SetVersionInfo('MajorVer', IntToStr(_VerInfo.MajorVer));
163+ SetVersionInfo('MinorVer', IntToStr(_VerInfo.MinorVer));
164+ SetVersionInfoKey('OriginalFilename', _VerInfo.OriginalFilename);
165+ SetVersionInfoKey('ProductName', _VerInfo.ProductName);
166+ SetVersionInfoKey('ProductVersion', _VerInfo.ProductVersion);
167+ SetVersionInfo('Release', IntToStr(_VerInfo.Release));
168+ SetVersionInfo('Revision', _VerInfo.SCMRevision);
169+ SetVersionInfoKey('BuildDateTime', _VerInfo.BuildDateTime);
170+
171+ SetVersionInfo('IsPrivateBuild', BoolToStr(_VerInfo.IsPrivateBuild, True));
172+ SetVersionInfo('IsSpecialBuild', BoolToStr(_VerInfo.IsSpecialBuild, True));
173+ SetVersionInfoKey('PrivateBuild', _VerInfo.PrivateBuildComments);
174+ SetVersionInfoKey('SpecialBuild', _VerInfo.SpecialBuildComments);
175+
176+ ProjDoc.SaveToFile(FXmlFilename);
177+end;
178+
179+procedure Tdm_XmlVersionInfo.SetVersionInfo(const _Name, _Value: string);
180+begin
181+ SetChildNodeContent(FVersionInfo, 'VersionInfo', _Name, _Value);
182+end;
183+
184+procedure Tdm_XmlVersionInfo.SetVersionInfoKey(const _Name, _Value: string);
185+begin
186+ SetChildNodeContent(FVersionInfoKeys, 'VersionInfoKeys', _Name, _Value);
187+end;
188+
189+function Tdm_XmlVersionInfo.VerInfoFilename: string;
190+begin
191+ Result := FProjectFilename;
192+end;
193+
194+// standard TInterfacedObject implementation of IInterface
195+
196+function Tdm_XmlVersionInfo.QueryInterface(const IID: TGUID; out Obj): HResult;
197+begin
198+ if GetInterface(IID, Obj) then
199+ Result := S_OK
200+ else
201+ Result := E_NOINTERFACE
202+end;
203+
204+function Tdm_XmlVersionInfo._AddRef: Integer;
205+begin
206+ Result := InterlockedIncrement(FRefCount);
207+end;
208+
209+function Tdm_XmlVersionInfo._Release: Integer;
210+begin
211+ Result := InterlockedDecrement(FRefCount);
212+ if Result = 0 then
213+ Destroy;
214+end;
215+
216+end.
217+
--- tags/1.3.2/src/i_VersionInfoAccess.pas (nonexistent)
+++ tags/1.3.2/src/i_VersionInfoAccess.pas (revision 68)
@@ -0,0 +1,22 @@
1+unit i_VersionInfoAccess;
2+
3+interface
4+
5+uses
6+ SysUtils,
7+ u_VersionInfo;
8+
9+type
10+ ENoVersionInfo = class(Exception);
11+
12+type
13+ IVersionInfoAccess = interface ['{57B36255-0A4B-4F62-9007-B4D211C2185D}']
14+ function VerInfoFilename: string;
15+ procedure ReadFromFile(_VerInfo: TVersionInfo);
16+ procedure WriteToFile(_VerInfo: TVersionInfo);
17+ end;
18+
19+implementation
20+
21+end.
22+
--- tags/1.3.2/src/u_CentralIniVersionInfo.pas (nonexistent)
+++ tags/1.3.2/src/u_CentralIniVersionInfo.pas (revision 68)
@@ -0,0 +1,152 @@
1+unit u_CentralIniVersionInfo;
2+
3+interface
4+
5+uses
6+ i_VersionInfoAccess,
7+ u_IniVersionInfo;
8+
9+type
10+ {: This is a specialized descendant of TIniVersionInfo which
11+ allows any entry of the file to redirect to a different file.
12+ This can be done for single entries or for a whole section.
13+ For redirecting a single entry, the value must contain a string
14+ REDIRECT:<filename>,<section><entry>
15+ For redirecting a section it must contain only one entry
16+ redirect=<filename>,<section>
17+ These redirections will be used for reading and writing, that is it can be
18+ used to maintain/increment a central build number for several branches of
19+ a project where the files have different version numbers but the build
20+ number should be increased for a build of any of these versions. }
21+ TCentralIniVersionInfo = class(TIniVersionInfo, IVersionInfoAccess)
22+ private
23+ FProjectName: string;
24+ procedure GetRedirIdentInfo(const _RedirString: string; out _Filename, _Section, _Ident: string);
25+ procedure GetRedirSectionInfo(_Redir: string; out _Filename, _Section: string);
26+ procedure AdjustFilename(var _Filename: string);
27+ protected
28+ function ReadString(const _Section, _Ident: string; _Default: string): string; override;
29+ procedure WriteString(const _Section, _Ident: string; _Value: string); override;
30+ public
31+ {: Creates a TCentralVersionInfo instance
32+ @param ProjectName is the name of the project (.dpr file without extension)
33+ The constructor appends "_Version.ini" to this
34+ name and tries to open the file }
35+ constructor Create(const _ProjectName: string);
36+ end;
37+
38+implementation
39+
40+uses
41+ SysUtils,
42+ IniFiles,
43+ u_dzStringUtils;
44+
45+const
46+ VERSION_INFO_SECTION = 'Version Info';
47+ VERSION_INFO_KEYS_SECTION = 'Version Info Keys';
48+
49+{ TCentralVersionInfo }
50+
51+constructor TCentralIniVersionInfo.Create(const _ProjectName: string);
52+begin
53+ inherited Create(ChangeFileExt(_ProjectName, '_Version.ini'), VERSION_INFO_SECTION, VERSION_INFO_KEYS_SECTION);
54+end;
55+
56+procedure TCentralIniVersionInfo.AdjustFilename(var _Filename: string);
57+var
58+ Path: string;
59+begin
60+ Path := ExtractFilePath(_Filename);
61+ if (Path = '') or ((Path[1] <> '\') and (Copy(Path, 2, 1) <> ':')) then begin
62+ // Path is relative, so make it relative to the main .ini file
63+ _Filename := ExtractFilePath(FProjectName) + _Filename;
64+ end;
65+end;
66+
67+procedure TCentralIniVersionInfo.GetRedirSectionInfo(_Redir: string; out _Filename, _Section: string);
68+begin
69+ _Filename := ExtractStr(_Redir, ',');
70+ _Section := _Redir;
71+ AdjustFilename(_Filename);
72+end;
73+
74+procedure TCentralIniVersionInfo.GetRedirIdentInfo(const _RedirString: string;
75+ out _Filename, _Section, _Ident: string);
76+var
77+ Redir: string;
78+begin
79+ Redir := Copy(_RedirString, Length('redirect:') + 1);
80+ _Filename := ExtractStr(Redir, ',');
81+ _Section := ExtractStr(Redir, ',');
82+ _Ident := Redir;
83+ AdjustFilename(_Filename);
84+end;
85+
86+function TCentralIniVersionInfo.ReadString(const _Section, _Ident: string; _Default: string): string;
87+var
88+ Redir: string;
89+ IniFile: TMemIniFile;
90+ FileName: string;
91+ Section: string;
92+ Ident: string;
93+begin
94+ Redir := FIniFile.ReadString(_Section, 'redirect', '');
95+ if Redir = '' then begin
96+ Result := FIniFile.ReadString(_Section, _Ident, _Default);
97+ if UStartsWith('redirect:', Result) then begin
98+ GetRedirIdentInfo(Result, FileName, Section, Ident);
99+ IniFile := TMemIniFile.Create(FileName);
100+ try
101+ Result := IniFile.ReadString(Section, Ident, _Default);
102+ finally
103+ IniFile.Free;
104+ end;
105+ end;
106+ end else begin
107+ GetRedirSectionInfo(Redir, FileName, Section);
108+ IniFile := TMemIniFile.Create(FileName);
109+ try
110+ Result := IniFile.ReadString(Section, _Ident, _Default);
111+ finally
112+ IniFile.Free;
113+ end;
114+ end;
115+end;
116+
117+procedure TCentralIniVersionInfo.WriteString(const _Section, _Ident: string; _Value: string);
118+var
119+ Redir: string;
120+ IniFile: TMemIniFile;
121+ FileName: string;
122+ Section: string;
123+ Ident: string;
124+begin
125+ Redir := FIniFile.ReadString(_Section, 'redirect', '');
126+ if Redir = '' then begin
127+ Redir := FIniFile.ReadString(_Section, _Ident, '');
128+ if UStartsWith('redirect:', Redir) then begin
129+ GetRedirIdentInfo(Redir, FileName, Section, Ident);
130+ IniFile := TMemIniFile.Create(FileName);
131+ try
132+ IniFile.WriteString(Section, Ident, _Value);
133+ IniFile.UpdateFile;
134+ finally
135+ IniFile.Free;
136+ end;
137+ end else
138+ FIniFile.WriteString(_Section, _Ident, _Value);
139+ end else begin
140+ GetRedirSectionInfo(Redir, FileName, Section);
141+ IniFile := TMemIniFile.Create(FileName);
142+ try
143+ IniFile.WriteString(Section, _Ident, _Value);
144+ IniFile.UpdateFile;
145+ finally
146+ IniFile.Free;
147+ end;
148+ end;
149+end;
150+
151+end.
152+
--- tags/1.3.2/src/u_DofVersionInfo.pas (nonexistent)
+++ tags/1.3.2/src/u_DofVersionInfo.pas (revision 68)
@@ -0,0 +1,53 @@
1+unit u_DofVersionInfo;
2+
3+interface
4+
5+uses
6+ SysUtils,
7+ IniFiles,
8+ i_VersionInfoAccess,
9+ u_VersionInfo,
10+ u_IniVersionInfo;
11+
12+type
13+ {: This is a specialized version of TIniVersionInfo which reads a
14+ <projectname>.dof file, that was used by Delphi up to version 7. }
15+ TDofVersionInfo = class(TIniVersionInfo, IVersionInfoAccess)
16+ private
17+ FProjectName: string;
18+ public
19+ {: Creates a TDofVersionInfo instance. Succeeds, if the file exists
20+ and IncludeVerInfo is <> 0
21+ @param _Projectname is the project name (*.dpr file without extension)
22+ @raises ENoVersionInfo if the file does not exist or
23+ the value of [Version Info] IncludeVerInfo is not 1 }
24+ constructor Create(const _ProjectName: string);
25+ class function FilenameFor(const _ProjectName: string): string;
26+ end;
27+
28+implementation
29+
30+uses
31+ u_dzTranslator;
32+
33+const
34+ VERSION_INFO_SECTION = 'Version Info';
35+ VERSION_INFO_KEYS_SECTION = 'Version Info Keys';
36+
37+{ TDofVersionInfo }
38+
39+constructor TDofVersionInfo.Create(const _ProjectName: string);
40+begin
41+ FProjectName := _ProjectName;
42+ inherited Create(FilenameFor(_ProjectName), VERSION_INFO_SECTION, VERSION_INFO_KEYS_SECTION);
43+ if FIniFile.ReadInteger(VERSION_INFO_SECTION, 'IncludeVerInfo', 0) <> 1 then
44+ raise ENoVersionInfo.Create(_('.dof file does not contain version info'));
45+end;
46+
47+class function TDofVersionInfo.FilenameFor(const _ProjectName: string): string;
48+begin
49+ Result := ChangeFileExt(_ProjectName, '.dof');
50+end;
51+
52+end.
53+
--- tags/1.3.2/src/u_IniVersionInfo.pas (nonexistent)
+++ tags/1.3.2/src/u_IniVersionInfo.pas (revision 68)
@@ -0,0 +1,170 @@
1+unit u_IniVersionInfo;
2+
3+interface
4+
5+uses
6+ SysUtils,
7+ IniFiles,
8+ u_VersionInfo;
9+
10+type
11+ {: Tries to read a <projectname>.ini file, succeeds, if it exists
12+ @param Project is the project name (*.dpr file without extension)
13+ @param VersionInfo is a TVersionInfoRec record which will be filled with the version info }
14+ TIniVersionInfo = class(TInterfacedObject)
15+ protected
16+ FIniFile: TMemIniFile;
17+ FInfoSection: string;
18+ FInfoKeysSection: string;
19+ function ReadInteger(const _Section, _Ident: string; _Default: Integer): Integer; virtual;
20+ procedure WriteInteger(const _Section, _Ident: string; _Value: Integer); virtual;
21+ function ReadString(const _Section, _Ident: string; _Default: string): string; virtual;
22+ procedure WriteString(const _Section, _Ident: string; _Value: string); virtual;
23+ function ReadBool(const _Section, _Ident: string; _Default: Boolean): Boolean; virtual;
24+ procedure WriteBool(const _Section, _Ident: string; _Value: Boolean); virtual;
25+ private
26+ FIniFilename: string;
27+ protected // implement IVersionInfoAccess
28+ function VerInfoFilename: string;
29+ procedure ReadFromFile(_VerInfo: TVersionInfo);
30+ procedure WriteToFile(_VerInfo: TVersionInfo);
31+ public
32+ {: Creates a TIniVersionInfo instance.
33+ @param FullFilename is the full filename including path and extension of
34+ file to use
35+ @param InfoSection is the name of the section that contains the general
36+ version info like Major/Minor version, Release etc.
37+ In a Delphi .dof file this section is called [Version Info]
38+ @param InfoKeySection is the name of the section that contains the additional
39+ strings of the version information
40+ In a Delphi .dof file this section is called [Version Info Keys] }
41+ constructor Create(const _FullFilename: string; const _InfoSection: string;
42+ const _InfoKeysSection: string);
43+ destructor Destroy; override;
44+ end;
45+
46+implementation
47+
48+uses
49+ u_dzTranslator,
50+ i_VersionInfoAccess;
51+
52+{ TIniVersionInfo }
53+
54+constructor TIniVersionInfo.Create(const _FullFilename: string; const _InfoSection: string;
55+ const _InfoKeysSection: string);
56+begin
57+ inherited Create;
58+ FIniFilename := _FullFilename;
59+ if not FileExists(_FullFilename) then
60+ raise ENoVersionInfo.CreateFmt(_('File "%s" does not exist.'), [_FullFilename]);
61+ FInfoSection := _InfoSection;
62+ FInfoKeysSection := _InfoKeysSection;
63+ FIniFile := TMemIniFile.Create(_FullFilename);
64+end;
65+
66+destructor TIniVersionInfo.Destroy;
67+begin
68+ FIniFile.Free;
69+ inherited;
70+end;
71+
72+function TIniVersionInfo.ReadBool(const _Section, _Ident: string; _Default: Boolean): Boolean;
73+begin
74+ Result := 0 <> ReadInteger(_Section, _Ident, Ord(_Default));
75+end;
76+
77+function TIniVersionInfo.ReadInteger(const _Section, _Ident: string; _Default: Integer): Integer;
78+var
79+ s: string;
80+begin
81+ s := ReadString(_Section, _Ident, IntToStr(_Default));
82+ if not TryStrToInt(s, Result) then
83+ Result := _Default;
84+end;
85+
86+function TIniVersionInfo.ReadString(const _Section, _Ident: string; _Default: string): string;
87+begin
88+ Result := FIniFile.ReadString(_Section, _Ident, _Default);
89+end;
90+
91+function TIniVersionInfo.VerInfoFilename: string;
92+begin
93+ Result := FIniFilename;
94+end;
95+
96+procedure TIniVersionInfo.WriteBool(const _Section, _Ident: string; _Value: Boolean);
97+begin
98+ WriteInteger(_Section, _Ident, Ord(_Value));
99+end;
100+
101+procedure TIniVersionInfo.WriteInteger(const _Section, _Ident: string; _Value: Integer);
102+begin
103+ WriteString(_Section, _Ident, IntToStr(_Value));
104+end;
105+
106+procedure TIniVersionInfo.WriteString(const _Section, _Ident: string; _Value: string);
107+begin
108+ FIniFile.WriteString(_Section, _Ident, _Value);
109+end;
110+
111+procedure TIniVersionInfo.ReadFromFile(_VerInfo: TVersionInfo);
112+begin
113+ _VerInfo.Source := VerInfoFilename;
114+
115+ _VerInfo.AutoIncBuild := ReadBool(FInfoSection, 'AutoIncBuild', False);
116+
117+ _VerInfo.Build := ReadInteger(FInfoSection, 'Build', 0);
118+ _VerInfo.MajorVer := ReadInteger(FInfoSection, 'MajorVer', 0);
119+ _VerInfo.MinorVer := ReadInteger(FInfoSection, 'MinorVer', 0);
120+ _VerInfo.Release := ReadInteger(FInfoSection, 'Release', 0);
121+
122+ _VerInfo.Comments := ReadString(FInfoKeysSection, 'Comments', '');
123+ _VerInfo.CompanyName := ReadString(FInfoKeysSection, 'CompanyName', '');
124+ _VerInfo.FileDescription := ReadString(FInfoKeysSection, 'FileDescription', '');
125+ _VerInfo.FileVersion := ReadString(FInfoKeysSection, 'FileVersion', '');
126+ _VerInfo.InternalName := ReadString(FInfoKeysSection, 'InternalName', '');
127+ _VerInfo.LegalCopyRight := ReadString(FInfoKeysSection, 'LegalCopyright', '');
128+ _VerInfo.LegalTrademarks := ReadString(FInfoKeysSection, 'LegalTrademarks', '');
129+ _VerInfo.OriginalFilename := ReadString(FInfoKeysSection, 'OriginalFilename', '');
130+ _VerInfo.ProductName := ReadString(FInfoKeysSection, 'ProductName', '');
131+ _VerInfo.ProductVersion := ReadString(FInfoKeysSection, 'ProductVersion', '');
132+ _VerInfo.SCMRevision := ReadString(FInfoKeysSection, 'Revision', '');
133+ _VerInfo.BuildDateTime := ReadString(FInfoKeysSection, 'BuildDateTime', '');
134+
135+ _VerInfo.IsPrivateBuild := ReadBool(FInfoSection, 'IsPrivateBuild', False);
136+ _VerInfo.IsSpecialBuild := ReadBool(FInfoSection, 'IsSpecialBuild', False);
137+ _VerInfo.PrivateBuildComments := ReadString(FInfoKeysSection, 'PrivateBuild', '');
138+ _VerInfo.SpecialBuildComments := ReadString(FInfoKeysSection, 'SpecialBuild', '');
139+end;
140+
141+procedure TIniVersionInfo.WriteToFile(_VerInfo: TVersionInfo);
142+begin
143+ WriteBool(FInfoSection, 'AutoIncBuild', _VerInfo.AutoIncBuild);
144+ WriteInteger(FInfoSection, 'Build', _VerInfo.Build);
145+ WriteString(FInfoKeysSection, 'Comments', _VerInfo.Comments);
146+ WriteString(FInfoKeysSection, 'CompanyName', _VerInfo.CompanyName);
147+ WriteString(FInfoKeysSection, 'FileDescription', _VerInfo.FileDescription);
148+ WriteString(FInfoKeysSection, 'FileVersion', _VerInfo.FileVersion);
149+ WriteString(FInfoKeysSection, 'InternalName', _VerInfo.InternalName);
150+ WriteString(FInfoKeysSection, 'LegalCopyright', _VerInfo.LegalCopyRight);
151+ WriteString(FInfoKeysSection, 'LegalTrademarks', _VerInfo.LegalTrademarks);
152+ WriteInteger(FInfoSection, 'MajorVer', _VerInfo.MajorVer);
153+ WriteInteger(FInfoSection, 'MinorVer', _VerInfo.MinorVer);
154+ WriteString(FInfoKeysSection, 'OriginalFilename', _VerInfo.OriginalFilename);
155+ WriteString(FInfoKeysSection, 'ProductName', _VerInfo.ProductName);
156+ WriteString(FInfoKeysSection, 'ProductVersion', _VerInfo.ProductVersion);
157+ WriteInteger(FInfoSection, 'Release', _VerInfo.Release);
158+ WriteString(FInfoSection, 'Revision', _VerInfo.SCMRevision);
159+ WriteString(FInfoKeysSection, 'BuildDateTime', _VerInfo.BuildDateTime);
160+
161+ WriteBool(FInfoSection, 'IsPrivateBuild', _VerInfo.IsPrivateBuild);
162+ WriteBool(FInfoSection, 'IsSpecialBuild', _VerInfo.IsSpecialBuild);
163+ WriteString(FInfoKeysSection, 'PrivateBuild', _VerInfo.PrivateBuildComments);
164+ WriteString(FInfoKeysSection, 'SpecialBuild', _VerInfo.SpecialBuildComments);
165+
166+ FIniFile.UpdateFile;
167+end;
168+
169+end.
170+
--- tags/1.3.2/src/u_PrepBuildMain.pas (nonexistent)
+++ tags/1.3.2/src/u_PrepBuildMain.pas (revision 68)
@@ -0,0 +1,564 @@
1+unit u_PrepBuildMain;
2+
3+interface
4+
5+uses
6+ Windows,
7+ SysUtils,
8+ StrUtils,
9+ u_dzDefaultMain,
10+ u_dzGetOpt,
11+ u_VersionInfo,
12+ i_VersionInfoAccess;
13+
14+type
15+ TPrepBuildMain = class(TDefaultMain)
16+ private
17+ function HandleExecOption(const _Command: string; _VersionInfo: TVersionInfo; const _Project: string): Integer;
18+ procedure WriteRcFile(const _Project: string; _VersionInfo: TVersionInfo; const _Icon: string);
19+ procedure DumpCmd;
20+ procedure WriteMainfestRcFile(const _Project: string; const _ManifestFile: string);
21+ function FileMaskOptionsToStr(const _IsPrivateBuild, _IsSpecialBuild: Boolean): string;
22+ protected
23+ procedure InitCmdLineParser; override;
24+ function doExecute: Integer; override;
25+ public
26+
27+ end;
28+
29+implementation
30+
31+uses
32+ Dialogs,
33+ u_dzTranslator,
34+ u_dzExecutor,
35+ u_dzJclUtils,
36+ u_dzShellApiUtils,
37+ u_DofVersionInfo,
38+ d_BdsProjVersionInfo,
39+ u_CentralIniVersionInfo,
40+ d_DProjVersionInfo,
41+ d_ManifestVersionInfo;
42+
43+{ TPrepBuildMain }
44+
45+function DateTimeToString(const _Format: string; _dt: TDateTime): string;
46+begin
47+ SysUtils.DateTimeToString(Result, _Format, _dt);
48+end;
49+
50+function TPrepBuildMain.FileMaskOptionsToStr(const _IsPrivateBuild, _IsSpecialBuild: Boolean): string;
51+
52+ procedure AddParam(var _Output: string; const _Param: string);
53+ begin
54+ if (_Output <> '') then begin
55+ _Output := _Output + '|';
56+ end;
57+ _Output := _Output + _Param;
58+ end;
59+
60+begin
61+ Result := '';
62+
63+ if _IsPrivateBuild then begin
64+ AddParam(Result, 'VS_FF_PRIVATEBUILD');
65+ end;
66+
67+ if _IsSpecialBuild then begin
68+ AddParam(Result, 'VS_FF_SPECIALBUILD');
69+ end;
70+
71+ if (Result = '') then begin
72+ Result := '0';
73+ end;
74+end;
75+
76+procedure TPrepBuildMain.WriteRcFile(const _Project: string; _VersionInfo: TVersionInfo; const _Icon: string);
77+var
78+ fn: string;
79+ FileFlags: string;
80+ CommentText: string;
81+ t: TextFile;
82+begin
83+ fn := ChangeFileExt(_Project, '_Version.rc');
84+ WriteLn('Writing rc file ', fn);
85+ Assignfile(t, fn);
86+ Rewrite(t);
87+ try
88+ FileFlags := FileMaskOptionsToStr(_VersionInfo.IsPrivateBuild, _VersionInfo.IsSpecialBuild);
89+ WriteLn(t, { } 'LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US');
90+ WriteLn(t);
91+ WriteLn(t, { } '1 VERSIONINFO LOADONCALL MOVEABLE DISCARDABLE IMPURE');
92+ WriteLn(t, Format('FILEVERSION %d, %d, %d, %d', [_VersionInfo.MajorVer, _VersionInfo.MinorVer, _VersionInfo.Release, _VersionInfo.Build]));
93+ WriteLn(t, Format('PRODUCTVERSION %d, %d, %d, %d',
94+ [_VersionInfo.MajorVer, _VersionInfo.MinorVer, _VersionInfo.Release, _VersionInfo.Build]));
95+ WriteLn(t, { } 'FILEFLAGSMASK VS_FFI_FILEFLAGSMASK');
96+ if FileFlags <> '0' then begin
97+ WriteLn(t, Format('FILEFLAGS %s', [FileFlags]));
98+ end;
99+ WriteLn(t, { } 'FILEOS VOS__WINDOWS32');
100+ WriteLn(t, { } 'FILETYPE VFT_APP');
101+ WriteLn(t, { } '{');
102+ WriteLn(t, { } ' BLOCK "StringFileInfo"');
103+ WriteLn(t, { } ' {');
104+ WriteLn(t, { } ' BLOCK "040904E4"');
105+ WriteLn(t, { } ' {');
106+ WriteLn(t, Format(' VALUE "CompanyName", "%s\000"', [_VersionInfo.ResolveVariables(_VersionInfo.CompanyName)]));
107+ WriteLn(t, Format(' VALUE "FileDescription", "%s\000"', [_VersionInfo.ResolveVariables(_VersionInfo.FileDescription)]));
108+ WriteLn(t, Format(' VALUE "FileVersion", "%s\000"', [_VersionInfo.ResolveVariables(_VersionInfo.FileVersion)]));
109+ WriteLn(t, Format(' VALUE "InternalName", "%s\000"', [_VersionInfo.ResolveVariables(_VersionInfo.InternalName)]));
110+ WriteLn(t, Format(' VALUE "LegalCopyright", "%s\000"', [_VersionInfo.ResolveVariables(_VersionInfo.LegalCopyRight)]));
111+ WriteLn(t, Format(' VALUE "LegalTrademarks", "%s\000"', [_VersionInfo.ResolveVariables(_VersionInfo.LegalTrademarks)]));
112+ WriteLn(t, Format(' VALUE "OriginalFilename", "%s\000"', [_VersionInfo.ResolveVariables(_VersionInfo.OriginalFilename)]));
113+ WriteLn(t, Format(' VALUE "ProductName", "%s\000"', [_VersionInfo.ResolveVariables(_VersionInfo.ProductName)]));
114+ WriteLn(t, Format(' VALUE "ProductVersion", "%s\000"', [_VersionInfo.ResolveVariables(_VersionInfo.ProductVersion)]));
115+ WriteLn(t, Format(' VALUE "Comments", "%s\000"', [_VersionInfo.ResolveVariables(_VersionInfo.Comments)]));
116+ WriteLn(t, Format(' VALUE "Revision", "%s\000"', [_VersionInfo.ResolveVariables(_VersionInfo.SCMRevision)]));
117+ WriteLn(t, Format(' VALUE "BuildDateTime", "%s\000"', [_VersionInfo.ResolveVariables(_VersionInfo.BuildDateTime)]));
118+ CommentText := _VersionInfo.ResolveVariables(_VersionInfo.PrivateBuildComments);
119+ if _VersionInfo.IsPrivateBuild or (CommentText <> '') then begin
120+ WriteLn(t, Format(' VALUE "PrivateBuild", "%s\000"', [CommentText]));
121+ end;
122+ CommentText := _VersionInfo.ResolveVariables(_VersionInfo.SpecialBuildComments);
123+ if _VersionInfo.IsSpecialBuild or (CommentText <> '') then begin
124+ WriteLn(t, Format(' VALUE "SpecialBuild", "%s\000"', [CommentText]));
125+ end;
126+ WriteLn(t, { } ' }');
127+ WriteLn(t, { } ' }');
128+ WriteLn(t, { } ' BLOCK "VarFileInfo"');
129+ WriteLn(t, { } ' {');
130+ WriteLn(t, { } ' VALUE "Translation", 1033, 1252');
131+ WriteLn(t, { } ' }');
132+ WriteLn(t, { } '}');
133+ if _Icon <> '' then begin
134+ WriteLn(t);
135+ WriteLn(t, Format('MAINICON ICON LOADONCALL MOVEABLE DISCARDABLE IMPURE "%s"', [ChangeFileExt(_Icon, '.ico')]));
136+ end;
137+ finally
138+ Close(t);
139+ end;
140+end;
141+
142+procedure TPrepBuildMain.WriteMainfestRcFile(const _Project: string; const _ManifestFile: string);
143+var
144+ fn: string;
145+ t: TextFile;
146+begin
147+ fn := ChangeFileExt(_Project, '_Manifest.rc');
148+ WriteLn('Writing mainfest rc file ', fn);
149+ Assignfile(t, fn);
150+ Rewrite(t);
151+ try
152+ WriteLn(t, '#define MANIFEST_RESOURCE_ID 1');
153+ WriteLn(t, '#define RT_MANIFEST 24');
154+ WriteLn(t, Format('MANIFEST_RESOURCE_ID RT_MANIFEST "%s"', [ChangeFileExt(_ManifestFile, '.manifest')]));
155+ finally
156+ Close(t);
157+ end;
158+end;
159+
160+function TPrepBuildMain.HandleExecOption(const _Command: string; _VersionInfo: TVersionInfo; const _Project: string): Integer;
161+const
162+ DZ_MY_DOCUMENTS = 'dzMyDocuments';
163+ DZ_DATE = 'dzDate';
164+ DZ_TIME = 'dzTime';
165+ DZ_DATE_TIME = 'dzDateTime';
166+ DZ_VERSION = 'dzVersion.';
167+ DZ_PROJECT = 'dzProject';
168+ DZ_PREPBUILD = 'dzPrepBuild';
169+var
170+ MyDoc: string;
171+ Executor: TExecutor;
172+ dt: TDateTime;
173+begin
174+ MyDoc := TWindowsShell.GetMyDocumentsDir();
175+ Executor := TExecutor.Create;
176+ try
177+ Executor.ExeName := GetEnvironmentVariable('ComSpec');
178+ Executor.Commandline := '/c ' + _Command;
179+ Executor.Environment.Values[DZ_MY_DOCUMENTS] := MyDoc;
180+
181+ dt := Now;
182+ Executor.Environment.Values[DZ_DATE] := DateTimeToString('yyyy-mm-dd', dt);
183+ Executor.Environment.Values[DZ_TIME] := DateTimeToString('hh-nn-ss', dt);
184+ Executor.Environment.Values[DZ_DATE_TIME] := DateTimeToString('yyyy-mm-dd_hh-nn-ss', dt);
185+ Executor.Environment.Values[DZ_PREPBUILD] := ExeName;
186+
187+ if _Project <> '' then
188+ Executor.Environment.Values[DZ_PROJECT] := ChangeFileExt(_Project, '');
189+
190+ if Assigned(_VersionInfo) then begin
191+ Executor.Environment.Values[DZ_VERSION + 'MajorVer'] := IntToStr(_VersionInfo.MajorVer);
192+ Executor.Environment.Values[DZ_VERSION + 'MinorVer'] := IntToStr(_VersionInfo.MinorVer);
193+ Executor.Environment.Values[DZ_VERSION + 'Release'] := IntToStr(_VersionInfo.Release);
194+ Executor.Environment.Values[DZ_VERSION + 'Build'] := IntToStr(_VersionInfo.Build);
195+ Executor.Environment.Values[DZ_VERSION + 'FileDesc'] := _VersionInfo.FileDescription;
196+ Executor.Environment.Values[DZ_VERSION + 'InternalName'] := _VersionInfo.InternalName;
197+ Executor.Environment.Values[DZ_VERSION + 'OriginalName'] := _VersionInfo.OriginalFilename;
198+ Executor.Environment.Values[DZ_VERSION + 'Product'] := _VersionInfo.ProductName;
199+ Executor.Environment.Values[DZ_VERSION + 'ProductVersion'] := _VersionInfo.ProductVersion;
200+ Executor.Environment.Values[DZ_VERSION + 'Company'] := _VersionInfo.CompanyName;
201+ Executor.Environment.Values[DZ_VERSION + 'Copyright'] := _VersionInfo.LegalCopyRight;
202+ Executor.Environment.Values[DZ_VERSION + 'Trademark'] := _VersionInfo.LegalTrademarks;
203+ Executor.Environment.Values[DZ_VERSION + 'Comments'] := _VersionInfo.Comments;
204+ Executor.Environment.Values[DZ_VERSION + 'Revision'] := _VersionInfo.SCMRevision;
205+ Executor.Environment.Values[DZ_VERSION + 'BuildDateTime'] := _VersionInfo.BuildDateTime;
206+ Executor.Environment.Values[DZ_VERSION + 'IsPrivateBuild'] := BoolToStr(_VersionInfo.IsPrivateBuild, True);
207+ Executor.Environment.Values[DZ_VERSION + 'IsSpecialBuild'] := BoolToStr(_VersionInfo.IsSpecialBuild, True);
208+ Executor.Environment.Values[DZ_VERSION + 'PrivateBuild'] := _VersionInfo.PrivateBuildComments;
209+ Executor.Environment.Values[DZ_VERSION + 'SpecialBuild'] := _VersionInfo.SpecialBuildComments;
210+ end;
211+
212+ Executor.doExecute;
213+ Executor.Wait(INFINITE);
214+ Result := Executor.ExitCode;
215+ finally
216+ Executor.Free;
217+ end;
218+end;
219+
220+procedure TPrepBuildMain.DumpCmd;
221+var
222+ i: Integer;
223+ s: string;
224+begin
225+ s := GetCurrentDir + #13#10 + ParamStr(0) + #13#10;
226+ for i := 0 to FGetOpt.OptionsFoundList.Count - 1 do begin
227+ s := s + FGetOpt.OptionsFoundList.Items[i].Name + '=' + FGetOpt.OptionsFoundList.Items[i].Value + #13#10;
228+ end;
229+ MessageDlg(s, mtInformation, [mbOK], 0);
230+ SysUtils.Abort;
231+end;
232+
233+function UnquoteStr(const _s: string): string;
234+begin
235+ Result := AnsiDequotedStr(_s, '"');
236+end;
237+
238+function TPrepBuildMain.doExecute: Integer;
239+var
240+ Param: string;
241+ VerInfoAccess: IVersionInfoAccess;
242+ VersionInfo: TVersionInfo;
243+ IntValue: Integer;
244+ IconFile: string;
245+ Project: string;
246+ InputManifest: string;
247+ Manifest: string;
248+ IgnoreManifestErrors: Boolean;
249+ s: string;
250+begin
251+ try
252+ WriteLn('dzPrepBuild version ' + TApplication_GetFileVersion + ' built ' + TApplication_GetProductVersion);
253+
254+ if FGetOpt.OptionsFoundList.Count = 0 then
255+ Usage(_('You must supply some options.'));
256+
257+ if FGetOpt.OptionPassed('dumpcmd') then
258+ DumpCmd;
259+
260+ Project := '';
261+ if FGetOpt.OptionPassed('ReadDof', Project) then begin
262+ Project := UnquoteStr(Project);
263+ VerInfoAccess := TDofVersionInfo.Create(Project);
264+ end;
265+
266+ if FGetOpt.OptionPassed('ReadBdsProj', Project) then begin
267+ if Assigned(VerInfoAccess) then
268+ raise Exception.Create(_('You can only pass one of --ReadDof, --ReadBdsproj, --ReadDproj or --ReadIni'));
269+ Project := UnquoteStr(Project);
270+ VerInfoAccess := Tdm_BdsProjVersionInfo.Create(Project);
271+ end;
272+
273+ if FGetOpt.OptionPassed('ReadIni', Project) then begin
274+ if Assigned(VerInfoAccess) then
275+ raise Exception.Create(_('You can only pass one of --ReadDof, --ReadBdsproj, --ReadDproj or --ReadIni'));
276+ Project := UnquoteStr(Project);
277+ VerInfoAccess := TCentralIniVersionInfo.Create(Project);
278+ end;
279+
280+ if FGetOpt.OptionPassed('ReadDproj', Project) then begin
281+ if Assigned(VerInfoAccess) then
282+ raise Exception.Create(_('You can only pass one of --ReadDof, --ReadBdsproj, --ReadDproj or --ReadIni'));
283+ Project := UnquoteStr(Project);
284+ VerInfoAccess := Tdm_DProjVersionInfo.Create(Project);
285+ end;
286+
287+ VersionInfo := TVersionInfo.Create;
288+ try
289+ if Assigned(VerInfoAccess) then begin
290+ WriteLn('Reading ' + VerInfoAccess.VerInfoFilename);
291+ VerInfoAccess.ReadFromFile(VersionInfo);
292+ VerInfoAccess := nil;
293+ end;
294+
295+ if FGetOpt.OptionPassed('MajorVer', Param) then begin
296+ if not TryStrToInt(Param, IntValue) then
297+ raise Exception.Create(_('Parameter for MajorVer must be a number'));
298+ WriteLn('Setting MajorVer to ', IntValue);
299+ VersionInfo.MajorVer := IntValue;
300+ end;
301+
302+ if FGetOpt.OptionPassed('MinorVer', Param) then begin
303+ if not TryStrToInt(Param, IntValue) then
304+ raise Exception.Create(_('Parameter for MinorVer must be a number'));
305+ WriteLn('Setting MinorVer to ', IntValue);
306+ VersionInfo.MinorVer := IntValue;
307+ end;
308+
309+ if FGetOpt.OptionPassed('Release', Param) then begin
310+ if not TryStrToInt(Param, IntValue) then
311+ raise Exception.Create(_('Parameter for Release must be a number'));
312+ WriteLn('Setting Release to ', IntValue);
313+ VersionInfo.Release := IntValue;
314+ end;
315+
316+ if FGetOpt.OptionPassed('Build', Param) then begin
317+ if not TryStrToInt(Param, IntValue) then
318+ raise Exception.Create(_('Parameter for Build must be a number'));
319+ WriteLn('Setting Build to ', IntValue);
320+ VersionInfo.Build := IntValue;
321+ end;
322+
323+ if FGetOpt.OptionPassed('FileDesc', Param) then begin
324+ VersionInfo.FileDescription := UnquoteStr(Param);
325+ WriteLn('Setting FileDescription to ', VersionInfo.FileDescription);
326+ end;
327+
328+ if FGetOpt.OptionPassed('InternalName', Param) then begin
329+ VersionInfo.InternalName := UnquoteStr(Param);
330+ WriteLn('Setting InternalName to ', VersionInfo.InternalName);
331+ end;
332+
333+ if FGetOpt.OptionPassed('OriginalName', Param) then begin
334+ VersionInfo.OriginalFilename := UnquoteStr(Param);
335+ WriteLn('Setting OriginalFilename to ', VersionInfo.OriginalFilename);
336+ end;
337+
338+ if FGetOpt.OptionPassed('Product', Param) then begin
339+ VersionInfo.ProductName := UnquoteStr(Param);
340+ WriteLn('Setting ProductName to ', VersionInfo.ProductName);
341+ end;
342+
343+ if FGetOpt.OptionPassed('ProductVersion', Param) then begin
344+ VersionInfo.ProductVersion := UnquoteStr(Param);
345+ WriteLn('Setting ProductVersion to ', VersionInfo.ProductVersion);
346+ end;
347+
348+ if FGetOpt.OptionPassed('Company', Param) then begin
349+ VersionInfo.CompanyName := UnquoteStr(Param);
350+ WriteLn('Setting CompanyName to ', VersionInfo.CompanyName);
351+ end;
352+
353+ if FGetOpt.OptionPassed('Copyright', Param) then begin
354+ VersionInfo.LegalCopyRight := UnquoteStr(Param);
355+ WriteLn('Setting LegalCopyright to ', VersionInfo.LegalCopyRight);
356+ end;
357+
358+ if FGetOpt.OptionPassed('Trademark', Param) then begin
359+ VersionInfo.LegalTrademarks := UnquoteStr(Param);
360+ WriteLn('Setting LegalTrademarks to ', VersionInfo.LegalTrademarks);
361+ end;
362+
363+ if FGetOpt.OptionPassed('Comments', Param) then begin
364+ VersionInfo.Comments := UnquoteStr(Param);
365+ WriteLn('Setting Comments to ', VersionInfo.Comments);
366+ end;
367+
368+ if FGetOpt.OptionPassed('SvnRevision', Param) then begin
369+ //*** add a svn revision as integer ("0" if not a number)
370+ VersionInfo.SCMRevision := IntToStr(StrToIntDef(UnquoteStr(Param), 0));
371+ WriteLn('Setting SCMRevision to ', VersionInfo.SCMRevision);
372+ end;
373+
374+ if FGetOpt.OptionPassed('GitRevision', Param) then begin
375+ //*** gitRevision overwrites the svn revision
376+ VersionInfo.SCMRevision := UnquoteStr(Param);
377+ WriteLn('Setting SCMRevision to ', VersionInfo.SCMRevision);
378+ end;
379+
380+ if FGetOpt.OptionPassed('BuildDateTime', Param) then begin
381+ VersionInfo.BuildDateTime := UnquoteStr(Param);
382+ WriteLn('Setting BuildDateTime to ', VersionInfo.BuildDateTime);
383+ end;
384+
385+ if FGetOpt.OptionPassed('IsPrivateBuild', Param) then begin
386+ VersionInfo.IsPrivateBuild := StrToBool(UnquoteStr(Param));
387+ WriteLn('Setting IsPrivateBuild to ', VersionInfo.IsPrivateBuild);
388+ end;
389+
390+ if FGetOpt.OptionPassed('IsSpecialBuild', Param) then begin
391+ VersionInfo.IsSpecialBuild := StrToBool(UnquoteStr(Param));
392+ WriteLn('Setting IsSpecialBuild to ', VersionInfo.IsSpecialBuild);
393+ end;
394+
395+ if FGetOpt.OptionPassed('PrivateBuild', Param) then begin
396+ VersionInfo.PrivateBuildComments := UnquoteStr(Param);
397+ WriteLn('Setting PrivateBuildComments to ', VersionInfo.PrivateBuildComments);
398+ end;
399+
400+ if FGetOpt.OptionPassed('SpecialBuild', Param) then begin
401+ VersionInfo.SpecialBuildComments := UnquoteStr(Param);
402+ WriteLn('Setting SpecialBuildComments to ', VersionInfo.SpecialBuildComments);
403+ end;
404+
405+ if FGetOpt.OptionPassed('IncBuild') then begin
406+ VersionInfo.Build := VersionInfo.Build + 1;
407+ WriteLn('Incrementing build number to ', VersionInfo.Build);
408+ end;
409+
410+ VersionInfo.UpdateFileVersion;
411+ WriteLn('FileVersion is now ', VersionInfo.FileVersion);
412+
413+ if FGetOpt.OptionPassed('UpdateDof', Param) then begin
414+ VerInfoAccess := TDofVersionInfo.Create(Param);
415+ WriteLn('Updating ', VerInfoAccess.VerInfoFilename);
416+ VerInfoAccess.WriteToFile(VersionInfo);
417+ end;
418+
419+ if FGetOpt.OptionPassed('UpdateBdsproj', Param) then begin
420+ VerInfoAccess := Tdm_BdsProjVersionInfo.Create(Param);
421+ WriteLn('Updating ', VerInfoAccess.VerInfoFilename);
422+ VerInfoAccess.WriteToFile(VersionInfo);
423+ end;
424+
425+ if FGetOpt.OptionPassed('UpdateIni', Param) then begin
426+ VerInfoAccess := TCentralIniVersionInfo.Create(Param);
427+ WriteLn('Updating ', VerInfoAccess.VerInfoFilename);
428+ VerInfoAccess.WriteToFile(VersionInfo);
429+ end;
430+
431+ if FGetOpt.OptionPassed('UpdateDproj', Param) then begin
432+ VerInfoAccess := Tdm_DProjVersionInfo.Create(Param);
433+ WriteLn('Updating ', VerInfoAccess.VerInfoFilename);
434+ VerInfoAccess.WriteToFile(VersionInfo);
435+ end;
436+
437+ if FGetOpt.OptionPassed('InputManifest', Param) then begin
438+ InputManifest := UnquoteStr(Param);
439+ end else
440+ InputManifest := '';
441+
442+ if FGetOpt.OptionPassed('Manifest', Param) then begin
443+ Manifest := Param;
444+ end else
445+ Manifest := '';
446+
447+ if FGetOpt.OptionPassed('IgnoreManifestErrors') then
448+ IgnoreManifestErrors := True
449+ else
450+ IgnoreManifestErrors := False;
451+
452+ if FGetOpt.OptionPassed('UpdateManifest') then begin
453+ try
454+ if InputManifest <> '' then
455+ WriteLn('Reading manifest from ', InputManifest);
456+ VerInfoAccess := Tdm_ManifestVersionInfo.Create(Manifest, InputManifest);
457+ WriteLn('Updating ', VerInfoAccess.VerInfoFilename);
458+ VerInfoAccess.WriteToFile(VersionInfo);
459+ except
460+ on e: Exception do begin
461+ if IgnoreManifestErrors then
462+ WriteLn('Warning: Ignoring manifest error: ', e.Message, '(', e.ClassName, ')')
463+ else
464+ raise;
465+ end;
466+ end;
467+ end;
468+
469+ if FGetOpt.OptionPassed('WriteManifestRc', Param) then begin
470+ WriteMainfestRcFile(Param, Manifest);
471+ end;
472+
473+ if FGetOpt.OptionPassed('Icon', IconFile) then begin
474+ IconFile := UnquoteStr(IconFile);
475+ WriteLn('Adding icon to rcfile from ', IconFile);
476+ end else
477+ IconFile := '';
478+
479+ if FGetOpt.OptionPassed('WriteRc', Param) then begin
480+ Param := UnquoteStr(Param);
481+ WriteRcFile(Param, VersionInfo, IconFile);
482+ end;
483+
484+ if FGetOpt.OptionPassed('Exec', Param) then begin
485+ Param := UnquoteStr(Param);
486+ WriteLn('Executing ', Param);
487+ Flush(Output);
488+ HandleExecOption(Param, VersionInfo, Project);
489+ end;
490+
491+ finally
492+ FreeAndNil(VersionInfo);
493+ end;
494+ Result := 0;
495+ except
496+ on e: EAbort do begin
497+ raise;
498+ end;
499+ on e: Exception do begin
500+ s := 'Error: ' + e.Message + ' (' + e.ClassName + ')';
501+ WriteLn(s);
502+ Result := 1;
503+ end;
504+ end;
505+end;
506+
507+procedure TPrepBuildMain.InitCmdLineParser;
508+begin
509+ inherited;
510+ FGetOpt.RegisterOption('dumpcmd', _('dump the commandline and exit (for debug purposes)'), False);
511+
512+ FGetOpt.RegisterOption('ReadDof', _('read a .dof file to get the version information'), True);
513+ FGetOpt.RegisterOption('ReadBdsproj', _('read a .bdsproj file to get the version information'), True);
514+ FGetOpt.RegisterOption('ReadIni', _('read a .ini file to get the version information'), True);
515+ FGetOpt.RegisterOption('ReadDproj', _('Read a .dproj file to get the version information'), True);
516+
517+ FGetOpt.RegisterOption('MajorVer', _('set the major version number (overwrites value from -ReadXxx option)'), True);
518+ FGetOpt.RegisterOption('MinorVer', _('set the minor version number (overwrites value from -ReadXxx option)'), True);
519+ FGetOpt.RegisterOption('Release', _('set the release number (overwrites value from -ReadXxx option)'), True);
520+ FGetOpt.RegisterOption('Build', _('set the build number (overwrites value from -ReadXxx option)'), True);
521+
522+ FGetOpt.RegisterOption('FileDesc', _('set the file description (overwrites value from -ReadXxx option)'), True);
523+ FGetOpt.RegisterOption('InternalName', _('set the internal name (overwrites value from -ReadXxx option)'), True);
524+ FGetOpt.RegisterOption('OriginalName', _('set the original file name (overwrites value from -ReadXxx option)'), True);
525+ FGetOpt.RegisterOption('Product', _('set the product name (overwrites value from -ReadXxx option)'), True);
526+ FGetOpt.RegisterOption('ProductVersion', _('set the product version (overwrites value from -ReadXxx option)'), True);
527+ FGetOpt.RegisterOption('Company', _('set the company name (overwrites value from -ReadXxx option)'), True);
528+ FGetOpt.RegisterOption('Copyright', _('set the legal copyright (overwrites value from -ReadXxx option)'), True);
529+ FGetOpt.RegisterOption('Trademark', _('set the legal trademark (overwrites value from -ReadXxx option)'), True);
530+ FGetOpt.RegisterOption('Comments', _('set the comments (overwrites value from -ReadXxx option)'), True);
531+
532+ FGetOpt.RegisterOption('SvnRevision', _('set the Revision (overwrites value from -ReadXxx option)'), True);
533+ FGetOpt.RegisterOption('GitRevision', _('set the Revision (overwrites value from SvnRevision and -ReadXxx option)'), True);
534+ FGetOpt.RegisterOption('BuildDateTime', _('set the BuildDateTime (overwrites value from -ReadXxx option)'), True);
535+
536+ FGetOpt.RegisterOption('IsPrivateBuild', _('set the private build flag (overwrites value from -ReadXxx option)'), True);
537+ FGetOpt.RegisterOption('IsSpecialBuild', _('set the special build flag (overwrites value from -ReadXxx option)'), True);
538+ FGetOpt.RegisterOption('PrivateBuild', _('set the private build comments (overwrites value from -ReadXxx option)'), True);
539+ FGetOpt.RegisterOption('SpecialBuild', _('set the special build comments (overwrites value from -ReadXxx option)'), True);
540+
541+ FGetOpt.RegisterOption('IncBuild', _('increment the build number'), False);
542+
543+ FGetOpt.RegisterOption('UpdateDof', _('update a .dof file with the version information'), True);
544+ FGetOpt.RegisterOption('UpdateBdsproj', _('update a .bdsproj file with the version information'), True);
545+ FGetOpt.RegisterOption('UpdateIni', _('update a .ini file with the version information'), True);
546+ FGetOpt.RegisterOption('UpdateDproj', _('update a .dproj file with the version information'), True);
547+
548+ FGetOpt.RegisterOption('InputManifest', _('read the contents for the .manifest for the UpdateManifest option from this file'), True);
549+ FGetOpt.RegisterOption('Manifest', _('Name of the .manifest file for the UpdateManifest and WriteManifestRc options'), True);
550+ FGetOpt.RegisterOption('UpdateManifest', _('update the .manifest file (given with the Manifest option) with the version information'));
551+ FGetOpt.RegisterOption('IgnoreManifestErrors', _('ignore any errors caused by the UpdateManifest option'));
552+ FGetOpt.RegisterOption('WriteManifestRc', _('Write an .rc file for embedding the .manifest file given with the Manifest option'), True);
553+
554+ FGetOpt.RegisterOption('Icon', _('Assign an icon file to add to the .rc file'), True);
555+
556+ FGetOpt.RegisterOption('WriteRc', _('write version info to a .rc file'), True);
557+
558+ FGetOpt.RegisterOption('Exec', _('execute the given program or script with extended environment'), True);
559+end;
560+
561+initialization
562+ MainClass := TPrepBuildMain;
563+end.
564+
--- tags/1.3.2/src/u_VersionInfo.pas (nonexistent)
+++ tags/1.3.2/src/u_VersionInfo.pas (revision 68)
@@ -0,0 +1,437 @@
1+unit u_VersionInfo;
2+
3+interface
4+
5+uses
6+ SysUtils;
7+
8+type
9+ TVersionInfo = class
10+ private
11+ FMajorVer: Integer;
12+ FMinorVer: Integer;
13+ FRelease: Integer;
14+ FBuild: Integer;
15+
16+ FFileVersion: string;
17+ FProductVersion: string;
18+ FProductName: string;
19+ FLegalTrademarks: string;
20+ FLegalCopyright: string;
21+ FCompanyName: string;
22+ FAutoIncBuild: Boolean;
23+ FFileDescription: string;
24+ FInternalName: string;
25+ FOriginalFilename: string;
26+ FComments: string;
27+ FSource: string;
28+ FSCMRevision: string;
29+ FBuildDateTime: string;
30+ FIsPrivateBuild: Boolean;
31+ FIsSpecialBuild: Boolean;
32+ FPrivateBuildComments: string;
33+ FSpecialBuildComments: string;
34+ function ResolveVariable(const _s: string): string;
35+ procedure AdjustFilename(var _Filename: string);
36+ protected
37+ function GetAutoIncBuild: Boolean;
38+ procedure SetAutoIncBuild(_AutoIncBuild: Boolean); virtual;
39+ //
40+ procedure Assign(_VersionInfo: TVersionInfo); virtual;
41+ //
42+ function GetMajorVer: Integer; virtual;
43+ function GetMinorVer: Integer; virtual;
44+ function GetRelease: Integer; virtual;
45+ function GetBuild: Integer; virtual;
46+ procedure SetMajorVer(_MajorVer: Integer); virtual;
47+ procedure SetMinorVer(_MinorVer: Integer); virtual;
48+ procedure SetRelease(_Release: Integer); virtual;
49+ procedure SetBuild(_Build: Integer); virtual;
50+ //
51+ function GetComments: string; virtual;
52+ function GetCompanyName: string; virtual;
53+ function GetFileDescription: string; virtual;
54+ function GetFileVersion: string; virtual;
55+ function GetInternalName: string; virtual;
56+ function GetLegalCopyright: string; virtual;
57+ function GetLegalTrademarks: string; virtual;
58+ function GetOriginalFilename: string;
59+ function GetProductName: string; virtual;
60+ function GetProductVersion: string; virtual;
61+ procedure SetComments(const _Comments: string); virtual;
62+ procedure SetCompanyName(_CompanyName: string); virtual;
63+ procedure SetFileDescription(_FileDescription: string); virtual;
64+ procedure SetFileVersion(_FileVersion: string); virtual;
65+ procedure SetInternalName(_InternalName: string); virtual;
66+ procedure SetLegalCopyright(_LegalCopyright: string); virtual;
67+ procedure SetLegalTrademarks(_LegalTrademarks: string); virtual;
68+ procedure SetOriginalFilename(_OriginalFilename: string); virtual;
69+ procedure SetProductName(_ProductName: string); virtual;
70+ procedure SetProductVersion(_ProductVersion: string); virtual;
71+ function GetSCMRevision: string; virtual;
72+ function GetBuildDateTime: string; virtual;
73+ procedure SetSCMRevision(const _SCMRevision: string); virtual;
74+ procedure SetBuildDateTime(const _BuildDateTime: string); virtual;
75+ function GetIsPrivateBuild: Boolean; virtual;
76+ function GetIsSpecialBuild: Boolean; virtual;
77+ function GetPrivateBuildComments: string; virtual;
78+ function GetSpecialBuildComments: string; virtual;
79+ procedure SetIsPrivateBuild(const _IsPrivateBuild: Boolean); virtual;
80+ procedure SetIsSpecialBuild(const _IsSpecialBuild: Boolean); virtual;
81+ procedure SetPrivateBuildComments(const _PrivateBuildComments: string); virtual;
82+ procedure SetSpecialBuildComments(const _SpecialBuildComments: string); virtual;
83+
84+ public
85+ procedure UpdateFileVersion;
86+ function ResolveVariables(const _s: string): string;
87+
88+ property Source: string read FSource write FSource;
89+ //
90+ property AutoIncBuild: Boolean read GetAutoIncBuild write SetAutoIncBuild;
91+ //
92+ property MajorVer: Integer read GetMajorVer write SetMajorVer;
93+ property MinorVer: Integer read GetMinorVer write SetMinorVer;
94+ property Release: Integer read GetRelease write SetRelease;
95+ property Build: Integer read GetBuild write SetBuild;
96+ //
97+ property Comments: string read GetComments write SetComments;
98+ property CompanyName: string read GetCompanyName write SetCompanyName;
99+ property FileDescription: string read GetFileDescription write SetFileDescription;
100+ property FileVersion: string read GetFileVersion write SetFileVersion;
101+ property InternalName: string read GetInternalName write SetInternalName;
102+ property LegalCopyRight: string read GetLegalCopyright write SetLegalCopyright;
103+ property LegalTrademarks: string read GetLegalTrademarks write SetLegalTrademarks;
104+ property OriginalFilename: string read GetOriginalFilename write SetOriginalFilename;
105+ property ProductName: string read GetProductName write SetProductName;
106+ property ProductVersion: string read GetProductVersion write SetProductVersion;
107+ property SCMRevision: string read GetSCMRevision write SetSCMRevision;
108+ property BuildDateTime: string read GetBuildDateTime write SetBuildDateTime;
109+ property IsPrivateBuild: Boolean read GetIsPrivateBuild write SetIsPrivateBuild;
110+ property IsSpecialBuild: Boolean read GetIsSpecialBuild write SetIsSpecialBuild;
111+ property PrivateBuildComments: string read GetPrivateBuildComments write SetPrivateBuildComments;
112+ property SpecialBuildComments: string read GetSpecialBuildComments write SetSpecialBuildComments;
113+ end;
114+
115+implementation
116+
117+uses
118+ StrUtils,
119+ DateUtils,
120+ IniFiles,
121+ RegularExpressions,
122+ u_dzStringUtils,
123+ u_dzDateUtils;
124+
125+{ TVersionInfo }
126+
127+procedure TVersionInfo.Assign(_VersionInfo: TVersionInfo);
128+begin
129+ Source := _VersionInfo.Source;
130+
131+ AutoIncBuild := _VersionInfo.AutoIncBuild;
132+
133+ MajorVer := _VersionInfo.MajorVer;
134+ MinorVer := _VersionInfo.MinorVer;
135+ Release := _VersionInfo.Release;
136+ Build := _VersionInfo.Build;
137+
138+ Comments := _VersionInfo.Comments;
139+ CompanyName := _VersionInfo.CompanyName;
140+ FileDescription := _VersionInfo.FileDescription;
141+ FileVersion := _VersionInfo.FileVersion;
142+ InternalName := _VersionInfo.InternalName;
143+ LegalCopyRight := _VersionInfo.LegalCopyRight;
144+ LegalTrademarks := _VersionInfo.LegalTrademarks;
145+ OriginalFilename := _VersionInfo.OriginalFilename;
146+ ProductName := _VersionInfo.ProductName;
147+ ProductVersion := _VersionInfo.ProductVersion;
148+ SCMRevision := _VersionInfo.SCMRevision;
149+ BuildDateTime := _VersionInfo.BuildDateTime;
150+ IsPrivateBuild := _VersionInfo.IsPrivateBuild;
151+ IsSpecialBuild := _VersionInfo.IsSpecialBuild;
152+ PrivateBuildComments := _VersionInfo.PrivateBuildComments;
153+ SpecialBuildComments := _VersionInfo.SpecialBuildComments;
154+end;
155+
156+procedure TVersionInfo.AdjustFilename(var _Filename: string);
157+var
158+ Path: string;
159+begin
160+ Path := ExtractFilePath(_Filename);
161+ if (Path = '') or ((Path[1] <> '\') and (Copy(Path, 2, 1) <> ':')) then begin
162+ // Path is relative, so make it relative to the main .ini/project file
163+ _Filename := ExtractFilePath(FSource) + _Filename;
164+ end;
165+end;
166+
167+function TVersionInfo.ResolveVariable(const _s: string): string;
168+var
169+ Redir: string;
170+ fn: string;
171+ Section: string;
172+ Ident: string;
173+ IniFile: TMemIniFile;
174+begin
175+ if UStartsWith('read:', _s) then begin
176+ Redir := Copy(_s, Length('read:') + 1);
177+ fn := ExtractStr(Redir, ',');
178+ Section := ExtractStr(Redir, ',');
179+ Ident := Redir;
180+ AdjustFilename(fn);
181+ IniFile := TMemIniFile.Create(fn);
182+ try
183+ Result := IniFile.ReadString(Section, Ident, '');
184+ finally
185+ IniFile.Free;
186+ end;
187+ end else if SameText('thisyear', _s) then begin
188+ Result := IntToStr(YearOf(Date));
189+ end else if SameText('today', _s) then begin
190+ Result := DateTime2Iso(Date, False);
191+ end else if SameText('now', _s) then begin
192+ Result := DateTime2Iso(Date, True);
193+ end else
194+ Result := _s;
195+end;
196+
197+function TVersionInfo.ResolveVariables(const _s: string): string;
198+var
199+ re: TRegEx;
200+ Match: TMatch;
201+ s: string;
202+ Start: Integer;
203+ Ende: Integer;
204+begin
205+ Result := '';
206+ Start := 1;
207+ re.Create('\{(.*?)\}');
208+ Match := re.Match(_s);
209+ while Match.Success and (Match.Groups.Count > 1) do begin
210+ Ende := Match.Index;
211+ Result := Result + Copy(_s, Start, Ende - Start);
212+ Start := Ende + Match.Length;
213+ s := Match.Groups[1].Value;
214+ s := ResolveVariable(s);
215+ Result := Result + s;
216+ Match := Match.NextMatch;
217+ end;
218+ Result := Result + TailStr(_s, Start);
219+end;
220+
221+function TVersionInfo.GetAutoIncBuild: Boolean;
222+begin
223+ Result := FAutoIncBuild;
224+end;
225+
226+function TVersionInfo.GetBuild: Integer;
227+begin
228+ Result := FBuild;
229+end;
230+
231+function TVersionInfo.GetBuildDateTime: string;
232+begin
233+ Result := FBuildDateTime;
234+end;
235+
236+function TVersionInfo.GetComments: string;
237+begin
238+ Result := FComments;
239+end;
240+
241+function TVersionInfo.GetCompanyName: string;
242+begin
243+ Result := FCompanyName;
244+end;
245+
246+function TVersionInfo.GetFileDescription: string;
247+begin
248+ Result := FFileDescription;
249+end;
250+
251+function TVersionInfo.GetFileVersion: string;
252+begin
253+ Result := FFileVersion;
254+end;
255+
256+function TVersionInfo.GetInternalName: string;
257+begin
258+ Result := FInternalName;
259+end;
260+
261+function TVersionInfo.GetIsPrivateBuild: Boolean;
262+begin
263+ Result := FIsPrivateBuild;
264+end;
265+
266+function TVersionInfo.GetIsSpecialBuild: Boolean;
267+begin
268+ Result := FIsSpecialBuild;
269+end;
270+
271+function TVersionInfo.GetLegalCopyright: string;
272+begin
273+ Result := FLegalCopyright;
274+end;
275+
276+function TVersionInfo.GetLegalTrademarks: string;
277+begin
278+ Result := FLegalTrademarks;
279+end;
280+
281+function TVersionInfo.GetMajorVer: Integer;
282+begin
283+ Result := FMajorVer;
284+end;
285+
286+function TVersionInfo.GetMinorVer: Integer;
287+begin
288+ Result := FMinorVer;
289+end;
290+
291+function TVersionInfo.GetOriginalFilename: string;
292+begin
293+ Result := FOriginalFilename;
294+end;
295+
296+function TVersionInfo.GetPrivateBuildComments: string;
297+begin
298+ Result := FPrivateBuildComments;
299+end;
300+
301+function TVersionInfo.GetProductName: string;
302+begin
303+ Result := FProductName;
304+end;
305+
306+function TVersionInfo.GetProductVersion: string;
307+begin
308+ Result := FProductVersion;
309+end;
310+
311+function TVersionInfo.GetRelease: Integer;
312+begin
313+ Result := FRelease;
314+end;
315+
316+function TVersionInfo.GetSpecialBuildComments: string;
317+begin
318+ Result := FSpecialBuildComments;
319+end;
320+
321+function TVersionInfo.GetSCMRevision: string;
322+begin
323+ Result := FSCMRevision;
324+end;
325+
326+procedure TVersionInfo.SetAutoIncBuild(_AutoIncBuild: Boolean);
327+begin
328+ FAutoIncBuild := _AutoIncBuild;
329+end;
330+
331+procedure TVersionInfo.SetBuild(_Build: Integer);
332+begin
333+ FBuild := _Build;
334+end;
335+
336+procedure TVersionInfo.SetBuildDateTime(const _BuildDateTime: string);
337+begin
338+ FBuildDateTime := _BuildDateTime;
339+end;
340+
341+procedure TVersionInfo.SetComments(const _Comments: string);
342+begin
343+ FComments := _Comments;
344+end;
345+
346+procedure TVersionInfo.SetCompanyName(_CompanyName: string);
347+begin
348+ FCompanyName := _CompanyName;
349+end;
350+
351+procedure TVersionInfo.SetFileDescription(_FileDescription: string);
352+begin
353+ FFileDescription := _FileDescription;
354+end;
355+
356+procedure TVersionInfo.SetFileVersion(_FileVersion: string);
357+begin
358+ FFileVersion := _FileVersion;
359+end;
360+
361+procedure TVersionInfo.SetInternalName(_InternalName: string);
362+begin
363+ FInternalName := _InternalName;
364+end;
365+
366+procedure TVersionInfo.SetIsPrivateBuild(const _IsPrivateBuild: Boolean);
367+begin
368+ FIsPrivateBuild := _IsPrivateBuild;
369+end;
370+
371+procedure TVersionInfo.SetIsSpecialBuild(const _IsSpecialBuild: Boolean);
372+begin
373+ FIsSpecialBuild := _IsSpecialBuild;
374+end;
375+
376+procedure TVersionInfo.SetLegalCopyright(_LegalCopyright: string);
377+begin
378+ FLegalCopyright := _LegalCopyright;
379+end;
380+
381+procedure TVersionInfo.SetLegalTrademarks(_LegalTrademarks: string);
382+begin
383+ FLegalTrademarks := _LegalTrademarks;
384+end;
385+
386+procedure TVersionInfo.SetMajorVer(_MajorVer: Integer);
387+begin
388+ FMajorVer := _MajorVer;
389+end;
390+
391+procedure TVersionInfo.SetMinorVer(_MinorVer: Integer);
392+begin
393+ FMinorVer := _MinorVer;
394+end;
395+
396+procedure TVersionInfo.SetOriginalFilename(_OriginalFilename: string);
397+begin
398+ FOriginalFilename := _OriginalFilename;
399+end;
400+
401+procedure TVersionInfo.SetPrivateBuildComments(const _PrivateBuildComments: string);
402+begin
403+ FPrivateBuildComments := _PrivateBuildComments;
404+end;
405+
406+procedure TVersionInfo.SetProductName(_ProductName: string);
407+begin
408+ FProductName := _ProductName;
409+end;
410+
411+procedure TVersionInfo.SetProductVersion(_ProductVersion: string);
412+begin
413+ FProductVersion := _ProductVersion;
414+end;
415+
416+procedure TVersionInfo.SetRelease(_Release: Integer);
417+begin
418+ FRelease := _Release;
419+end;
420+
421+procedure TVersionInfo.SetSpecialBuildComments(const _SpecialBuildComments: string);
422+begin
423+ FSpecialBuildComments := _SpecialBuildComments;
424+end;
425+
426+procedure TVersionInfo.SetSCMRevision(const _SCMRevision: string);
427+begin
428+ FSCMRevision := _SCMRevision;
429+end;
430+
431+procedure TVersionInfo.UpdateFileVersion;
432+begin
433+ FileVersion := Format('%d.%d.%d.%d', [MajorVer, MinorVer, Release, Build]);
434+end;
435+
436+end.
437+
--- tags/1.3.2/testdata/OriginalTestproject.bdsproj (nonexistent)
+++ tags/1.3.2/testdata/OriginalTestproject.bdsproj (revision 68)
@@ -0,0 +1,180 @@
1+<?xml version="1.0" encoding="utf-8"?>
2+<BorlandProject>
3+ <PersonalityInfo>
4+ <Option>
5+ <Option Name="Personality">Delphi.Personality</Option>
6+ <Option Name="ProjectType"></Option>
7+ <Option Name="Version">1.0</Option>
8+ <Option Name="GUID">{209412AC-0EC2-4F63-B92A-E78853FF142A}</Option>
9+ </Option>
10+ </PersonalityInfo>
11+ <Delphi.Personality>
12+ <Source>
13+ <Source Name="MainSource">Testproject.dpr</Source>
14+ </Source>
15+ <FileVersion>
16+ <FileVersion Name="Version">7.0</FileVersion>
17+ </FileVersion>
18+ <Compiler>
19+ <Compiler Name="A">8</Compiler>
20+ <Compiler Name="B">0</Compiler>
21+ <Compiler Name="C">1</Compiler>
22+ <Compiler Name="D">0</Compiler>
23+ <Compiler Name="E">0</Compiler>
24+ <Compiler Name="F">0</Compiler>
25+ <Compiler Name="G">1</Compiler>
26+ <Compiler Name="H">1</Compiler>
27+ <Compiler Name="I">1</Compiler>
28+ <Compiler Name="J">0</Compiler>
29+ <Compiler Name="K">0</Compiler>
30+ <Compiler Name="L">1</Compiler>
31+ <Compiler Name="M">0</Compiler>
32+ <Compiler Name="N">1</Compiler>
33+ <Compiler Name="O">1</Compiler>
34+ <Compiler Name="P">1</Compiler>
35+ <Compiler Name="Q">0</Compiler>
36+ <Compiler Name="R">0</Compiler>
37+ <Compiler Name="S">0</Compiler>
38+ <Compiler Name="T">0</Compiler>
39+ <Compiler Name="U">0</Compiler>
40+ <Compiler Name="V">1</Compiler>
41+ <Compiler Name="W">0</Compiler>
42+ <Compiler Name="X">1</Compiler>
43+ <Compiler Name="Y">1</Compiler>
44+ <Compiler Name="Z">1</Compiler>
45+ <Compiler Name="ShowHints">True</Compiler>
46+ <Compiler Name="ShowWarnings">True</Compiler>
47+ <Compiler Name="UnitAliases">WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;</Compiler>
48+ <Compiler Name="NamespacePrefix"></Compiler>
49+ <Compiler Name="GenerateDocumentation">False</Compiler>
50+ <Compiler Name="DefaultNamespace"></Compiler>
51+ <Compiler Name="SymbolDeprecated">True</Compiler>
52+ <Compiler Name="SymbolLibrary">True</Compiler>
53+ <Compiler Name="SymbolPlatform">True</Compiler>
54+ <Compiler Name="SymbolExperimental">True</Compiler>
55+ <Compiler Name="UnitLibrary">True</Compiler>
56+ <Compiler Name="UnitPlatform">True</Compiler>
57+ <Compiler Name="UnitDeprecated">True</Compiler>
58+ <Compiler Name="UnitExperimental">True</Compiler>
59+ <Compiler Name="HResultCompat">True</Compiler>
60+ <Compiler Name="HidingMember">True</Compiler>
61+ <Compiler Name="HiddenVirtual">True</Compiler>
62+ <Compiler Name="Garbage">True</Compiler>
63+ <Compiler Name="BoundsError">True</Compiler>
64+ <Compiler Name="ZeroNilCompat">True</Compiler>
65+ <Compiler Name="StringConstTruncated">True</Compiler>
66+ <Compiler Name="ForLoopVarVarPar">True</Compiler>
67+ <Compiler Name="TypedConstVarPar">True</Compiler>
68+ <Compiler Name="AsgToTypedConst">True</Compiler>
69+ <Compiler Name="CaseLabelRange">True</Compiler>
70+ <Compiler Name="ForVariable">True</Compiler>
71+ <Compiler Name="ConstructingAbstract">True</Compiler>
72+ <Compiler Name="ComparisonFalse">True</Compiler>
73+ <Compiler Name="ComparisonTrue">True</Compiler>
74+ <Compiler Name="ComparingSignedUnsigned">True</Compiler>
75+ <Compiler Name="CombiningSignedUnsigned">True</Compiler>
76+ <Compiler Name="UnsupportedConstruct">True</Compiler>
77+ <Compiler Name="FileOpen">True</Compiler>
78+ <Compiler Name="FileOpenUnitSrc">True</Compiler>
79+ <Compiler Name="BadGlobalSymbol">True</Compiler>
80+ <Compiler Name="DuplicateConstructorDestructor">True</Compiler>
81+ <Compiler Name="InvalidDirective">True</Compiler>
82+ <Compiler Name="PackageNoLink">True</Compiler>
83+ <Compiler Name="PackageThreadVar">True</Compiler>
84+ <Compiler Name="ImplicitImport">True</Compiler>
85+ <Compiler Name="HPPEMITIgnored">True</Compiler>
86+ <Compiler Name="NoRetVal">True</Compiler>
87+ <Compiler Name="UseBeforeDef">True</Compiler>
88+ <Compiler Name="ForLoopVarUndef">True</Compiler>
89+ <Compiler Name="UnitNameMismatch">True</Compiler>
90+ <Compiler Name="NoCFGFileFound">True</Compiler>
91+ <Compiler Name="MessageDirective">True</Compiler>
92+ <Compiler Name="ImplicitVariants">True</Compiler>
93+ <Compiler Name="UnicodeToLocale">True</Compiler>
94+ <Compiler Name="LocaleToUnicode">True</Compiler>
95+ <Compiler Name="ImagebaseMultiple">True</Compiler>
96+ <Compiler Name="SuspiciousTypecast">True</Compiler>
97+ <Compiler Name="PrivatePropAccessor">True</Compiler>
98+ <Compiler Name="UnsafeType">False</Compiler>
99+ <Compiler Name="UnsafeCode">False</Compiler>
100+ <Compiler Name="UnsafeCast">False</Compiler>
101+ <Compiler Name="OptionTruncated">True</Compiler>
102+ <Compiler Name="WideCharReduced">True</Compiler>
103+ <Compiler Name="DuplicatesIgnored">True</Compiler>
104+ <Compiler Name="UnitInitSeq">True</Compiler>
105+ <Compiler Name="LocalPInvoke">True</Compiler>
106+ <Compiler Name="CodePage"></Compiler>
107+ </Compiler>
108+ <Linker>
109+ <Linker Name="MapFile">0</Linker>
110+ <Linker Name="OutputObjs">0</Linker>
111+ <Linker Name="ConsoleApp">1</Linker>
112+ <Linker Name="DebugInfo">False</Linker>
113+ <Linker Name="RemoteSymbols">False</Linker>
114+ <Linker Name="GenerateDRC">False</Linker>
115+ <Linker Name="MinStackSize">16384</Linker>
116+ <Linker Name="MaxStackSize">1048576</Linker>
117+ <Linker Name="ImageBase">4194304</Linker>
118+ <Linker Name="ExeDescription"></Linker>
119+ <Linker Name="GenerateHpps">False</Linker>
120+ </Linker>
121+ <Directories>
122+ <Directories Name="OutputDir"></Directories>
123+ <Directories Name="UnitOutputDir"></Directories>
124+ <Directories Name="PackageDLLOutputDir"></Directories>
125+ <Directories Name="PackageDCPOutputDir"></Directories>
126+ <Directories Name="SearchPath"></Directories>
127+ <Directories Name="Packages">rtl;vcl;vcldb;dbrtl;vclx;dbxcds;dbexpress;IndySystem;IndyCore;VclSmp;IndyProtocols;dsnap;adortl;vclactnband;vclshlctrls;JvCustomD9R;JvSystemD9R;JvCoreD9R;DJcl;JvStdCtrlsD9R;dzConfigd9;PerlRegExD2005;SynEdit_R2005;SynUni_D2005;JvAppFrmD9R;JvBandsD9R;JvBDED9R;JvCmpD9R;JvCryptD9R;JvCtrlsD9R;JvDlgsD9R;JvDockingD9R;JvDotNetCtrlsD9R;JvEDID9R;JvGlobusD9R;JvHMID9R;JvInspectorD9R;JvInterpreterD9R;JvJansD9R;JvManagedThreadsD9R;JvMMD9R;JvNetD9R;JvPageCompsD9R;JvPluginD9R;JvPrintPreviewD9R;JvTimeFrameworkD9R;JvUIBD9R;JvValidatorsD9R;JvWizardD9R;JvXPCtrlsD9R</Directories>
128+ <Directories Name="Conditionals"></Directories>
129+ <Directories Name="DebugSourceDirs"></Directories>
130+ <Directories Name="UsePackages">False</Directories>
131+ </Directories>
132+ <Parameters>
133+ <Parameters Name="RunParams"></Parameters>
134+ <Parameters Name="HostApplication"></Parameters>
135+ <Parameters Name="Launcher"></Parameters>
136+ <Parameters Name="UseLauncher">False</Parameters>
137+ <Parameters Name="DebugCWD"></Parameters>
138+ <Parameters Name="RemoteHost"></Parameters>
139+ <Parameters Name="RemotePath"></Parameters>
140+ <Parameters Name="RemoteLauncher"></Parameters>
141+ <Parameters Name="RemoteCWD"></Parameters>
142+ <Parameters Name="RemoteDebug">False</Parameters>
143+ <Parameters Name="Debug Symbols Search Path"></Parameters>
144+ <Parameters Name="LoadAllSymbols">True</Parameters>
145+ <Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
146+ </Parameters>
147+ <VersionInfo>
148+ <VersionInfo Name="IncludeVerInfo">True</VersionInfo>
149+ <VersionInfo Name="AutoIncBuild">False</VersionInfo>
150+ <VersionInfo Name="MajorVer">1</VersionInfo>
151+ <VersionInfo Name="MinorVer">31</VersionInfo>
152+ <VersionInfo Name="Release">0</VersionInfo>
153+ <VersionInfo Name="Build">0</VersionInfo>
154+ <VersionInfo Name="Debug">False</VersionInfo>
155+ <VersionInfo Name="PreRelease">False</VersionInfo>
156+ <VersionInfo Name="Special">False</VersionInfo>
157+ <VersionInfo Name="Private">False</VersionInfo>
158+ <VersionInfo Name="DLL">False</VersionInfo>
159+ <VersionInfo Name="Locale">1033</VersionInfo>
160+ <VersionInfo Name="CodePage">1252</VersionInfo>
161+ </VersionInfo>
162+ <VersionInfoKeys>
163+ <VersionInfoKeys Name="FileVersion"></VersionInfoKeys>
164+ <VersionInfoKeys Name="ProductVersion">2007-07-14</VersionInfoKeys>
165+ <VersionInfoKeys Name="CompanyName">www.dummzeuch.de</VersionInfoKeys>
166+ <VersionInfoKeys Name="FileDescription">Testproject</VersionInfoKeys>
167+ <VersionInfoKeys Name="InternalName">testproject</VersionInfoKeys>
168+ <VersionInfoKeys Name="LegalCopyright">Copyright 2002-2007 by Thomas Mueller</VersionInfoKeys>
169+ <VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
170+ <VersionInfoKeys Name="OriginalFilename">testproject.exe</VersionInfoKeys>
171+ <VersionInfoKeys Name="ProductName">Testproduct</VersionInfoKeys>
172+ <VersionInfoKeys Name="Comments">internal use only</VersionInfoKeys>
173+ </VersionInfoKeys>
174+ <Language>
175+ <Language Name="ActiveLang"></Language>
176+ <Language Name="ProjectLang">$00000000</Language>
177+ <Language Name="RootDir"></Language>
178+ </Language>
179+ </Delphi.Personality>
180+</BorlandProject>
--- tags/1.3.2/testdata/OriginalTestproject.dproj (nonexistent)
+++ tags/1.3.2/testdata/OriginalTestproject.dproj (revision 68)
@@ -0,0 +1,105 @@
1+ <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+ <PropertyGroup>
3+ <ProjectGuid>{209412AC-0EC2-4F63-B92A-E78853FF142A}</ProjectGuid>
4+ <MainSource>TestProject.dpr</MainSource>
5+ <Config Condition="'$(Config)'==''">Debug</Config>
6+ <DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
7+ <ProjectVersion>12.0</ProjectVersion>
8+ </PropertyGroup>
9+ <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
10+ <Base>true</Base>
11+ </PropertyGroup>
12+ <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
13+ <Cfg_1>true</Cfg_1>
14+ <CfgParent>Base</CfgParent>
15+ <Base>true</Base>
16+ </PropertyGroup>
17+ <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
18+ <Cfg_2>true</Cfg_2>
19+ <CfgParent>Base</CfgParent>
20+ <Base>true</Base>
21+ </PropertyGroup>
22+ <PropertyGroup Condition="'$(Base)'!=''">
23+ <DCC_ImageBase>00400000</DCC_ImageBase>
24+ <DCC_UsePackage>rtl;vcl;vcldb;dbrtl;vclx;dbxcds;dbexpress;IndySystem;IndyCore;VclSmp;IndyProtocols;dsnap;adortl;vclactnband;vclshlctrls;JvCustomD9R;JvSystemD9R;JvCoreD9R;DJcl;JvStdCtrlsD9R;dzConfigd9;PerlRegExD2005;SynEdit_R2005;SynUni_D2005;JvAppFrmD9R;JvBandsD9R;JvBDED9R;JvCmpD9R;JvCryptD9R;JvCtrlsD9R;JvDlgsD9R;JvDockingD9R;JvDotNetCtrlsD9R;JvEDID9R;JvGlobusD9R;JvHMID9R;JvInspectorD9R;JvInterpreterD9R;JvJansD9R;JvManagedThreadsD9R;JvMMD9R;JvNetD9R;JvPageCompsD9R;JvPluginD9R;JvPrintPreviewD9R;JvTimeFrameworkD9R;JvUIBD9R;JvValidatorsD9R;JvWizardD9R;JvXPCtrlsD9R</DCC_UsePackage>
25+ <DCC_DebugInformation>false</DCC_DebugInformation>
26+ <DCC_UnitAlias>WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;$(DCC_UnitAlias)</DCC_UnitAlias>
27+ <DCC_Platform>x86</DCC_Platform>
28+ <DCC_DependencyCheckOutputName>TestProject.exe</DCC_DependencyCheckOutputName>
29+ <DCC_K>false</DCC_K>
30+ <DCC_N>true</DCC_N>
31+ <DCC_S>false</DCC_S>
32+ <DCC_SymbolReferenceInfo>1</DCC_SymbolReferenceInfo>
33+ <DCC_E>false</DCC_E>
34+ <DCC_F>false</DCC_F>
35+ </PropertyGroup>
36+ <PropertyGroup Condition="'$(Cfg_1)'!=''">
37+ <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
38+ <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
39+ <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
40+ </PropertyGroup>
41+ <PropertyGroup Condition="'$(Cfg_2)'!=''">
42+ <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
43+ </PropertyGroup>
44+ <ItemGroup>
45+ <DelphiCompile Include="TestProject.dpr">
46+ <MainSource>MainSource</MainSource>
47+ </DelphiCompile>
48+ <BuildConfiguration Include="Base">
49+ <Key>Base</Key>
50+ </BuildConfiguration>
51+ <BuildConfiguration Include="Debug">
52+ <Key>Cfg_2</Key>
53+ <CfgParent>Base</CfgParent>
54+ </BuildConfiguration>
55+ <BuildConfiguration Include="Release">
56+ <Key>Cfg_1</Key>
57+ <CfgParent>Base</CfgParent>
58+ </BuildConfiguration>
59+ </ItemGroup>
60+ <Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
61+ <ProjectExtensions>
62+ <Borland.Personality>Delphi.Personality.12</Borland.Personality>
63+ <Borland.ProjectType/>
64+ <BorlandProject>
65+ <Delphi.Personality>
66+ <Source>
67+ <Source Name="MainSource">TestProject.dpr</Source>
68+ </Source>
69+ <Parameters>
70+ <Parameters Name="UseLauncher">False</Parameters>
71+ <Parameters Name="LoadAllSymbols">True</Parameters>
72+ <Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
73+ </Parameters>
74+ <VersionInfo>
75+ <VersionInfo Name="IncludeVerInfo">True</VersionInfo>
76+ <VersionInfo Name="AutoIncBuild">False</VersionInfo>
77+ <VersionInfo Name="MajorVer">1</VersionInfo>
78+ <VersionInfo Name="MinorVer">0</VersionInfo>
79+ <VersionInfo Name="Release">0</VersionInfo>
80+ <VersionInfo Name="Build">0</VersionInfo>
81+ <VersionInfo Name="Debug">False</VersionInfo>
82+ <VersionInfo Name="PreRelease">False</VersionInfo>
83+ <VersionInfo Name="Special">False</VersionInfo>
84+ <VersionInfo Name="Private">False</VersionInfo>
85+ <VersionInfo Name="DLL">False</VersionInfo>
86+ <VersionInfo Name="Locale">1033</VersionInfo>
87+ <VersionInfo Name="CodePage">1252</VersionInfo>
88+ </VersionInfo>
89+ <VersionInfoKeys>
90+ <VersionInfoKeys Name="FileVersion"/>
91+ <VersionInfoKeys Name="ProductVersion">2007-07-14</VersionInfoKeys>
92+ <VersionInfoKeys Name="CompanyName">www.dummzeuch.de</VersionInfoKeys>
93+ <VersionInfoKeys Name="FileDescription">Testproject</VersionInfoKeys>
94+ <VersionInfoKeys Name="InternalName">testproject</VersionInfoKeys>
95+ <VersionInfoKeys Name="LegalCopyright">Copyright 2002-2007 by Thomas Mueller</VersionInfoKeys>
96+ <VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
97+ <VersionInfoKeys Name="OriginalFilename">testproject.exe</VersionInfoKeys>
98+ <VersionInfoKeys Name="ProductName">Testproduct</VersionInfoKeys>
99+ <VersionInfoKeys Name="Comments">internal use only</VersionInfoKeys>
100+ </VersionInfoKeys>
101+ </Delphi.Personality>
102+ </BorlandProject>
103+ <ProjectFileVersion>12</ProjectFileVersion>
104+ </ProjectExtensions>
105+ </Project>
--- tags/1.3.2/testdata/OriginalTestproject.manifest.in (nonexistent)
+++ tags/1.3.2/testdata/OriginalTestproject.manifest.in (revision 68)
@@ -0,0 +1,48 @@
1+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+<!--
3+ This manifest tells Windows Vista (and Windows 7/8) not to virtualize any file
4+ or registry access.
5+ -->
6+ <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
7+ <assemblyIdentity version="FileVersion goes here"
8+ processorArchitecture="*"
9+ name="InternalName goes here"
10+ type="win32"/>
11+<!-- We do not want themes support
12+ <dependency>
13+ <dependentassembly>
14+ <assemblyidentity type="win32"
15+ name="Microsoft.Windows.Common-Controls"
16+ version="6.0.0.0"
17+ publickeytoken="6595b64144ccf1df"
18+ language="*" processorarchitecture="*">
19+ </assemblyidentity>
20+ </dependentassembly>
21+ <dependency>
22+ -->
23+ <description>FileDescription goes here</description>
24+ <!-- COMPATIBILITY SECTION SPECIFIES IF APP IS COMPLIANT
25+ DISABLES PCA IF SPECIFIED -->
26+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
27+ <application>
28+ <!-- We support Windows Vista -->
29+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
30+ <!-- We support Windows 7 -->
31+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
32+ <!-- We support Windows 8 -->
33+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
34+ </application>
35+ </compatibility>
36+
37+ <!-- TRUSTINFO SECTION SPECIFIES REQUESTED PERMISSIONS AND
38+ UIPI DISABLEMENT (SPECIAL CONDITIONS APPLY TO UIPI DISABLEMENT)-->
39+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
40+ <security>
41+ <requestedPrivileges>
42+ <requestedExecutionLevel
43+ level="asInvoker"
44+ uiAccess="false"/>
45+ </requestedPrivileges>
46+ </security>
47+ </trustInfo>
48+</assembly>
\ No newline at end of file
--- tags/1.3.2/testdata/OriginalTestproject_Version.ini (nonexistent)
+++ tags/1.3.2/testdata/OriginalTestproject_Version.ini (revision 68)
@@ -0,0 +1,19 @@
1+[Version Info]
2+IncludeVerInfo=1
3+AutoIncBuild=0
4+MajorVer=1
5+MinorVer=0
6+Release=0
7+Build=redirect:Testproject_Build.ini,Version Info,Build
8+
9+[Version Info Keys]
10+CompanyName=www.dummzeuch.de
11+FileDescription=This is a Testproject for dzPrepBuild
12+FileVersion=1.0.0.3
13+InternalName=testproject.exe
14+LegalCopyright=Copyright 2002-{ThisYear} by Thomas Mueller
15+LegalTrademarks=
16+OriginalFilename=testproject.exe
17+ProductName=Testproduct
18+ProductVersion={today}
19+Comments=<svn range="{read:svn_version.ini,SVN,VersionRange}" modified="{read:svn_version.ini,SVN,LocalModifications}" url="{read:svn_version.ini,SVN,url}" />
--- tags/1.3.2/!ReadMe.txt (nonexistent)
+++ tags/1.3.2/!ReadMe.txt (revision 68)
@@ -0,0 +1,199 @@
1+PrepBuild is a commandline tool for handling the version information
2+for Delphi projects when compiling using the dcc32.exe commandline
3+compiler. It can also be used as a Pre-Build tool in Delphi 2007 and up.
4+
5+It can read and update four different kinds of sources for the
6+version information:
7+* <projectname>.dof files (used up to Delphi 7)
8+* <projectname>.bdsproj files (used in BDS 2005 and 2006)
9+* <projectname>.dproj files (used in Delphi 2007, 2009 and 2010)
10+* <projectname>_version.ini files (uses the same format as .dof but has some
11+ extensions)
12+
13+If you call the programm with the --help or -? option, it will display
14+usage information.
15+
16+Use case 1, Delphi 7:
17+
18+Let's assume you are using Delphi 7, so you probably store the version
19+in the <projectname>.dof file and let the IDE autoincrement the build
20+number. Now, for release builds you don't want to use the IDE because
21+you want to make sure that the process is 100% repeatable without
22+relying on a particular IDE setup. So instead of the IDE you use the
23+commandline compiler dcc32.exe which is called from a script called
24+build.cmd:
25+
26+-------------
27+
28+[... other stuff, e.g. checkout the current sourcecode ...]
29+
30+del <projectname>.cfg
31+dcc32 [... options ...] <projectname>.dpr
32+
33+[... other stuff, e.g. create a tag in the SCM ...]
34+
35+-------------
36+
37+dcc32, in contrast to the IDE, does not use the .dof file and does not
38+automatically increment the build number. Instead it reads a .cfg file,
39+if one exists. The Delphi IDE creates this .cfg file every time it saves
40+the project, so it always contains the settings of the IDE, which is
41+usually not what you want, hence the delete in the example above.
42+
43+If you are like me you don't check your .res file into the sourcecode
44+repository because it is binary, so you can't easily check what changed,
45+and it changes with every build. Instead you rely on the .dof file for
46+tracking the version information and let the IDE create the .res file
47+whenever needed.
48+
49+This has got the drawback that you lose the application's icon because
50+it is only stored in the .res file. Which is quite annoying. Also, the
51+commandline compiler does not create the .res file but fails if it does
52+not exist.
53+
54+PrepBuild to the rescue. It does any of the following for you:
55+1. Read the .dof file
56+2. increment the build number
57+3. call a batch file that again calls prepbuild to
58+ 3.1 change the .dof file
59+ 3.2 create a .rc file containing the version info
60+ 3.3 add a .ico file to the .rc file so the icon is back
61+ 3.4 call brcc32 to create .res file for the project
62+
63+Your build script then looks like this:
64+
65+-------------
66+
67+[... other stuff, e.g. checkout the current sourcecode ...]
68+
69+prepbuild --ReadDof=<projectname> --IncBuild --exec=prep.cmd
70+
71+del <projectname>.cfg
72+dcc32 [... options ...] <projectname>.dpr
73+
74+[... other stuff, e.g. create a tag in the SCM ...]
75+
76+-------------
77+
78+Which means that it reads the .dof file of your project, increments the
79+build number and calls another script prep.cmd. This script will get
80+all the version information as well as the current date and time as
81+environment variables. It can use these to call PrepBuild once again to
82+
83+1. update the .dof file
84+2. write the build date / time e.g. to the comment entry of the
85+ version information
86+3. write a .rc file
87+
88+To do this, you create a prep.cmd script containing this call:
89+
90+PrepBuild --updatedof=%dzProject%
91+ --icon=%dzProject%
92+ --writerc=%dzProject%
93+ --MajorVer=%dzVersion.MajorVer%
94+ --MinorVer=%dzVersion.MinorVer%
95+ --Release=%dzVersion.Release%
96+ --Build=%dzVersion.Build%
97+ --FileDesc="%dzVersion.FileDesc%"
98+ --InternalName="%dzVersion.InternalName%"
99+ --OriginalName="%dzVersion.OriginalName%"
100+ --Product="%dzVersion.Product%"
101+ --ProductVersion="%dzVersion.ProductVersion%"
102+ --Company="%dzVersion.Company%"
103+ --Copyright="%dzVersion.Copyright%"
104+ --Trademark="%dzVersion.Trademark%"
105+ --Comments="build on %dzDateTime%"
106+
107+(all this must go into one line, I just wrapped it to improve readability)
108+
109+The following environment variables can be used (in addition to the ones
110+that are usually set):
111+
112+%dzDate% - the current date in ISO format (yyyy-mm-dd)
113+%dzTime% - the current time in 24 hour format (hh:mm:ss)
114+%dzDateTime% - combination of the above (yyyy-mm-dd hh:mm:ss)
115+%dzMyDocuments% - the My Documents folder of the current user
116+%dzProject% - the project name passed by the --ReadDof / --ReadBdsProj
117+ or --ReadIni option without extension
118+
119+The following values are read from the .dof / .bdsproj / .dproj / .ini file
120+and also passed as environment variables:
121+
122+%dzVersion.MajorVer% - the major version number
123+%dzVersion.MinorVer% - the minor version number
124+%dzVersion.Release% - the release number
125+%dzVersion.Build% - the build number (optionally incremented by one)
126+%dzVersion.FileDesc% - the file description
127+%dzVersion.InternalName% - the internal name
128+%dzVersion.OriginalName% - the original filename
129+%dzVersion.Product% - the product name
130+%dzVersion.ProductVersion% - the product version
131+%dzVersion.Company% - the company name
132+%dzVersion.Copyright% - the copyright string
133+%dzVersion.Trademark% - the trademark string
134+%dzVersion.Comments% - the comments string
135+
136+In the above example these environment variables are used to call
137+PrepBuild again passing all values as commandline options to update
138+the project's .dof file and also create a .rc file.
139+
140+In addition an icon file is also added to the .rc file.
141+
142+You may ask why I am using a second script instead of doing everything
143+in PrepBuild itself. The answer is that I didn't want to add too
144+much functionality to the tool but also wanted the maximum of flexibility.
145+With this second script, I can use the version info and also the
146+build timestamp to modify the version information. Others may want to
147+add the user name to the version info, so they can just use the
148+standard environment variable %USERNAME% to add it. You might even want
149+to move creating a tag in your SCM to this script because there you
150+can use the current version number and build date/time for generating
151+the tag's name.
152+
153+Use case 2, Delphi 2007:
154+
155+Let's assume your company is using Delphi 2007 and there are
156+multiple Developers working on the same project. You want to make
157+sure that the build number of a project always increases no matter
158+which developer does a build. This cannot be done with the options
159+of the Delphi IDE because it - worse than Delphi 7 - takes the
160+version information from the .res file (and only from the .dproj file
161+if no .res file exists). .res files are binary and there is no easy
162+way to modify them. So, what do you do?
163+
164+The first thing is disabling the version information in the project
165+options. Since the IDE doesn't do it correctly, there is no point in
166+letting it manage the version info. Instead you use a .ini file
167+to store it. This .ini file goes into your source code repository
168+together with the code. In addtion you have got another .ini file
169+in a central location (on the network) that stores the build number.
170+You refer to this .ini file in the entry of your version .ini file
171+like this:
172+
173+[Version Info]
174+// other stuff
175+Build=redirect:\\server\share\Testproject_Buildno.ini,Version Info,Build
176+
177+This will make PrepBuild read and write the build number to the
178+central .ini file rather than the local one (*1). Make sure that
179+everybody involved has write permissions on that file.
180+
181+Now, you add PrepBuild as a prebuild event like this:
182+
183+prepbuild
184+
185+to be continued ....
186+
187+dzPrepBuild itself uses the same mechanism, but not with a central file
188+on a server but with a separate file in the repository. This is for two
189+reasons:
190+1. It demonstrates how it is done
191+2. It reduces the changes to one single very small file.
192+
193+
194+(*1: Of course there is the small chance of two developers doing
195+a build at the same time. This will result in a duplicate build
196+number, but this shouldn't happen very often and I was too lazy
197+to try and implement some kind of locking mechanism to prevent
198+this rare case. If you need it, you have got the source code....)
199+
Afficher sur ancien navigateur de dépôt.