(empty log message)
@@ -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 | + |
@@ -0,0 +1,220 @@ | ||
1 | +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
2 | + <PropertyGroup> | |
3 | + <Base>True</Base> | |
4 | + <AppType>Application</AppType> | |
5 | + <Config Condition="'$(Config)'==''">Debug</Config> | |
6 | + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |
7 | + <DCC_DCCCompiler>DCC32</DCC_DCCCompiler> | |
8 | + <DCC_DependencyCheckOutputName>..\PrepBuild.exe</DCC_DependencyCheckOutputName> | |
9 | + <FrameworkType>VCL</FrameworkType> | |
10 | + <MainSource>PrepBuild.dpr</MainSource> | |
11 | + <Platform Condition="'$(Platform)'==''">Win32</Platform> | |
12 | + <ProjectGuid>{209412ac-0ec2-4f63-b92a-e78853ff142a}</ProjectGuid> | |
13 | + <ProjectVersion>13.4</ProjectVersion> | |
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>true</Base> | |
21 | + <CfgParent>Base</CfgParent> | |
22 | + <Base_Win32>true</Base_Win32> | |
23 | + </PropertyGroup> | |
24 | + <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''"> | |
25 | + <Base>true</Base> | |
26 | + <CfgParent>Base</CfgParent> | |
27 | + <Cfg_1>true</Cfg_1> | |
28 | + </PropertyGroup> | |
29 | + <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''"> | |
30 | + <Base>true</Base> | |
31 | + <CfgParent>Cfg_1</CfgParent> | |
32 | + <Cfg_1>true</Cfg_1> | |
33 | + <Cfg_1_Win32>true</Cfg_1_Win32> | |
34 | + </PropertyGroup> | |
35 | + <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''"> | |
36 | + <Base>true</Base> | |
37 | + <CfgParent>Base</CfgParent> | |
38 | + <Cfg_2>true</Cfg_2> | |
39 | + </PropertyGroup> | |
40 | + <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''"> | |
41 | + <Base>true</Base> | |
42 | + <CfgParent>Cfg_2</CfgParent> | |
43 | + <Cfg_2>true</Cfg_2> | |
44 | + <Cfg_2_Win32>true</Cfg_2_Win32> | |
45 | + </PropertyGroup> | |
46 | + <PropertyGroup Condition="'$(Base)'!=''"> | |
47 | + <DCC_DcuOutput>..\$(Config)\$(Platform)\dcu</DCC_DcuOutput> | |
48 | + <DCC_Define>no_translation;NO_TRANSLATION_HINT;$(DCC_Define)</DCC_Define> | |
49 | + <DCC_DependencyCheckOutputName>PrepBuild.exe</DCC_DependencyCheckOutputName> | |
50 | + <DCC_ExeOutput>..</DCC_ExeOutput> | |
51 | + <DCC_MapFile>3</DCC_MapFile> | |
52 | + <DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;Xml.Win;$(DCC_Namespace)</DCC_Namespace> | |
53 | + <DCC_SYMBOL_PLATFORM>false</DCC_SYMBOL_PLATFORM> | |
54 | + <DCC_UNIT_PLATFORM>false</DCC_UNIT_PLATFORM> | |
55 | + <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> | |
56 | + <Manifest_File>None</Manifest_File> | |
57 | + <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys> | |
58 | + <VerInfo_Locale>2057</VerInfo_Locale> | |
59 | + </PropertyGroup> | |
60 | + <PropertyGroup Condition="'$(Base_Win32)'!=''"> | |
61 | + <DCC_Namespace>System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Bde;$(DCC_Namespace)</DCC_Namespace> | |
62 | + <Debugger_RunParams>--incbuild --readini=testdata\testproject --updateini=testdata\testproject --writerc=testdata\testproject</Debugger_RunParams> | |
63 | + <PostBuildEvent> | |
64 | + <![CDATA[..\buildtools\postbuild.cmd $(OUTPUTDIR)$(OUTPUTNAME) | |
65 | +$(PostBuildEvent)]]> | |
66 | + </PostBuildEvent> | |
67 | + <PreBuildEvent> | |
68 | + <![CDATA[..\buildtools\prebuild.cmd $(PROJECTPATH) | |
69 | +$(PreBuildEvent)]]> | |
70 | + </PreBuildEvent> | |
71 | + <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo> | |
72 | + <VerInfo_Locale>1033</VerInfo_Locale> | |
73 | + </PropertyGroup> | |
74 | + <PropertyGroup Condition="'$(Cfg_1)'!=''"> | |
75 | + <DCC_DebugInformation>False</DCC_DebugInformation> | |
76 | + <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define> | |
77 | + <DCC_ExeOutput>..</DCC_ExeOutput> | |
78 | + <DCC_HppOutput>dcu</DCC_HppOutput> | |
79 | + <DCC_LocalDebugSymbols>False</DCC_LocalDebugSymbols> | |
80 | + <DCC_ObjOutput>dcu</DCC_ObjOutput> | |
81 | + <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo> | |
82 | + <Version>7.0</Version> | |
83 | + </PropertyGroup> | |
84 | + <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''"> | |
85 | + <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo> | |
86 | + <VerInfo_Locale>1033</VerInfo_Locale> | |
87 | + </PropertyGroup> | |
88 | + <PropertyGroup Condition="'$(Cfg_2)'!=''"> | |
89 | + <DCC_DebugDCUs>true</DCC_DebugDCUs> | |
90 | + <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define> | |
91 | + <DCC_DependencyCheckOutputName>..\PrepBuild.exe</DCC_DependencyCheckOutputName> | |
92 | + <DCC_ExeOutput>..</DCC_ExeOutput> | |
93 | + <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> | |
94 | + <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> | |
95 | + <DCC_Optimize>False</DCC_Optimize> | |
96 | + <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> | |
97 | + <DCC_SYMBOL_PLATFORM>False</DCC_SYMBOL_PLATFORM> | |
98 | + <DCC_UNIT_PLATFORM>False</DCC_UNIT_PLATFORM> | |
99 | + <Version>7.0</Version> | |
100 | + </PropertyGroup> | |
101 | + <PropertyGroup Condition="'$(Cfg_2_Win32)'!=''"> | |
102 | + <Debugger_RunParams>--incbuild --BuildDateTime={today} --readini=testdata\testproject --updateini=testdata\testproject --WriteRc=testdata\testproject --InputManifest=testdata\testproject.manifest.in --manifest=testdata\testproject --updatemanifest --WriteManifestRc=testdata\testproject --theming=on</Debugger_RunParams> | |
103 | + <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo> | |
104 | + <VerInfo_Locale>1033</VerInfo_Locale> | |
105 | + </PropertyGroup> | |
106 | + <ProjectExtensions> | |
107 | + <Borland.Personality>Delphi.Personality.12</Borland.Personality> | |
108 | + <Borland.ProjectType/> | |
109 | + <BorlandProject> | |
110 | + <Delphi.Personality> | |
111 | + <Parameters> | |
112 | + <Parameters Name="RunParams">--incbuild --readini=testdata\testproject --updateini=testdata\testproject --writerc=testdata\testproject</Parameters> | |
113 | + </Parameters> | |
114 | + <VersionInfo> | |
115 | + <VersionInfo Name="IncludeVerInfo">False</VersionInfo> | |
116 | + <VersionInfo Name="AutoIncBuild">False</VersionInfo> | |
117 | + <VersionInfo Name="MajorVer">1</VersionInfo> | |
118 | + <VersionInfo Name="MinorVer">0</VersionInfo> | |
119 | + <VersionInfo Name="Release">0</VersionInfo> | |
120 | + <VersionInfo Name="Build">0</VersionInfo> | |
121 | + <VersionInfo Name="Debug">False</VersionInfo> | |
122 | + <VersionInfo Name="PreRelease">False</VersionInfo> | |
123 | + <VersionInfo Name="Special">False</VersionInfo> | |
124 | + <VersionInfo Name="Private">False</VersionInfo> | |
125 | + <VersionInfo Name="DLL">False</VersionInfo> | |
126 | + <VersionInfo Name="Locale">2057</VersionInfo> | |
127 | + <VersionInfo Name="CodePage">1252</VersionInfo> | |
128 | + </VersionInfo> | |
129 | + <Excluded_Packages> | |
130 | + <Excluded_Packages Name="$(BDSBIN)\bcboffice2k160.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages> | |
131 | + <Excluded_Packages Name="$(BDSBIN)\bcbofficexp160.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages> | |
132 | + <Excluded_Packages Name="$(BDSBIN)\dcloffice2k160.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages> | |
133 | + <Excluded_Packages Name="$(BDSBIN)\dclofficexp160.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages> | |
134 | + </Excluded_Packages> | |
135 | + <Source> | |
136 | + <Source Name="MainSource">PrepBuild.dpr</Source> | |
137 | + </Source> | |
138 | + <VersionInfoKeys> | |
139 | + <VersionInfoKeys Name="CompanyName"/> | |
140 | + <VersionInfoKeys Name="FileDescription"/> | |
141 | + <VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys> | |
142 | + <VersionInfoKeys Name="InternalName"/> | |
143 | + <VersionInfoKeys Name="LegalCopyright"/> | |
144 | + <VersionInfoKeys Name="LegalTrademarks"/> | |
145 | + <VersionInfoKeys Name="OriginalFilename"/> | |
146 | + <VersionInfoKeys Name="ProductName"/> | |
147 | + <VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys> | |
148 | + <VersionInfoKeys Name="Comments"/> | |
149 | + </VersionInfoKeys> | |
150 | + </Delphi.Personality> | |
151 | + <ModelSupport>False</ModelSupport> | |
152 | + <Platforms> | |
153 | + <Platform value="Win32">True</Platform> | |
154 | + <Platform value="Win64">False</Platform> | |
155 | + </Platforms> | |
156 | + </BorlandProject> | |
157 | + <ProjectFileVersion>12</ProjectFileVersion> | |
158 | + </ProjectExtensions> | |
159 | + <ItemGroup> | |
160 | + <DelphiCompile Include="$(MainSource)"> | |
161 | + <MainSource>MainSource</MainSource> | |
162 | + </DelphiCompile> | |
163 | + <DCCReference Include="d_XmlVersionInfo.pas"> | |
164 | + <Form>dm_XmlVersionInfo</Form> | |
165 | + <DesignClass>TDataModule</DesignClass> | |
166 | + </DCCReference> | |
167 | + <DCCReference Include="d_DprojVersionInfo.pas"> | |
168 | + <Form>dm_DprojVersionInfo</Form> | |
169 | + <DesignClass>TDataModule</DesignClass> | |
170 | + </DCCReference> | |
171 | + <DCCReference Include="d_BdsProjVersionInfo.pas"> | |
172 | + <Form>dm_BdsProjVersionInfo</Form> | |
173 | + <DesignClass>TDataModule</DesignClass> | |
174 | + </DCCReference> | |
175 | + <DCCReference Include="d_ManifestVersionInfo.pas"> | |
176 | + <Form>dm_ManifestVersionInfo</Form> | |
177 | + <DesignClass>TDataModule</DesignClass> | |
178 | + </DCCReference> | |
179 | + <DCCReference Include="i_VersionInfoAccess.pas"/> | |
180 | + <DCCReference Include="u_DofVersionInfo.pas"/> | |
181 | + <DCCReference Include="u_IniVersionInfo.pas"/> | |
182 | + <DCCReference Include="u_CentralIniVersionInfo.pas"/> | |
183 | + <DCCReference Include="u_PrepBuildMain.pas"/> | |
184 | + <DCCReference Include="u_VersionInfo.pas"/> | |
185 | + <DCCReference Include="..\libs\dzlib\forms\w_dzDialog.pas"> | |
186 | + <Form>f_dzDialog</Form> | |
187 | + </DCCReference> | |
188 | + <DCCReference Include="..\libs\dzlib\src\u_dzDefaultMain.pas"/> | |
189 | + <BuildConfiguration Include="Base"> | |
190 | + <Key>Base</Key> | |
191 | + </BuildConfiguration> | |
192 | + <BuildConfiguration Include="Release"> | |
193 | + <Key>Cfg_1</Key> | |
194 | + <CfgParent>Base</CfgParent> | |
195 | + </BuildConfiguration> | |
196 | + <BuildConfiguration Include="Debug"> | |
197 | + <Key>Cfg_2</Key> | |
198 | + <CfgParent>Base</CfgParent> | |
199 | + </BuildConfiguration> | |
200 | + </ItemGroup> | |
201 | + <Import Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')" Project="$(BDS)\Bin\CodeGear.Delphi.Targets"/> | |
202 | + <Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\8.0\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\8.0\UserTools.proj"/> | |
203 | + <Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj"/> | |
204 | + <PropertyGroup Condition="'$(Config)'=='Release' And '$(Platform)'=='Win32'"> | |
205 | + <PostBuildEvent>..\buildtools\postbuild.cmd $(OUTPUTDIR)$(OUTPUTNAME)</PostBuildEvent> | |
206 | + <PostBuildEventIgnoreExitCode>False</PostBuildEventIgnoreExitCode> | |
207 | + <PreBuildEvent>..\buildtools\prebuild.cmd $(PROJECTPATH)</PreBuildEvent> | |
208 | + <PreBuildEventIgnoreExitCode>False</PreBuildEventIgnoreExitCode> | |
209 | + <PreLinkEvent/> | |
210 | + <PreLinkEventIgnoreExitCode>False</PreLinkEventIgnoreExitCode> | |
211 | + </PropertyGroup> | |
212 | + <PropertyGroup Condition="'$(Config)'=='Debug' And '$(Platform)'=='Win32'"> | |
213 | + <PostBuildEvent>..\buildtools\postbuild.cmd $(OUTPUTDIR)$(OUTPUTNAME)</PostBuildEvent> | |
214 | + <PostBuildEventIgnoreExitCode>False</PostBuildEventIgnoreExitCode> | |
215 | + <PreBuildEvent>..\buildtools\prebuild.cmd $(PROJECTPATH)</PreBuildEvent> | |
216 | + <PreBuildEventIgnoreExitCode>False</PreBuildEventIgnoreExitCode> | |
217 | + <PreLinkEvent/> | |
218 | + <PreLinkEventIgnoreExitCode>False</PreLinkEventIgnoreExitCode> | |
219 | + </PropertyGroup> | |
220 | +</Project> |
@@ -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 |
@@ -0,0 +1,4 @@ | ||
1 | +[Version Info] | |
2 | +Build=563 | |
3 | +FileVersion=1.3.3.563 | |
4 | + |
@@ -0,0 +1,25 @@ | ||
1 | +[Version Info] | |
2 | +MajorVer=1 | |
3 | +MinorVer=3 | |
4 | +Release=3 | |
5 | +Build=redirect:PrepBuild_BuildNo.ini,Version Info,Build | |
6 | +AutoIncBuild=0 | |
7 | +Revision= | |
8 | +Private=0 | |
9 | +Special=0 | |
10 | + | |
11 | +[Version Info Keys] | |
12 | +CompanyName=dummzeuch.de | |
13 | +FileDescription=dzlib PrepBuild commandline and IDE prebuild tool | |
14 | +FileVersion=redirect:PrepBuild_BuildNo.ini,Version Info,FileVersion | |
15 | +InternalName={ProjectName} | |
16 | +LegalCopyright=Copyright 2002-{ThisYear} by Thomas Mueller | |
17 | +LegalTrademarks= | |
18 | +OriginalFilename={ProjectName}.exe | |
19 | +ProductName={ProjectName} | |
20 | +ProductVersion={today} | |
21 | +Comments=<svn range=\"{read:svn_version.ini,SVN,VersionRange}\" modified=\"{read:svn_version.ini,SVN,LocalModifications}\" url=\"{read:svn_version.ini,SVN,url}\" /> | |
22 | +BuildDateTime={today} | |
23 | +PrivateBuild= | |
24 | +SpecialBuild= | |
25 | + |
@@ -0,0 +1,47 @@ | ||
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 _ProjectBaseFn: string); | |
21 | + end; | |
22 | + | |
23 | +implementation | |
24 | + | |
25 | +{$R *.dfm} | |
26 | + | |
27 | +{ Tdm_BdsProjVersionInfo } | |
28 | + | |
29 | +constructor Tdm_BdsProjVersionInfo.Create(const _ProjectBaseFn: string); | |
30 | +begin | |
31 | + inherited Create(ChangeFileExt(_ProjectBaseFn, '.bdsproj'), | |
32 | + ChangeFileExt(ExtractFileName(_ProjectBaseFn), '')); | |
33 | +end; | |
34 | + | |
35 | +procedure Tdm_BdsProjVersionInfo.InitVersionNodes; | |
36 | +var | |
37 | + BorlandProject: IXMLNode; | |
38 | + DelphiPersonality: IXMLNode; | |
39 | +begin | |
40 | + BorlandProject := ProjDoc.DocumentElement; | |
41 | + DelphiPersonality := BorlandProject.childNodes['Delphi.Personality']; | |
42 | + FVersionInfo := DelphiPersonality.childNodes['VersionInfo']; | |
43 | + FVersionInfoKeys := DelphiPersonality.childNodes['VersionInfoKeys']; | |
44 | +end; | |
45 | + | |
46 | +end. | |
47 | + |
@@ -0,0 +1,50 @@ | ||
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 _ProjectBaseFn: string); | |
22 | + end; | |
23 | + | |
24 | +implementation | |
25 | + | |
26 | +{$R *.dfm} | |
27 | + | |
28 | +constructor Tdm_DprojVersionInfo.Create(const _ProjectBaseFn: string); | |
29 | +begin | |
30 | + inherited Create(ChangeFileExt(_ProjectBaseFn, '.dproj'), | |
31 | + ChangeFileExt(ExtractFileName(_ProjectBaseFn), '')); | |
32 | +end; | |
33 | + | |
34 | +procedure Tdm_DprojVersionInfo.InitVersionNodes; | |
35 | +var | |
36 | + ProjectExtensions: IXMLNode; | |
37 | + DelphiPersonality: IXMLNode; | |
38 | + BorlandProject: IXMLNode; | |
39 | + Project: IXMLNode; | |
40 | +begin | |
41 | + Project := ProjDoc.DocumentElement; | |
42 | + ProjectExtensions := Project.ChildNodes['ProjectExtensions']; | |
43 | + BorlandProject := ProjectExtensions.ChildNodes['BorlandProject']; | |
44 | + DelphiPersonality := BorlandProject.ChildNodes['Delphi.Personality']; | |
45 | + FVersionInfo := DelphiPersonality.ChildNodes['VersionInfo']; | |
46 | + FVersionInfoKeys := DelphiPersonality.ChildNodes['VersionInfoKeys']; | |
47 | +end; | |
48 | + | |
49 | +end. | |
50 | + |
@@ -0,0 +1,255 @@ | ||
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 | + IThemingAccess = interface ['{AFA7C417-A4E7-43DB-A2BF-49C2157A33E7}'] | |
18 | + procedure DisableTheming; | |
19 | + procedure EnableTheming; | |
20 | + end; | |
21 | + | |
22 | +type | |
23 | + Tdm_ManifestVersionInfo = class(TDataModule, IVersionInfoAccess, IThemingAccess) | |
24 | + ProjDoc: TXMLDocument; | |
25 | + private | |
26 | + FInputFilename: string; | |
27 | + FOutputFilename: string; | |
28 | + FDescriptionNode: IXMLNode; | |
29 | + FAssemblyIdentityNode: IXMLNode; | |
30 | + function FindComCtlNode(out _DependentAssemblyNode: IXMLNode): boolean; | |
31 | + protected // IInterface | |
32 | + FRefCount: Integer; | |
33 | + function QueryInterface(const IID: TGUID; out Obj): HResult; override; stdcall; | |
34 | + function _AddRef: Integer; stdcall; | |
35 | + function _Release: Integer; stdcall; | |
36 | + protected // IVersionInfoAccess | |
37 | + function VerInfoFilename: string; | |
38 | + procedure ReadFromFile(_VerInfo: TVersionInfo); | |
39 | + procedure WriteToFile(_VerInfo: TVersionInfo); | |
40 | + protected // IThemingAccess | |
41 | + procedure DisableTheming; | |
42 | + procedure EnableTheming; | |
43 | + protected | |
44 | + procedure InitVersionNodes; virtual; | |
45 | + public | |
46 | + constructor Create(const _ManifestFile: string; const _InputFile: string = ''); reintroduce; | |
47 | + end; | |
48 | + | |
49 | +implementation | |
50 | + | |
51 | +{$R *.dfm} | |
52 | + | |
53 | +uses | |
54 | + StrUtils, | |
55 | + u_dzFileUtils, | |
56 | + u_dzStringUtils, | |
57 | + u_dzVariantUtils, | |
58 | + u_dzConvertUtils, | |
59 | + u_dzTranslator; | |
60 | + | |
61 | +{ Tdm_ManifestVersionInfo } | |
62 | + | |
63 | +constructor Tdm_ManifestVersionInfo.Create(const _ManifestFile: string; const _InputFile: string = ''); | |
64 | +begin | |
65 | + inherited Create(nil); | |
66 | + | |
67 | + FOutputFilename := ChangeFileExt(_ManifestFile, '.manifest'); | |
68 | + FInputFilename := _InputFile; | |
69 | + if FInputFilename = '' then | |
70 | + FInputFilename := FOutputFilename; | |
71 | + | |
72 | + TFileSystem.FileExists(FInputFilename, True); | |
73 | + | |
74 | + ProjDoc.Options := ProjDoc.Options + [doNodeAutoIndent] - [doNodeAutoCreate, doAttrNull, doAutoSave]; | |
75 | + ProjDoc.FileName := FInputFilename; | |
76 | + ProjDoc.Active := True; | |
77 | + | |
78 | + InitVersionNodes; | |
79 | +end; | |
80 | + | |
81 | +//procedure EnumNodes(_Root: IXMLNode; const _Indent: string = ''); | |
82 | +//var | |
83 | +// i: Integer; | |
84 | +//begin | |
85 | +// WriteLn(_Indent, _Root.NodeName); | |
86 | +// for i := 0 to _Root.AttributeNodes.Count - 1 do begin | |
87 | +// WriteLn(_Indent, ':', _Root.AttributeNodes[i].NodeName, '=', _Root.AttributeNodes[i].NodeValue); | |
88 | +// end; | |
89 | +// for i := 0 to _Root.ChildNodes.Count - 1 do begin | |
90 | +// EnumNodes(_Root.ChildNodes.Nodes[i], _Indent + ' '); | |
91 | +// end; | |
92 | +//end; | |
93 | + | |
94 | +function Tdm_ManifestVersionInfo.FindComCtlNode(out _DependentAssemblyNode: IXMLNode): boolean; | |
95 | +var | |
96 | + AssemblyNode: IXMLNode; | |
97 | + DependencyNode: IXMLNode; | |
98 | + DependentAssemblyNode: IXMLNode; | |
99 | + AssemblyIdentityNode: IXMLNode; | |
100 | +begin | |
101 | + Result := False; | |
102 | + AssemblyNode := ProjDoc.DocumentElement; | |
103 | + DependencyNode := AssemblyNode.ChildNodes.FindNode('dependency'); | |
104 | + while Assigned(DependencyNode) do begin | |
105 | + DependentAssemblyNode := DependencyNode.ChildNodes.FindNode('dependentAssembly'); | |
106 | + if not Assigned(DependentAssemblyNode) then begin | |
107 | + // This is an error: | |
108 | + // According to https://docs.microsoft.com/en-us/windows/desktop/sbscs/application-manifests | |
109 | + // the dependency node must contain at least one dependendAssembly node. | |
110 | + Exit; //==> | |
111 | + end; | |
112 | + AssemblyIdentityNode := DependentAssemblyNode.ChildNodes.FindNode('assemblyIdentity'); | |
113 | + if not Assigned(AssemblyIdentityNode) then begin | |
114 | + // This is an error: | |
115 | + // According to https://docs.microsoft.com/en-us/windows/desktop/sbscs/application-manifests | |
116 | + // the dependendAssembly node must contain exactly one assemblyIdentityNode node. | |
117 | + Exit; //==> | |
118 | + end; | |
119 | + if not AssemblyIdentityNode.HasAttribute('name') then begin | |
120 | + // this is an error | |
121 | + Exit; | |
122 | + end; | |
123 | + if AssemblyIdentityNode.Attributes['name'] = 'Microsoft.Windows.Common-Controls' then begin | |
124 | + Result := True; | |
125 | + _DependentAssemblyNode := DependentAssemblyNode; | |
126 | + Exit; //==> | |
127 | + end; | |
128 | + DependentAssemblyNode := nil; | |
129 | + DependencyNode := DependencyNode.NextSibling; | |
130 | + end; | |
131 | +end; | |
132 | + | |
133 | +procedure Tdm_ManifestVersionInfo.DisableTheming; | |
134 | +var | |
135 | + DependentAssemblyNode: IXMLNode; | |
136 | + DependencyNode: IXMLNode; | |
137 | + AssemblyNode: IXMLNode; | |
138 | + DependencyIdx: Integer; | |
139 | +begin | |
140 | + if not FindComCtlNode(DependentAssemblyNode) then begin | |
141 | + // Node does not exist, so theming is already disabled | |
142 | + Exit; //==> | |
143 | + end; | |
144 | + | |
145 | + AssemblyNode := ProjDoc.DocumentElement; | |
146 | + DependencyNode := DependentAssemblyNode.ParentNode; | |
147 | + DependentAssemblyNode := nil; | |
148 | + | |
149 | + DependencyIdx := AssemblyNode.ChildNodes.IndexOf(DependencyNode); | |
150 | + AssemblyNode.ChildNodes.Delete(DependencyIdx); | |
151 | +end; | |
152 | + | |
153 | +procedure Tdm_ManifestVersionInfo.EnableTheming; | |
154 | +var | |
155 | + DependentAssemblyNode: IXMLNode; | |
156 | + DependencyNode: IXMLNode; | |
157 | + AssemblyNode: IXMLNode; | |
158 | + DescriptionIdx: Integer; | |
159 | +begin | |
160 | + if FindComCtlNode(DependentAssemblyNode) then begin | |
161 | + // Node already exists, so theming is already enabled | |
162 | + Exit; //==> | |
163 | + end; | |
164 | + | |
165 | + AssemblyNode := ProjDoc.DocumentElement; | |
166 | + | |
167 | + // we must insert the dependency element before the description element, otherwise the application won't start | |
168 | + DescriptionIdx := AssemblyNode.ChildNodes.IndexOf('description'); | |
169 | + | |
170 | + DependencyNode := AssemblyNode.AddChild('dependency', DescriptionIdx); | |
171 | + DependentAssemblyNode := DependencyNode.AddChild('dependentAssembly'); | |
172 | + DependentAssemblyNode.Attributes['type'] := 'win32'; | |
173 | + DependentAssemblyNode.Attributes['name'] := 'Microsoft.Windows.Common-Controls'; | |
174 | + DependentAssemblyNode.Attributes['version'] := '6.0.0.0'; | |
175 | + DependentAssemblyNode.Attributes['publicKeyToken'] := '6595b64144ccf1df'; | |
176 | + DependentAssemblyNode.Attributes['language'] := '*'; | |
177 | + DependentAssemblyNode.Attributes['processorArchitecture'] := '*'; | |
178 | +end; | |
179 | + | |
180 | +procedure Tdm_ManifestVersionInfo.InitVersionNodes; | |
181 | +var | |
182 | + AssemblyNode: IXMLNode; | |
183 | +begin | |
184 | + AssemblyNode := ProjDoc.DocumentElement; | |
185 | + | |
186 | + FAssemblyIdentityNode := AssemblyNode.ChildNodes['assemblyIdentity']; | |
187 | + FDescriptionNode := AssemblyNode.ChildNodes['description']; | |
188 | +end; | |
189 | + | |
190 | +function Tdm_ManifestVersionInfo.VerInfoFilename: string; | |
191 | +begin | |
192 | + Result := FOutputFilename; | |
193 | +end; | |
194 | + | |
195 | +procedure Tdm_ManifestVersionInfo.ReadFromFile(_VerInfo: TVersionInfo); | |
196 | +var | |
197 | + Version: string; | |
198 | + Major: string; | |
199 | + Minor: string; | |
200 | + Release: string; | |
201 | + Build: string; | |
202 | +begin | |
203 | + raise Exception.Create(_('Reading version info from Manifest files is not supported.')); | |
204 | + | |
205 | + _VerInfo.Source := VerInfoFilename; | |
206 | + _VerInfo.InternalName := Var2Str(FAssemblyIdentityNode.Attributes['name'], ''); | |
207 | + Version := Var2Str(FAssemblyIdentityNode.Attributes['version'], ''); | |
208 | + _VerInfo.FileVersion := Version; | |
209 | + _VerInfo.FileDescription := FDescriptionNode.Text; | |
210 | + Major := ExtractStr(Version, '.'); | |
211 | + Minor := ExtractStr(Version, '.'); | |
212 | + Release := ExtractStr(Version, '.'); | |
213 | + Build := ExtractStr(Version, '.'); | |
214 | + _VerInfo.MajorVer := StrToIntDef(Major, 0); | |
215 | + _VerInfo.MinorVer := StrToIntDef(Minor, 0); | |
216 | + _VerInfo.Release := StrToIntDef(Release, 0); | |
217 | + _VerInfo.Build := StrToIntDef(Build, 0); | |
218 | +end; | |
219 | + | |
220 | +procedure Tdm_ManifestVersionInfo.WriteToFile(_VerInfo: TVersionInfo); | |
221 | +begin | |
222 | + if _VerInfo.InternalName = '' then | |
223 | + raise Exception.Create(_('InternalName must not be empty because assemblyIdentity.name requires a value')); | |
224 | + if _VerInfo.FileVersion = '' then | |
225 | + raise Exception.Create(_('FileVersion must not be empty because assemblyIdentity.version requires a value')); | |
226 | + FAssemblyIdentityNode.Attributes['name'] := _VerInfo.InternalName; | |
227 | + FAssemblyIdentityNode.Attributes['version'] := _VerInfo.FileVersion; | |
228 | + FDescriptionNode.Text := _VerInfo.FileDescription; | |
229 | + ProjDoc.SaveToFile(FOutputFilename); | |
230 | +end; | |
231 | + | |
232 | +// standard TInterfacedObject implementation of IInterface | |
233 | + | |
234 | +function Tdm_ManifestVersionInfo.QueryInterface(const IID: TGUID; out Obj): HResult; | |
235 | +begin | |
236 | + if GetInterface(IID, Obj) then | |
237 | + Result := S_OK | |
238 | + else | |
239 | + Result := E_NOINTERFACE | |
240 | +end; | |
241 | + | |
242 | +function Tdm_ManifestVersionInfo._AddRef: Integer; | |
243 | +begin | |
244 | + Result := InterlockedIncrement(FRefCount); | |
245 | +end; | |
246 | + | |
247 | +function Tdm_ManifestVersionInfo._Release: Integer; | |
248 | +begin | |
249 | + Result := InterlockedDecrement(FRefCount); | |
250 | + if Result = 0 then | |
251 | + Destroy; | |
252 | +end; | |
253 | + | |
254 | +end. | |
255 | + |
@@ -0,0 +1,225 @@ | ||
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 | + function GetChildNodeContent(_Parent: IXMLNode; const _NodeName, _AttrName: string): string; | |
21 | + function GetVersionInfo(const _Name: string): string; | |
22 | + function GetVersionInfoKey(const _Name: string): string; | |
23 | + procedure SetChildNodeContent(_Parent: IXMLNode; const _NodeName, _AttrName, _Value: string); | |
24 | + procedure SetVersionInfo(const _Name, _Value: string); | |
25 | + procedure SetVersionInfoKey(const _Name, _Value: string); | |
26 | + protected // IInterface | |
27 | + FRefCount: Integer; | |
28 | + function QueryInterface(const IID: TGUID; out Obj): HResult; override; stdcall; | |
29 | + function _AddRef: Integer; stdcall; | |
30 | + function _Release: Integer; stdcall; | |
31 | + protected // implementation of IVersionInfo | |
32 | + function VerInfoFilename: string; | |
33 | + procedure ReadFromFile(_VerInfo: TVersionInfo); | |
34 | + procedure WriteToFile(_VerInfo: TVersionInfo); | |
35 | + protected | |
36 | + FXmlFilename: string; | |
37 | + FProjectName: string; | |
38 | + FVersionInfo: IXMLNode; | |
39 | + FVersionInfoKeys: IXMLNode; | |
40 | + procedure InitVersionNodes; virtual; abstract; | |
41 | + public | |
42 | + ///<summary> | |
43 | + /// reads a XML formatted project file (.bdsproj or .dproj) | |
44 | + /// @param FullFilename is the name of the file to read | |
45 | + /// @param ProjectName is the name of the Delphi project without path and extension | |
46 | + /// | |
47 | + constructor Create(const _FullFilename: string; const _ProjectName: string); reintroduce; | |
48 | + destructor Destroy; override; | |
49 | + end; | |
50 | + | |
51 | +implementation | |
52 | + | |
53 | +{$R *.dfm} | |
54 | + | |
55 | +uses | |
56 | + StrUtils, | |
57 | + u_dzTranslator; | |
58 | + | |
59 | +{ Tdm_XmlVersionInfo } | |
60 | + | |
61 | +function Tdm_XmlVersionInfo.GetChildNodeContent(_Parent: IXMLNode; const _NodeName, _AttrName: string): string; | |
62 | +var | |
63 | + Node: IXMLNode; | |
64 | +begin | |
65 | + // <VersionInfo Name="IncludeVerInfo">True</VersionInfo> | |
66 | + Node := _Parent.ChildNodes.First; | |
67 | + while Assigned(Node) do begin | |
68 | + if Node.nodeName = _NodeName then begin | |
69 | + if SameText(Node.Attributes['Name'], _AttrName) then begin | |
70 | + Result := Node.Text; | |
71 | + Exit; | |
72 | + end; | |
73 | + end; | |
74 | + Node := Node.nextSibling; | |
75 | + end; | |
76 | +end; | |
77 | + | |
78 | +function Tdm_XmlVersionInfo.GetVersionInfo(const _Name: string): string; | |
79 | +begin | |
80 | + Result := GetChildNodeContent(FVersionInfo, 'VersionInfo', _Name); | |
81 | +end; | |
82 | + | |
83 | +function Tdm_XmlVersionInfo.GetVersionInfoKey(const _Name: string): string; | |
84 | +begin | |
85 | + Result := GetChildNodeContent(FVersionInfoKeys, 'VersionInfoKeys', _Name); | |
86 | +end; | |
87 | + | |
88 | +procedure Tdm_XmlVersionInfo.SetChildNodeContent(_Parent: IXMLNode; const _NodeName, _AttrName, _Value: string); | |
89 | +var | |
90 | + Node: IXMLNode; | |
91 | +begin | |
92 | + // <*NodeName* Name="*AttrName*">*Value*</VersionInfo> | |
93 | + Node := _Parent.ChildNodes.First; | |
94 | + while Assigned(Node) do begin | |
95 | + if Node.nodeName = _NodeName then begin | |
96 | + if SameText(Node.Attributes['Name'], _AttrName) then begin | |
97 | + Node.Text := _Value; | |
98 | + Exit; | |
99 | + end; | |
100 | + end; | |
101 | + Node := Node.nextSibling; | |
102 | + end; | |
103 | +end; | |
104 | + | |
105 | +constructor Tdm_XmlVersionInfo.Create(const _FullFilename: string; const _ProjectName: string); | |
106 | +begin | |
107 | + inherited Create(nil); | |
108 | + FXmlFilename := _FullFilename; | |
109 | + FProjectName := _ProjectName; | |
110 | + | |
111 | + ProjDoc.FileName := FXmlFilename; | |
112 | + ProjDoc.Active := True; | |
113 | + | |
114 | + InitVersionNodes; | |
115 | + | |
116 | + if not SameText(GetChildNodeContent(FVersionInfo, 'VersionInfo', 'IncludeVerInfo'), 'True') then | |
117 | + raise ENoVersionInfo.CreateFmt(_('File "%s" does not contain version information'), | |
118 | + [FXmlFilename]); | |
119 | +end; | |
120 | + | |
121 | +destructor Tdm_XmlVersionInfo.Destroy; | |
122 | +begin | |
123 | + FVersionInfo := nil; | |
124 | + inherited; | |
125 | +end; | |
126 | + | |
127 | +procedure Tdm_XmlVersionInfo.ReadFromFile(_VerInfo: TVersionInfo); | |
128 | +begin | |
129 | + _VerInfo.Source := VerInfoFilename; | |
130 | + | |
131 | + _VerInfo.ProjectName := FProjectName; | |
132 | + | |
133 | + _VerInfo.AutoIncBuild := SameText(GetVersionInfo('AutoIncBuild'), 'True'); | |
134 | + | |
135 | + _VerInfo.MajorVer := StrToIntDef(GetVersionInfo('MajorVer'), 0); | |
136 | + _VerInfo.MinorVer := StrToIntDef(GetVersionInfo('MinorVer'), 0); | |
137 | + _VerInfo.Release := StrToIntDef(GetVersionInfo('Release'), 0); | |
138 | + _VerInfo.Build := StrToIntDef(GetVersionInfo('Build'), 0); | |
139 | + | |
140 | + _VerInfo.Comments := GetVersionInfoKey('Comments'); | |
141 | + _VerInfo.CompanyName := GetVersionInfoKey('CompanyName'); | |
142 | + _VerInfo.FileDescription := GetVersionInfoKey('FileDescription'); | |
143 | + _VerInfo.FileVersion := GetVersionInfoKey('FileVersion'); | |
144 | + _VerInfo.InternalName := GetVersionInfoKey('InternalName'); | |
145 | + _VerInfo.LegalCopyRight := GetVersionInfoKey('LegalCopyright'); | |
146 | + _VerInfo.LegalTrademarks := GetVersionInfoKey('LegalTrademarks'); | |
147 | + _VerInfo.OriginalFilename := GetVersionInfoKey('OriginalFilename'); | |
148 | + _VerInfo.ProductName := GetVersionInfoKey('ProductName'); | |
149 | + _VerInfo.ProductVersion := GetVersionInfoKey('ProductVersion'); | |
150 | + _VerInfo.SCMRevision := GetVersionInfoKey('Revision'); | |
151 | + _VerInfo.BuildDateTime := GetVersionInfoKey('BuildDateTime'); | |
152 | + | |
153 | + _VerInfo.IsPrivateBuild := StrToBool(GetVersionInfo('Private')); | |
154 | + _VerInfo.IsSpecialBuild := StrToBool(GetVersionInfo('Special')); | |
155 | + _VerInfo.PrivateBuildComments := GetVersionInfoKey('PrivateBuild'); | |
156 | + _VerInfo.SpecialBuildComments := GetVersionInfoKey('SpecialBuild'); | |
157 | +end; | |
158 | + | |
159 | +procedure Tdm_XmlVersionInfo.WriteToFile(_VerInfo: TVersionInfo); | |
160 | +begin | |
161 | + SetVersionInfo('AutoIncBuild', IfThen(_VerInfo.AutoIncBuild, 'True', 'False')); | |
162 | + SetVersionInfo('Build', IntToStr(_VerInfo.Build)); | |
163 | + SetVersionInfoKey('Comments', _VerInfo.Comments); | |
164 | + SetVersionInfoKey('CompanyName', _VerInfo.CompanyName); | |
165 | + SetVersionInfoKey('FileDescription', _VerInfo.FileDescription); | |
166 | + SetVersionInfoKey('FileVersion', _VerInfo.FileVersion); | |
167 | + SetVersionInfoKey('InternalName', _VerInfo.InternalName); | |
168 | + SetVersionInfoKey('LegalCopyright', _VerInfo.LegalCopyRight); | |
169 | + SetVersionInfoKey('LegalTrademarks', _VerInfo.LegalTrademarks); | |
170 | + SetVersionInfo('MajorVer', IntToStr(_VerInfo.MajorVer)); | |
171 | + SetVersionInfo('MinorVer', IntToStr(_VerInfo.MinorVer)); | |
172 | + SetVersionInfoKey('OriginalFilename', _VerInfo.OriginalFilename); | |
173 | + SetVersionInfoKey('ProductName', _VerInfo.ProductName); | |
174 | + SetVersionInfoKey('ProductVersion', _VerInfo.ProductVersion); | |
175 | + SetVersionInfo('Release', IntToStr(_VerInfo.Release)); | |
176 | + SetVersionInfo('Revision', _VerInfo.SCMRevision); | |
177 | + SetVersionInfoKey('BuildDateTime', _VerInfo.BuildDateTime); | |
178 | + | |
179 | + SetVersionInfo('Private', BoolToStr(_VerInfo.IsPrivateBuild, True)); | |
180 | + SetVersionInfo('Special', BoolToStr(_VerInfo.IsSpecialBuild, True)); | |
181 | + SetVersionInfoKey('PrivateBuild', _VerInfo.PrivateBuildComments); | |
182 | + SetVersionInfoKey('SpecialBuild', _VerInfo.SpecialBuildComments); | |
183 | + | |
184 | + ProjDoc.SaveToFile(FXmlFilename); | |
185 | +end; | |
186 | + | |
187 | +procedure Tdm_XmlVersionInfo.SetVersionInfo(const _Name, _Value: string); | |
188 | +begin | |
189 | + SetChildNodeContent(FVersionInfo, 'VersionInfo', _Name, _Value); | |
190 | +end; | |
191 | + | |
192 | +procedure Tdm_XmlVersionInfo.SetVersionInfoKey(const _Name, _Value: string); | |
193 | +begin | |
194 | + SetChildNodeContent(FVersionInfoKeys, 'VersionInfoKeys', _Name, _Value); | |
195 | +end; | |
196 | + | |
197 | +function Tdm_XmlVersionInfo.VerInfoFilename: string; | |
198 | +begin | |
199 | + Result := FXmlFilename; | |
200 | +end; | |
201 | + | |
202 | +// standard TInterfacedObject implementation of IInterface | |
203 | + | |
204 | +function Tdm_XmlVersionInfo.QueryInterface(const IID: TGUID; out Obj): HResult; | |
205 | +begin | |
206 | + if GetInterface(IID, Obj) then | |
207 | + Result := S_OK | |
208 | + else | |
209 | + Result := E_NOINTERFACE | |
210 | +end; | |
211 | + | |
212 | +function Tdm_XmlVersionInfo._AddRef: Integer; | |
213 | +begin | |
214 | + Result := InterlockedIncrement(FRefCount); | |
215 | +end; | |
216 | + | |
217 | +function Tdm_XmlVersionInfo._Release: Integer; | |
218 | +begin | |
219 | + Result := InterlockedDecrement(FRefCount); | |
220 | + if Result = 0 then | |
221 | + Destroy; | |
222 | +end; | |
223 | + | |
224 | +end. | |
225 | + |
@@ -0,0 +1,24 @@ | ||
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 | + ///<summary> | |
15 | + /// @returns the name of the file the version info is read from / written to </summary> | |
16 | + function VerInfoFilename: string; | |
17 | + procedure ReadFromFile(_VerInfo: TVersionInfo); | |
18 | + procedure WriteToFile(_VerInfo: TVersionInfo); | |
19 | + end; | |
20 | + | |
21 | +implementation | |
22 | + | |
23 | +end. | |
24 | + |
@@ -0,0 +1,155 @@ | ||
1 | +unit u_CentralIniVersionInfo; | |
2 | + | |
3 | +interface | |
4 | + | |
5 | +uses | |
6 | + i_VersionInfoAccess, | |
7 | + u_IniVersionInfo; | |
8 | + | |
9 | +type | |
10 | + ///<summary> | |
11 | + /// This is a specialized descendant of TIniVersionInfo which | |
12 | + /// allows any entry of the file to redirect to a different file. | |
13 | + /// This can be done for single entries or for a whole section. | |
14 | + /// For redirecting a single entry, the value must contain a string | |
15 | + /// REDIRECT:<filename>,<section><entry> | |
16 | + /// For redirecting a section it must contain only one entry | |
17 | + /// redirect=<filename>,<section> | |
18 | + /// These redirections will be used for reading and writing, that is it can be | |
19 | + /// used to maintain/increment a central build number for several branches of | |
20 | + /// a project where the files have different version numbers but the build | |
21 | + /// number should be increased for a build of any of these versions. </summary> | |
22 | + TCentralIniVersionInfo = class(TIniVersionInfo, IVersionInfoAccess) | |
23 | + private | |
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 | + ///<summary> | |
32 | + /// Creates a TCentralVersionInfo instance | |
33 | + /// @param ProjectBaseFn is the name of the project (.dpr file without extension) | |
34 | + /// The constructor appends "_Version.ini" to this | |
35 | + /// name and tries to open the file } | |
36 | + constructor Create(const _ProjectBaseFn: string); | |
37 | + end; | |
38 | + | |
39 | +implementation | |
40 | + | |
41 | +uses | |
42 | + SysUtils, | |
43 | + IniFiles, | |
44 | + u_dzStringUtils; | |
45 | + | |
46 | +const | |
47 | + VERSION_INFO_SECTION = 'Version Info'; | |
48 | + VERSION_INFO_KEYS_SECTION = 'Version Info Keys'; | |
49 | + | |
50 | +{ TCentralVersionInfo } | |
51 | + | |
52 | +constructor TCentralIniVersionInfo.Create(const _ProjectBaseFn: string); | |
53 | +begin | |
54 | + inherited Create(ChangeFileExt(_ProjectBaseFn, '_Version.ini'), | |
55 | + ExtractFileName(_ProjectBaseFn), | |
56 | + VERSION_INFO_SECTION, VERSION_INFO_KEYS_SECTION); | |
57 | +end; | |
58 | + | |
59 | +procedure TCentralIniVersionInfo.AdjustFilename(var _Filename: string); | |
60 | +var | |
61 | + Path: string; | |
62 | +begin | |
63 | + Path := ExtractFilePath(_Filename); | |
64 | + if (Path = '') or ((Path[1] <> '\') and (Copy(Path, 2, 1) <> ':')) then begin | |
65 | + // Path is relative, so make it relative to the main .ini file | |
66 | + _Filename := ExtractFilePath(FIniFilename) + _Filename; | |
67 | + end; | |
68 | +end; | |
69 | + | |
70 | +procedure TCentralIniVersionInfo.GetRedirSectionInfo(_Redir: string; out _Filename, _Section: string); | |
71 | +begin | |
72 | + _Filename := ExtractStr(_Redir, ','); | |
73 | + _Section := _Redir; | |
74 | + AdjustFilename(_Filename); | |
75 | +end; | |
76 | + | |
77 | +procedure TCentralIniVersionInfo.GetRedirIdentInfo(const _RedirString: string; | |
78 | + out _Filename, _Section, _Ident: string); | |
79 | +var | |
80 | + Redir: string; | |
81 | +begin | |
82 | + Redir := Copy(_RedirString, Length('redirect:') + 1); | |
83 | + _Filename := ExtractStr(Redir, ','); | |
84 | + _Section := ExtractStr(Redir, ','); | |
85 | + _Ident := Redir; | |
86 | + AdjustFilename(_Filename); | |
87 | +end; | |
88 | + | |
89 | +function TCentralIniVersionInfo.ReadString(const _Section, _Ident: string; _Default: string): string; | |
90 | +var | |
91 | + Redir: string; | |
92 | + IniFile: TMemIniFile; | |
93 | + FileName: string; | |
94 | + Section: string; | |
95 | + Ident: string; | |
96 | +begin | |
97 | + Redir := FIniFile.ReadString(_Section, 'redirect', ''); | |
98 | + if Redir = '' then begin | |
99 | + Result := FIniFile.ReadString(_Section, _Ident, _Default); | |
100 | + if UStartsWith('redirect:', Result) then begin | |
101 | + GetRedirIdentInfo(Result, FileName, Section, Ident); | |
102 | + IniFile := TMemIniFile.Create(FileName); | |
103 | + try | |
104 | + Result := IniFile.ReadString(Section, Ident, _Default); | |
105 | + finally | |
106 | + IniFile.Free; | |
107 | + end; | |
108 | + end; | |
109 | + end else begin | |
110 | + GetRedirSectionInfo(Redir, FileName, Section); | |
111 | + IniFile := TMemIniFile.Create(FileName); | |
112 | + try | |
113 | + Result := IniFile.ReadString(Section, _Ident, _Default); | |
114 | + finally | |
115 | + IniFile.Free; | |
116 | + end; | |
117 | + end; | |
118 | +end; | |
119 | + | |
120 | +procedure TCentralIniVersionInfo.WriteString(const _Section, _Ident: string; _Value: string); | |
121 | +var | |
122 | + Redir: string; | |
123 | + IniFile: TMemIniFile; | |
124 | + FileName: string; | |
125 | + Section: string; | |
126 | + Ident: string; | |
127 | +begin | |
128 | + Redir := FIniFile.ReadString(_Section, 'redirect', ''); | |
129 | + if Redir = '' then begin | |
130 | + Redir := FIniFile.ReadString(_Section, _Ident, ''); | |
131 | + if UStartsWith('redirect:', Redir) then begin | |
132 | + GetRedirIdentInfo(Redir, FileName, Section, Ident); | |
133 | + IniFile := TMemIniFile.Create(FileName); | |
134 | + try | |
135 | + IniFile.WriteString(Section, Ident, _Value); | |
136 | + IniFile.UpdateFile; | |
137 | + finally | |
138 | + IniFile.Free; | |
139 | + end; | |
140 | + end else | |
141 | + FIniFile.WriteString(_Section, _Ident, _Value); | |
142 | + end else begin | |
143 | + GetRedirSectionInfo(Redir, FileName, Section); | |
144 | + IniFile := TMemIniFile.Create(FileName); | |
145 | + try | |
146 | + IniFile.WriteString(Section, _Ident, _Value); | |
147 | + IniFile.UpdateFile; | |
148 | + finally | |
149 | + IniFile.Free; | |
150 | + end; | |
151 | + end; | |
152 | +end; | |
153 | + | |
154 | +end. | |
155 | + |
@@ -0,0 +1,54 @@ | ||
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 | + FProjectBaseFn: string; | |
18 | + public | |
19 | + {: Creates a TDofVersionInfo instance. Succeeds, if the file exists | |
20 | + and IncludeVerInfo is <> 0 | |
21 | + @param ProjectBaseFn is the full project file 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 _ProjectBaseFn: 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 _ProjectBaseFn: string); | |
40 | +begin | |
41 | + FProjectBaseFn := _ProjectBaseFn; | |
42 | + inherited Create(FilenameFor(_ProjectBaseFn), ExtractFileName(_ProjectBaseFn), | |
43 | + VERSION_INFO_SECTION, VERSION_INFO_KEYS_SECTION); | |
44 | + if FIniFile.ReadInteger(VERSION_INFO_SECTION, 'IncludeVerInfo', 0) <> 1 then | |
45 | + raise ENoVersionInfo.Create(_('.dof file does not contain version info')); | |
46 | +end; | |
47 | + | |
48 | +class function TDofVersionInfo.FilenameFor(const _ProjectName: string): string; | |
49 | +begin | |
50 | + Result := ChangeFileExt(_ProjectName, '.dof'); | |
51 | +end; | |
52 | + | |
53 | +end. | |
54 | + |
@@ -0,0 +1,182 @@ | ||
1 | +unit u_IniVersionInfo; | |
2 | + | |
3 | +interface | |
4 | + | |
5 | +uses | |
6 | + SysUtils, | |
7 | + IniFiles, | |
8 | + u_VersionInfo; | |
9 | + | |
10 | +type | |
11 | + TIniVersionInfo = class(TInterfacedObject) | |
12 | + protected | |
13 | + FIniFile: TMemIniFile; | |
14 | + FInfoSection: string; | |
15 | + FInfoKeysSection: string; | |
16 | + function ReadInteger(const _Section, _Ident: string; _Default: Integer): Integer; virtual; | |
17 | + procedure WriteInteger(const _Section, _Ident: string; _Value: Integer); virtual; | |
18 | + function ReadString(const _Section, _Ident: string; _Default: string): string; virtual; | |
19 | + procedure WriteString(const _Section, _Ident: string; _Value: string); virtual; | |
20 | + function ReadBool(const _Section, _Ident: string; _Default: Boolean): Boolean; virtual; | |
21 | + procedure WriteBool(const _Section, _Ident: string; _Value: Boolean); virtual; | |
22 | + protected | |
23 | + FIniFilename: string; | |
24 | + FProjectName: string; | |
25 | + protected // implement IVersionInfoAccess | |
26 | + function VerInfoFilename: string; | |
27 | + procedure ReadFromFile(_VerInfo: TVersionInfo); | |
28 | + procedure WriteToFile(_VerInfo: TVersionInfo); | |
29 | + public | |
30 | + ///<summary> | |
31 | + /// Creates a TIniVersionInfo instance. | |
32 | + /// @param FullFilename is the full filename including path and extension of | |
33 | + /// file to use | |
34 | + /// @param ProjectName is the name of the Delphi project, without path and extension | |
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 | + /// @raises ENoVersionInfo if the file does not exist or does not contain | |
42 | + /// the specified sections </summary> | |
43 | + constructor Create(const _FullFilename: string; const _ProjectName: string; | |
44 | + const _InfoSection: string; const _InfoKeysSection: string); | |
45 | + destructor Destroy; override; | |
46 | + end; | |
47 | + | |
48 | +implementation | |
49 | + | |
50 | +uses | |
51 | + u_dzTranslator, | |
52 | + i_VersionInfoAccess; | |
53 | + | |
54 | +{ TIniVersionInfo } | |
55 | + | |
56 | +constructor TIniVersionInfo.Create(const _FullFilename: string; const _ProjectName: string; | |
57 | + const _InfoSection: string; const _InfoKeysSection: string); | |
58 | +begin | |
59 | + inherited Create; | |
60 | + FIniFilename := _FullFilename; | |
61 | + if not FileExists(_FullFilename) then | |
62 | + raise ENoVersionInfo.CreateFmt(_('File "%s" does not exist.'), [_FullFilename]); | |
63 | + FProjectName := _ProjectName; | |
64 | + FInfoSection := _InfoSection; | |
65 | + FInfoKeysSection := _InfoKeysSection; | |
66 | + FIniFile := TMemIniFile.Create(_FullFilename); | |
67 | + | |
68 | + if not FIniFile.SectionExists(FInfoSection) then | |
69 | + raise ENoVersionInfo.CreateFmt(_('File "%s" does contain a [%s] section'), | |
70 | + [_FullFilename, FInfoSection]); | |
71 | + | |
72 | + if not FIniFile.SectionExists(FInfoKeysSection) then | |
73 | + raise ENoVersionInfo.CreateFmt(_('File "%s" does contain a [%s] section'), | |
74 | + [_FullFilename, FInfoKeysSection]); | |
75 | +end; | |
76 | + | |
77 | +destructor TIniVersionInfo.Destroy; | |
78 | +begin | |
79 | + FIniFile.Free; | |
80 | + inherited; | |
81 | +end; | |
82 | + | |
83 | +function TIniVersionInfo.ReadBool(const _Section, _Ident: string; _Default: Boolean): Boolean; | |
84 | +begin | |
85 | + Result := 0 <> ReadInteger(_Section, _Ident, Ord(_Default)); | |
86 | +end; | |
87 | + | |
88 | +function TIniVersionInfo.ReadInteger(const _Section, _Ident: string; _Default: Integer): Integer; | |
89 | +var | |
90 | + s: string; | |
91 | +begin | |
92 | + s := ReadString(_Section, _Ident, IntToStr(_Default)); | |
93 | + if not TryStrToInt(s, Result) then | |
94 | + Result := _Default; | |
95 | +end; | |
96 | + | |
97 | +function TIniVersionInfo.ReadString(const _Section, _Ident: string; _Default: string): string; | |
98 | +begin | |
99 | + Result := FIniFile.ReadString(_Section, _Ident, _Default); | |
100 | +end; | |
101 | + | |
102 | +function TIniVersionInfo.VerInfoFilename: string; | |
103 | +begin | |
104 | + Result := FIniFilename; | |
105 | +end; | |
106 | + | |
107 | +procedure TIniVersionInfo.WriteBool(const _Section, _Ident: string; _Value: Boolean); | |
108 | +begin | |
109 | + WriteInteger(_Section, _Ident, Ord(_Value)); | |
110 | +end; | |
111 | + | |
112 | +procedure TIniVersionInfo.WriteInteger(const _Section, _Ident: string; _Value: Integer); | |
113 | +begin | |
114 | + WriteString(_Section, _Ident, IntToStr(_Value)); | |
115 | +end; | |
116 | + | |
117 | +procedure TIniVersionInfo.WriteString(const _Section, _Ident: string; _Value: string); | |
118 | +begin | |
119 | + FIniFile.WriteString(_Section, _Ident, _Value); | |
120 | +end; | |
121 | + | |
122 | +procedure TIniVersionInfo.ReadFromFile(_VerInfo: TVersionInfo); | |
123 | +begin | |
124 | + _VerInfo.Source := VerInfoFilename; | |
125 | + _VerInfo.ProjectName := FProjectName; | |
126 | + | |
127 | + _VerInfo.AutoIncBuild := ReadBool(FInfoSection, 'AutoIncBuild', False); | |
128 | + | |
129 | + _VerInfo.Build := ReadInteger(FInfoSection, 'Build', 0); | |
130 | + _VerInfo.MajorVer := ReadInteger(FInfoSection, 'MajorVer', 0); | |
131 | + _VerInfo.MinorVer := ReadInteger(FInfoSection, 'MinorVer', 0); | |
132 | + _VerInfo.Release := ReadInteger(FInfoSection, 'Release', 0); | |
133 | + | |
134 | + _VerInfo.Comments := ReadString(FInfoKeysSection, 'Comments', ''); | |
135 | + _VerInfo.CompanyName := ReadString(FInfoKeysSection, 'CompanyName', ''); | |
136 | + _VerInfo.FileDescription := ReadString(FInfoKeysSection, 'FileDescription', ''); | |
137 | + _VerInfo.FileVersion := ReadString(FInfoKeysSection, 'FileVersion', ''); | |
138 | + _VerInfo.InternalName := ReadString(FInfoKeysSection, 'InternalName', ''); | |
139 | + _VerInfo.LegalCopyRight := ReadString(FInfoKeysSection, 'LegalCopyright', ''); | |
140 | + _VerInfo.LegalTrademarks := ReadString(FInfoKeysSection, 'LegalTrademarks', ''); | |
141 | + _VerInfo.OriginalFilename := ReadString(FInfoKeysSection, 'OriginalFilename', ''); | |
142 | + _VerInfo.ProductName := ReadString(FInfoKeysSection, 'ProductName', ''); | |
143 | + _VerInfo.ProductVersion := ReadString(FInfoKeysSection, 'ProductVersion', ''); | |
144 | + _VerInfo.SCMRevision := ReadString(FInfoKeysSection, 'Revision', ''); | |
145 | + _VerInfo.BuildDateTime := ReadString(FInfoKeysSection, 'BuildDateTime', ''); | |
146 | + | |
147 | + _VerInfo.IsPrivateBuild := ReadBool(FInfoSection, 'Private', False); | |
148 | + _VerInfo.IsSpecialBuild := ReadBool(FInfoSection, 'Special', False); | |
149 | + _VerInfo.PrivateBuildComments := ReadString(FInfoKeysSection, 'PrivateBuild', ''); | |
150 | + _VerInfo.SpecialBuildComments := ReadString(FInfoKeysSection, 'SpecialBuild', ''); | |
151 | +end; | |
152 | + | |
153 | +procedure TIniVersionInfo.WriteToFile(_VerInfo: TVersionInfo); | |
154 | +begin | |
155 | + WriteBool(FInfoSection, 'AutoIncBuild', _VerInfo.AutoIncBuild); | |
156 | + WriteInteger(FInfoSection, 'Build', _VerInfo.Build); | |
157 | + WriteString(FInfoKeysSection, 'Comments', _VerInfo.Comments); | |
158 | + WriteString(FInfoKeysSection, 'CompanyName', _VerInfo.CompanyName); | |
159 | + WriteString(FInfoKeysSection, 'FileDescription', _VerInfo.FileDescription); | |
160 | + WriteString(FInfoKeysSection, 'FileVersion', _VerInfo.FileVersion); | |
161 | + WriteString(FInfoKeysSection, 'InternalName', _VerInfo.InternalName); | |
162 | + WriteString(FInfoKeysSection, 'LegalCopyright', _VerInfo.LegalCopyRight); | |
163 | + WriteString(FInfoKeysSection, 'LegalTrademarks', _VerInfo.LegalTrademarks); | |
164 | + WriteInteger(FInfoSection, 'MajorVer', _VerInfo.MajorVer); | |
165 | + WriteInteger(FInfoSection, 'MinorVer', _VerInfo.MinorVer); | |
166 | + WriteString(FInfoKeysSection, 'OriginalFilename', _VerInfo.OriginalFilename); | |
167 | + WriteString(FInfoKeysSection, 'ProductName', _VerInfo.ProductName); | |
168 | + WriteString(FInfoKeysSection, 'ProductVersion', _VerInfo.ProductVersion); | |
169 | + WriteInteger(FInfoSection, 'Release', _VerInfo.Release); | |
170 | + WriteString(FInfoSection, 'Revision', _VerInfo.SCMRevision); | |
171 | + WriteString(FInfoKeysSection, 'BuildDateTime', _VerInfo.BuildDateTime); | |
172 | + | |
173 | + WriteBool(FInfoSection, 'Private', _VerInfo.IsPrivateBuild); | |
174 | + WriteBool(FInfoSection, 'Special', _VerInfo.IsSpecialBuild); | |
175 | + WriteString(FInfoKeysSection, 'PrivateBuild', _VerInfo.PrivateBuildComments); | |
176 | + WriteString(FInfoKeysSection, 'SpecialBuild', _VerInfo.SpecialBuildComments); | |
177 | + | |
178 | + FIniFile.UpdateFile; | |
179 | +end; | |
180 | + | |
181 | +end. | |
182 | + |
@@ -0,0 +1,587 @@ | ||
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 | + ProjectFn: string; | |
246 | + InputManifest: string; | |
247 | + Manifest: string; | |
248 | + IgnoreManifestErrors: Boolean; | |
249 | + s: string; | |
250 | + Theming: string; | |
251 | + ThemingAccess: IThemingAccess; | |
252 | +begin | |
253 | + try | |
254 | + WriteLn('dzPrepBuild version ' + TApplication_GetFileVersion + ' built ' + TApplication_GetProductVersion); | |
255 | + | |
256 | + if FGetOpt.OptionsFoundList.Count = 0 then | |
257 | + Usage(_('You must supply some options.')); | |
258 | + | |
259 | + if FGetOpt.OptionPassed('dumpcmd') then | |
260 | + DumpCmd; | |
261 | + | |
262 | + ProjectFn := ''; | |
263 | + if FGetOpt.OptionPassed('ReadDof', ProjectFn) then begin | |
264 | + ProjectFn := UnquoteStr(ProjectFn); | |
265 | + VerInfoAccess := TDofVersionInfo.Create(ProjectFn); | |
266 | + end; | |
267 | + | |
268 | + if FGetOpt.OptionPassed('ReadBdsProj', ProjectFn) then begin | |
269 | + if Assigned(VerInfoAccess) then | |
270 | + raise Exception.Create(_('You can only pass one of --ReadDof, --ReadBdsproj, --ReadDproj or --ReadIni')); | |
271 | + ProjectFn := UnquoteStr(ProjectFn); | |
272 | + VerInfoAccess := Tdm_BdsProjVersionInfo.Create(ProjectFn); | |
273 | + end; | |
274 | + | |
275 | + if FGetOpt.OptionPassed('ReadIni', ProjectFn) then begin | |
276 | + if Assigned(VerInfoAccess) then | |
277 | + raise Exception.Create(_('You can only pass one of --ReadDof, --ReadBdsproj, --ReadDproj or --ReadIni')); | |
278 | + ProjectFn := UnquoteStr(ProjectFn); | |
279 | + VerInfoAccess := TCentralIniVersionInfo.Create(ProjectFn); | |
280 | + end; | |
281 | + | |
282 | + if FGetOpt.OptionPassed('ReadDproj', ProjectFn) then begin | |
283 | + if Assigned(VerInfoAccess) then | |
284 | + raise Exception.Create(_('You can only pass one of --ReadDof, --ReadBdsproj, --ReadDproj or --ReadIni')); | |
285 | + ProjectFn := UnquoteStr(ProjectFn); | |
286 | + VerInfoAccess := Tdm_DProjVersionInfo.Create(ProjectFn); | |
287 | + end; | |
288 | + | |
289 | + VersionInfo := TVersionInfo.Create; | |
290 | + try | |
291 | + if Assigned(VerInfoAccess) then begin | |
292 | + WriteLn('Reading ' + VerInfoAccess.VerInfoFilename); | |
293 | + VerInfoAccess.ReadFromFile(VersionInfo); | |
294 | + VerInfoAccess := nil; | |
295 | + end; | |
296 | + | |
297 | + if FGetOpt.OptionPassed('MajorVer', Param) then begin | |
298 | + if not TryStrToInt(Param, IntValue) then | |
299 | + raise Exception.Create(_('Parameter for MajorVer must be a number')); | |
300 | + WriteLn('Setting MajorVer to ', IntValue); | |
301 | + VersionInfo.MajorVer := IntValue; | |
302 | + end; | |
303 | + | |
304 | + if FGetOpt.OptionPassed('MinorVer', Param) then begin | |
305 | + if not TryStrToInt(Param, IntValue) then | |
306 | + raise Exception.Create(_('Parameter for MinorVer must be a number')); | |
307 | + WriteLn('Setting MinorVer to ', IntValue); | |
308 | + VersionInfo.MinorVer := IntValue; | |
309 | + end; | |
310 | + | |
311 | + if FGetOpt.OptionPassed('Release', Param) then begin | |
312 | + if not TryStrToInt(Param, IntValue) then | |
313 | + raise Exception.Create(_('Parameter for Release must be a number')); | |
314 | + WriteLn('Setting Release to ', IntValue); | |
315 | + VersionInfo.Release := IntValue; | |
316 | + end; | |
317 | + | |
318 | + if FGetOpt.OptionPassed('Build', Param) then begin | |
319 | + if not TryStrToInt(Param, IntValue) then | |
320 | + raise Exception.Create(_('Parameter for Build must be a number')); | |
321 | + WriteLn('Setting Build to ', IntValue); | |
322 | + VersionInfo.Build := IntValue; | |
323 | + end; | |
324 | + | |
325 | + if FGetOpt.OptionPassed('FileDesc', Param) then begin | |
326 | + VersionInfo.FileDescription := UnquoteStr(Param); | |
327 | + WriteLn('Setting FileDescription to ', VersionInfo.FileDescription); | |
328 | + end; | |
329 | + | |
330 | + if FGetOpt.OptionPassed('InternalName', Param) then begin | |
331 | + VersionInfo.InternalName := UnquoteStr(Param); | |
332 | + WriteLn('Setting InternalName to ', VersionInfo.InternalName); | |
333 | + end; | |
334 | + | |
335 | + if FGetOpt.OptionPassed('OriginalName', Param) then begin | |
336 | + VersionInfo.OriginalFilename := UnquoteStr(Param); | |
337 | + WriteLn('Setting OriginalFilename to ', VersionInfo.OriginalFilename); | |
338 | + end; | |
339 | + | |
340 | + if FGetOpt.OptionPassed('Product', Param) then begin | |
341 | + VersionInfo.ProductName := UnquoteStr(Param); | |
342 | + WriteLn('Setting ProductName to ', VersionInfo.ProductName); | |
343 | + end; | |
344 | + | |
345 | + if FGetOpt.OptionPassed('ProductVersion', Param) then begin | |
346 | + VersionInfo.ProductVersion := UnquoteStr(Param); | |
347 | + WriteLn('Setting ProductVersion to ', VersionInfo.ProductVersion); | |
348 | + end; | |
349 | + | |
350 | + if FGetOpt.OptionPassed('Company', Param) then begin | |
351 | + VersionInfo.CompanyName := UnquoteStr(Param); | |
352 | + WriteLn('Setting CompanyName to ', VersionInfo.CompanyName); | |
353 | + end; | |
354 | + | |
355 | + if FGetOpt.OptionPassed('Copyright', Param) then begin | |
356 | + VersionInfo.LegalCopyRight := UnquoteStr(Param); | |
357 | + WriteLn('Setting LegalCopyright to ', VersionInfo.LegalCopyRight); | |
358 | + end; | |
359 | + | |
360 | + if FGetOpt.OptionPassed('Trademark', Param) then begin | |
361 | + VersionInfo.LegalTrademarks := UnquoteStr(Param); | |
362 | + WriteLn('Setting LegalTrademarks to ', VersionInfo.LegalTrademarks); | |
363 | + end; | |
364 | + | |
365 | + if FGetOpt.OptionPassed('Comments', Param) then begin | |
366 | + VersionInfo.Comments := UnquoteStr(Param); | |
367 | + WriteLn('Setting Comments to ', VersionInfo.Comments); | |
368 | + end; | |
369 | + | |
370 | + if FGetOpt.OptionPassed('SvnRevision', Param) then begin | |
371 | + //*** add a svn revision as integer ("0" if not a number) | |
372 | + VersionInfo.SCMRevision := IntToStr(StrToIntDef(UnquoteStr(Param), 0)); | |
373 | + WriteLn('Setting SCMRevision to ', VersionInfo.SCMRevision); | |
374 | + end; | |
375 | + | |
376 | + if FGetOpt.OptionPassed('GitRevision', Param) then begin | |
377 | + //*** gitRevision overwrites the svn revision | |
378 | + VersionInfo.SCMRevision := UnquoteStr(Param); | |
379 | + WriteLn('Setting SCMRevision to ', VersionInfo.SCMRevision); | |
380 | + end; | |
381 | + | |
382 | + if FGetOpt.OptionPassed('BuildDateTime', Param) then begin | |
383 | + VersionInfo.BuildDateTime := UnquoteStr(Param); | |
384 | + WriteLn('Setting BuildDateTime to ', VersionInfo.BuildDateTime); | |
385 | + end; | |
386 | + | |
387 | + if FGetOpt.OptionPassed('IsPrivateBuild', Param) then begin | |
388 | + VersionInfo.IsPrivateBuild := StrToBool(UnquoteStr(Param)); | |
389 | + WriteLn('Setting IsPrivateBuild to ', VersionInfo.IsPrivateBuild); | |
390 | + end; | |
391 | + | |
392 | + if FGetOpt.OptionPassed('IsSpecialBuild', Param) then begin | |
393 | + VersionInfo.IsSpecialBuild := StrToBool(UnquoteStr(Param)); | |
394 | + WriteLn('Setting IsSpecialBuild to ', VersionInfo.IsSpecialBuild); | |
395 | + end; | |
396 | + | |
397 | + if FGetOpt.OptionPassed('PrivateBuild', Param) then begin | |
398 | + VersionInfo.PrivateBuildComments := UnquoteStr(Param); | |
399 | + WriteLn('Setting PrivateBuildComments to ', VersionInfo.PrivateBuildComments); | |
400 | + end; | |
401 | + | |
402 | + if FGetOpt.OptionPassed('SpecialBuild', Param) then begin | |
403 | + VersionInfo.SpecialBuildComments := UnquoteStr(Param); | |
404 | + WriteLn('Setting SpecialBuildComments to ', VersionInfo.SpecialBuildComments); | |
405 | + end; | |
406 | + | |
407 | + if FGetOpt.OptionPassed('IncBuild') then begin | |
408 | + VersionInfo.Build := VersionInfo.Build + 1; | |
409 | + WriteLn('Incrementing build number to ', VersionInfo.Build); | |
410 | + end; | |
411 | + | |
412 | + VersionInfo.UpdateFileVersion; | |
413 | + WriteLn('FileVersion is now ', VersionInfo.FileVersion); | |
414 | + | |
415 | + if FGetOpt.OptionPassed('UpdateDof', Param) then begin | |
416 | + VerInfoAccess := TDofVersionInfo.Create(Param); | |
417 | + WriteLn('Updating ', VerInfoAccess.VerInfoFilename); | |
418 | + VerInfoAccess.WriteToFile(VersionInfo); | |
419 | + end; | |
420 | + | |
421 | + if FGetOpt.OptionPassed('UpdateBdsproj', Param) then begin | |
422 | + VerInfoAccess := Tdm_BdsProjVersionInfo.Create(Param); | |
423 | + WriteLn('Updating ', VerInfoAccess.VerInfoFilename); | |
424 | + VerInfoAccess.WriteToFile(VersionInfo); | |
425 | + end; | |
426 | + | |
427 | + if FGetOpt.OptionPassed('UpdateIni', Param) then begin | |
428 | + VerInfoAccess := TCentralIniVersionInfo.Create(Param); | |
429 | + WriteLn('Updating ', VerInfoAccess.VerInfoFilename); | |
430 | + VerInfoAccess.WriteToFile(VersionInfo); | |
431 | + end; | |
432 | + | |
433 | + if FGetOpt.OptionPassed('UpdateDproj', Param) then begin | |
434 | + VerInfoAccess := Tdm_DProjVersionInfo.Create(Param); | |
435 | + WriteLn('Updating ', VerInfoAccess.VerInfoFilename); | |
436 | + VerInfoAccess.WriteToFile(VersionInfo); | |
437 | + end; | |
438 | + | |
439 | + if FGetOpt.OptionPassed('InputManifest', Param) then begin | |
440 | + InputManifest := UnquoteStr(Param); | |
441 | + end else | |
442 | + InputManifest := ''; | |
443 | + | |
444 | + if FGetOpt.OptionPassed('Manifest', Param) then begin | |
445 | + Manifest := Param; | |
446 | + end else | |
447 | + Manifest := ''; | |
448 | + | |
449 | + if FGetOpt.OptionPassed('IgnoreManifestErrors') then | |
450 | + IgnoreManifestErrors := True | |
451 | + else | |
452 | + IgnoreManifestErrors := False; | |
453 | + | |
454 | + if FGetOpt.OptionPassed('Theming', Param) then begin | |
455 | + if SameText(Param, 'ON') then | |
456 | + Theming := 'ON' | |
457 | + else if SameText(Param, 'OFF') then | |
458 | + Theming := 'OFF' | |
459 | + else | |
460 | + raise Exception.CreateFmt(_('Parameter for Theming ("%s") must be ON or OFF'), [Param]); | |
461 | + end else | |
462 | + Theming := ''; | |
463 | + | |
464 | + if FGetOpt.OptionPassed('UpdateManifest') then begin | |
465 | + try | |
466 | + if InputManifest <> '' then | |
467 | + WriteLn('Reading manifest from ', InputManifest); | |
468 | + VerInfoAccess := Tdm_ManifestVersionInfo.Create(Manifest, InputManifest); | |
469 | + WriteLn('Updating ', VerInfoAccess.VerInfoFilename); | |
470 | + if Theming <> '' then begin | |
471 | + ThemingAccess := VerInfoAccess as IThemingAccess; | |
472 | + if Theming = 'ON' then begin | |
473 | + WriteLn('Enableing theme support'); | |
474 | + ThemingAccess.EnableTheming; | |
475 | + end else begin | |
476 | + WriteLn('Disableing theme support'); | |
477 | + ThemingAccess.DisableTheming; | |
478 | + end; | |
479 | + end; | |
480 | + VerInfoAccess.WriteToFile(VersionInfo); | |
481 | + except | |
482 | + on e: Exception do begin | |
483 | + if IgnoreManifestErrors then | |
484 | + WriteLn('Warning: Ignoring manifest error: ', e.Message, '(', e.ClassName, ')') | |
485 | + else | |
486 | + raise; | |
487 | + end; | |
488 | + end; | |
489 | + end; | |
490 | + | |
491 | + if FGetOpt.OptionPassed('WriteManifestRc', Param) then begin | |
492 | + WriteMainfestRcFile(Param, Manifest); | |
493 | + end; | |
494 | + | |
495 | + if FGetOpt.OptionPassed('Icon', IconFile) then begin | |
496 | + IconFile := UnquoteStr(IconFile); | |
497 | + WriteLn('Adding icon to rcfile from ', IconFile); | |
498 | + end else | |
499 | + IconFile := ''; | |
500 | + | |
501 | + if FGetOpt.OptionPassed('WriteRc', Param) then begin | |
502 | + Param := UnquoteStr(Param); | |
503 | + WriteRcFile(Param, VersionInfo, IconFile); | |
504 | + end; | |
505 | + | |
506 | + if FGetOpt.OptionPassed('Exec', Param) then begin | |
507 | + Param := UnquoteStr(Param); | |
508 | + WriteLn('Executing ', Param); | |
509 | + Flush(Output); | |
510 | + HandleExecOption(Param, VersionInfo, ProjectFn); | |
511 | + end; | |
512 | + | |
513 | + finally | |
514 | + FreeAndNil(VersionInfo); | |
515 | + end; | |
516 | + Result := 0; | |
517 | + except | |
518 | + on e: EAbort do begin | |
519 | + raise; | |
520 | + end; | |
521 | + on e: Exception do begin | |
522 | + s := 'Error: ' + e.Message + ' (' + e.ClassName + ')'; | |
523 | + WriteLn(s); | |
524 | + Result := 1; | |
525 | + end; | |
526 | + end; | |
527 | +end; | |
528 | + | |
529 | +procedure TPrepBuildMain.InitCmdLineParser; | |
530 | +begin | |
531 | + inherited; | |
532 | + FGetOpt.RegisterOption('dumpcmd', _('dump the commandline and exit (for debug purposes)'), False); | |
533 | + | |
534 | + FGetOpt.RegisterOption('ReadDof', _('read a .dof file to get the version information'), True); | |
535 | + FGetOpt.RegisterOption('ReadBdsproj', _('read a .bdsproj file to get the version information'), True); | |
536 | + FGetOpt.RegisterOption('ReadIni', _('read a .ini file to get the version information'), True); | |
537 | + FGetOpt.RegisterOption('ReadDproj', _('Read a .dproj file to get the version information'), True); | |
538 | + | |
539 | + FGetOpt.RegisterOption('MajorVer', _('set the major version number (overwrites value from -ReadXxx option)'), True); | |
540 | + FGetOpt.RegisterOption('MinorVer', _('set the minor version number (overwrites value from -ReadXxx option)'), True); | |
541 | + FGetOpt.RegisterOption('Release', _('set the release number (overwrites value from -ReadXxx option)'), True); | |
542 | + FGetOpt.RegisterOption('Build', _('set the build number (overwrites value from -ReadXxx option)'), True); | |
543 | + | |
544 | + FGetOpt.RegisterOption('FileDesc', _('set the file description (overwrites value from -ReadXxx option)'), True); | |
545 | + FGetOpt.RegisterOption('InternalName', _('set the internal name (overwrites value from -ReadXxx option)'), True); | |
546 | + FGetOpt.RegisterOption('OriginalName', _('set the original file name (overwrites value from -ReadXxx option)'), True); | |
547 | + FGetOpt.RegisterOption('Product', _('set the product name (overwrites value from -ReadXxx option)'), True); | |
548 | + FGetOpt.RegisterOption('ProductVersion', _('set the product version (overwrites value from -ReadXxx option)'), True); | |
549 | + FGetOpt.RegisterOption('Company', _('set the company name (overwrites value from -ReadXxx option)'), True); | |
550 | + FGetOpt.RegisterOption('Copyright', _('set the legal copyright (overwrites value from -ReadXxx option)'), True); | |
551 | + FGetOpt.RegisterOption('Trademark', _('set the legal trademark (overwrites value from -ReadXxx option)'), True); | |
552 | + FGetOpt.RegisterOption('Comments', _('set the comments (overwrites value from -ReadXxx option)'), True); | |
553 | + | |
554 | + FGetOpt.RegisterOption('SvnRevision', _('set the Revision (overwrites value from -ReadXxx option)'), True); | |
555 | + FGetOpt.RegisterOption('GitRevision', _('set the Revision (overwrites value from SvnRevision and -ReadXxx option)'), True); | |
556 | + FGetOpt.RegisterOption('BuildDateTime', _('set the BuildDateTime (overwrites value from -ReadXxx option)'), True); | |
557 | + | |
558 | + FGetOpt.RegisterOption('IsPrivateBuild', _('set the private build flag (overwrites value from -ReadXxx option)'), True); | |
559 | + FGetOpt.RegisterOption('IsSpecialBuild', _('set the special build flag (overwrites value from -ReadXxx option)'), True); | |
560 | + FGetOpt.RegisterOption('PrivateBuild', _('set the private build comments (overwrites value from -ReadXxx option)'), True); | |
561 | + FGetOpt.RegisterOption('SpecialBuild', _('set the special build comments (overwrites value from -ReadXxx option)'), True); | |
562 | + | |
563 | + FGetOpt.RegisterOption('IncBuild', _('increment the build number'), False); | |
564 | + | |
565 | + FGetOpt.RegisterOption('UpdateDof', _('update a .dof file with the version information'), True); | |
566 | + FGetOpt.RegisterOption('UpdateBdsproj', _('update a .bdsproj file with the version information'), True); | |
567 | + FGetOpt.RegisterOption('UpdateIni', _('update a .ini file with the version information'), True); | |
568 | + FGetOpt.RegisterOption('UpdateDproj', _('update a .dproj file with the version information'), True); | |
569 | + | |
570 | + FGetOpt.RegisterOption('InputManifest', _('read the contents for the .manifest for the UpdateManifest option from this file'), True); | |
571 | + FGetOpt.RegisterOption('Manifest', _('Name of the .manifest file for the UpdateManifest and WriteManifestRc options'), True); | |
572 | + FGetOpt.RegisterOption('UpdateManifest', _('update the .manifest file (given with the Manifest option) with the version information')); | |
573 | + FGetOpt.RegisterOption('IgnoreManifestErrors', _('ignore any errors caused by the UpdateManifest option')); | |
574 | + FGetOpt.RegisterOption('Theming', _('Set theming support: Value must be ON or OFF'), True); | |
575 | + FGetOpt.RegisterOption('WriteManifestRc', _('Write an .rc file for embedding the .manifest file given with the Manifest option'), True); | |
576 | + | |
577 | + FGetOpt.RegisterOption('Icon', _('Assign an icon file to add to the .rc file'), True); | |
578 | + | |
579 | + FGetOpt.RegisterOption('WriteRc', _('write version info to a .rc file'), True); | |
580 | + | |
581 | + FGetOpt.RegisterOption('Exec', _('execute the given program or script with extended environment'), True); | |
582 | +end; | |
583 | + | |
584 | +initialization | |
585 | + MainClass := TPrepBuildMain; | |
586 | +end. | |
587 | + |
@@ -0,0 +1,447 @@ | ||
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 | + | |
28 | + FSource: string; | |
29 | + FProjectName: string; | |
30 | + | |
31 | + FSCMRevision: string; | |
32 | + FBuildDateTime: string; | |
33 | + FIsPrivateBuild: Boolean; | |
34 | + FIsSpecialBuild: Boolean; | |
35 | + FPrivateBuildComments: string; | |
36 | + FSpecialBuildComments: string; | |
37 | + function ResolveVariable(const _s: string): string; | |
38 | + procedure AdjustFilename(var _Filename: string); | |
39 | + protected | |
40 | + function GetAutoIncBuild: Boolean; | |
41 | + procedure SetAutoIncBuild(_AutoIncBuild: Boolean); virtual; | |
42 | + // | |
43 | + procedure Assign(_VersionInfo: TVersionInfo); virtual; | |
44 | + // | |
45 | + function GetMajorVer: Integer; virtual; | |
46 | + function GetMinorVer: Integer; virtual; | |
47 | + function GetRelease: Integer; virtual; | |
48 | + function GetBuild: Integer; virtual; | |
49 | + procedure SetMajorVer(_MajorVer: Integer); virtual; | |
50 | + procedure SetMinorVer(_MinorVer: Integer); virtual; | |
51 | + procedure SetRelease(_Release: Integer); virtual; | |
52 | + procedure SetBuild(_Build: Integer); virtual; | |
53 | + // | |
54 | + function GetComments: string; virtual; | |
55 | + function GetCompanyName: string; virtual; | |
56 | + function GetFileDescription: string; virtual; | |
57 | + function GetFileVersion: string; virtual; | |
58 | + function GetInternalName: string; virtual; | |
59 | + function GetLegalCopyright: string; virtual; | |
60 | + function GetLegalTrademarks: string; virtual; | |
61 | + function GetOriginalFilename: string; | |
62 | + function GetProductName: string; virtual; | |
63 | + function GetProductVersion: string; virtual; | |
64 | + procedure SetComments(const _Comments: string); virtual; | |
65 | + procedure SetCompanyName(_CompanyName: string); virtual; | |
66 | + procedure SetFileDescription(_FileDescription: string); virtual; | |
67 | + procedure SetFileVersion(_FileVersion: string); virtual; | |
68 | + procedure SetInternalName(_InternalName: string); virtual; | |
69 | + procedure SetLegalCopyright(_LegalCopyright: string); virtual; | |
70 | + procedure SetLegalTrademarks(_LegalTrademarks: string); virtual; | |
71 | + procedure SetOriginalFilename(_OriginalFilename: string); virtual; | |
72 | + procedure SetProductName(_ProductName: string); virtual; | |
73 | + procedure SetProductVersion(_ProductVersion: string); virtual; | |
74 | + function GetSCMRevision: string; virtual; | |
75 | + function GetBuildDateTime: string; virtual; | |
76 | + procedure SetSCMRevision(const _SCMRevision: string); virtual; | |
77 | + procedure SetBuildDateTime(const _BuildDateTime: string); virtual; | |
78 | + function GetIsPrivateBuild: Boolean; virtual; | |
79 | + function GetIsSpecialBuild: Boolean; virtual; | |
80 | + function GetPrivateBuildComments: string; virtual; | |
81 | + function GetSpecialBuildComments: string; virtual; | |
82 | + procedure SetIsPrivateBuild(const _IsPrivateBuild: Boolean); virtual; | |
83 | + procedure SetIsSpecialBuild(const _IsSpecialBuild: Boolean); virtual; | |
84 | + procedure SetPrivateBuildComments(const _PrivateBuildComments: string); virtual; | |
85 | + procedure SetSpecialBuildComments(const _SpecialBuildComments: string); virtual; | |
86 | + | |
87 | + public | |
88 | + procedure UpdateFileVersion; | |
89 | + function ResolveVariables(const _s: string): string; | |
90 | + | |
91 | + property Source: string read FSource write FSource; | |
92 | + property ProjectName: string read FProjectName write FProjectName; | |
93 | + // | |
94 | + property AutoIncBuild: Boolean read GetAutoIncBuild write SetAutoIncBuild; | |
95 | + // | |
96 | + property MajorVer: Integer read GetMajorVer write SetMajorVer; | |
97 | + property MinorVer: Integer read GetMinorVer write SetMinorVer; | |
98 | + property Release: Integer read GetRelease write SetRelease; | |
99 | + property Build: Integer read GetBuild write SetBuild; | |
100 | + // | |
101 | + property Comments: string read GetComments write SetComments; | |
102 | + property CompanyName: string read GetCompanyName write SetCompanyName; | |
103 | + property FileDescription: string read GetFileDescription write SetFileDescription; | |
104 | + property FileVersion: string read GetFileVersion write SetFileVersion; | |
105 | + property InternalName: string read GetInternalName write SetInternalName; | |
106 | + property LegalCopyRight: string read GetLegalCopyright write SetLegalCopyright; | |
107 | + property LegalTrademarks: string read GetLegalTrademarks write SetLegalTrademarks; | |
108 | + property OriginalFilename: string read GetOriginalFilename write SetOriginalFilename; | |
109 | + property ProductName: string read GetProductName write SetProductName; | |
110 | + property ProductVersion: string read GetProductVersion write SetProductVersion; | |
111 | + property SCMRevision: string read GetSCMRevision write SetSCMRevision; | |
112 | + property BuildDateTime: string read GetBuildDateTime write SetBuildDateTime; | |
113 | + property IsPrivateBuild: Boolean read GetIsPrivateBuild write SetIsPrivateBuild; | |
114 | + property IsSpecialBuild: Boolean read GetIsSpecialBuild write SetIsSpecialBuild; | |
115 | + property PrivateBuildComments: string read GetPrivateBuildComments write SetPrivateBuildComments; | |
116 | + property SpecialBuildComments: string read GetSpecialBuildComments write SetSpecialBuildComments; | |
117 | + end; | |
118 | + | |
119 | +implementation | |
120 | + | |
121 | +uses | |
122 | + StrUtils, | |
123 | + DateUtils, | |
124 | + IniFiles, | |
125 | + RegularExpressions, | |
126 | + u_dzStringUtils, | |
127 | + u_dzDateUtils; | |
128 | + | |
129 | +{ TVersionInfo } | |
130 | + | |
131 | +procedure TVersionInfo.Assign(_VersionInfo: TVersionInfo); | |
132 | +begin | |
133 | + Source := _VersionInfo.Source; | |
134 | + | |
135 | + AutoIncBuild := _VersionInfo.AutoIncBuild; | |
136 | + | |
137 | + MajorVer := _VersionInfo.MajorVer; | |
138 | + MinorVer := _VersionInfo.MinorVer; | |
139 | + Release := _VersionInfo.Release; | |
140 | + Build := _VersionInfo.Build; | |
141 | + | |
142 | + Comments := _VersionInfo.Comments; | |
143 | + CompanyName := _VersionInfo.CompanyName; | |
144 | + FileDescription := _VersionInfo.FileDescription; | |
145 | + FileVersion := _VersionInfo.FileVersion; | |
146 | + InternalName := _VersionInfo.InternalName; | |
147 | + LegalCopyRight := _VersionInfo.LegalCopyRight; | |
148 | + LegalTrademarks := _VersionInfo.LegalTrademarks; | |
149 | + OriginalFilename := _VersionInfo.OriginalFilename; | |
150 | + ProductName := _VersionInfo.ProductName; | |
151 | + ProductVersion := _VersionInfo.ProductVersion; | |
152 | + SCMRevision := _VersionInfo.SCMRevision; | |
153 | + BuildDateTime := _VersionInfo.BuildDateTime; | |
154 | + IsPrivateBuild := _VersionInfo.IsPrivateBuild; | |
155 | + IsSpecialBuild := _VersionInfo.IsSpecialBuild; | |
156 | + PrivateBuildComments := _VersionInfo.PrivateBuildComments; | |
157 | + SpecialBuildComments := _VersionInfo.SpecialBuildComments; | |
158 | +end; | |
159 | + | |
160 | +procedure TVersionInfo.AdjustFilename(var _Filename: string); | |
161 | +var | |
162 | + Path: string; | |
163 | +begin | |
164 | + Path := ExtractFilePath(_Filename); | |
165 | + if (Path = '') or ((Path[1] <> '\') and (Copy(Path, 2, 1) <> ':')) then begin | |
166 | + // Path is relative, so make it relative to the main .ini/project file | |
167 | + _Filename := ExtractFilePath(FSource) + _Filename; | |
168 | + end; | |
169 | +end; | |
170 | + | |
171 | +function TVersionInfo.ResolveVariable(const _s: string): string; | |
172 | +var | |
173 | + Redir: string; | |
174 | + fn: string; | |
175 | + Section: string; | |
176 | + Ident: string; | |
177 | + IniFile: TMemIniFile; | |
178 | +begin | |
179 | + if UStartsWith('read:', _s) then begin | |
180 | + Redir := Copy(_s, Length('read:') + 1); | |
181 | + fn := ExtractStr(Redir, ','); | |
182 | + Section := ExtractStr(Redir, ','); | |
183 | + Ident := Redir; | |
184 | + AdjustFilename(fn); | |
185 | + IniFile := TMemIniFile.Create(fn); | |
186 | + try | |
187 | + Result := IniFile.ReadString(Section, Ident, ''); | |
188 | + finally | |
189 | + IniFile.Free; | |
190 | + end; | |
191 | + end else if SameText('thisyear', _s) then begin | |
192 | + Result := IntToStr(YearOf(Date)); | |
193 | + end else if SameText('today', _s) then begin | |
194 | + Result := DateTime2Iso(Date, False); | |
195 | + end else if SameText('now', _s) then begin | |
196 | + Result := DateTime2Iso(Date, True); | |
197 | + end else if SameText('MajorVer', _s) then begin | |
198 | + Result := IntToStr(FMajorVer); | |
199 | + end else if SameText('MinorVer', _s) then begin | |
200 | + Result := IntToStr(FMinorVer); | |
201 | + end else if SameText('ProjectName', _s) then begin | |
202 | + Result := ExtractFileName(FProjectName); | |
203 | + end else | |
204 | + Result := _s; | |
205 | +end; | |
206 | + | |
207 | +function TVersionInfo.ResolveVariables(const _s: string): string; | |
208 | +var | |
209 | + re: TRegEx; | |
210 | + Match: TMatch; | |
211 | + s: string; | |
212 | + Start: Integer; | |
213 | + Ende: Integer; | |
214 | +begin | |
215 | + Result := ''; | |
216 | + Start := 1; | |
217 | + re.Create('\{(.*?)\}'); | |
218 | + Match := re.Match(_s); | |
219 | + while Match.Success and (Match.Groups.Count > 1) do begin | |
220 | + Ende := Match.Index; | |
221 | + Result := Result + Copy(_s, Start, Ende - Start); | |
222 | + Start := Ende + Match.Length; | |
223 | + s := Match.Groups[1].Value; | |
224 | + s := ResolveVariable(s); | |
225 | + Result := Result + s; | |
226 | + Match := Match.NextMatch; | |
227 | + end; | |
228 | + Result := Result + TailStr(_s, Start); | |
229 | +end; | |
230 | + | |
231 | +function TVersionInfo.GetAutoIncBuild: Boolean; | |
232 | +begin | |
233 | + Result := FAutoIncBuild; | |
234 | +end; | |
235 | + | |
236 | +function TVersionInfo.GetBuild: Integer; | |
237 | +begin | |
238 | + Result := FBuild; | |
239 | +end; | |
240 | + | |
241 | +function TVersionInfo.GetBuildDateTime: string; | |
242 | +begin | |
243 | + Result := FBuildDateTime; | |
244 | +end; | |
245 | + | |
246 | +function TVersionInfo.GetComments: string; | |
247 | +begin | |
248 | + Result := FComments; | |
249 | +end; | |
250 | + | |
251 | +function TVersionInfo.GetCompanyName: string; | |
252 | +begin | |
253 | + Result := FCompanyName; | |
254 | +end; | |
255 | + | |
256 | +function TVersionInfo.GetFileDescription: string; | |
257 | +begin | |
258 | + Result := FFileDescription; | |
259 | +end; | |
260 | + | |
261 | +function TVersionInfo.GetFileVersion: string; | |
262 | +begin | |
263 | + Result := FFileVersion; | |
264 | +end; | |
265 | + | |
266 | +function TVersionInfo.GetInternalName: string; | |
267 | +begin | |
268 | + Result := FInternalName; | |
269 | +end; | |
270 | + | |
271 | +function TVersionInfo.GetIsPrivateBuild: Boolean; | |
272 | +begin | |
273 | + Result := FIsPrivateBuild; | |
274 | +end; | |
275 | + | |
276 | +function TVersionInfo.GetIsSpecialBuild: Boolean; | |
277 | +begin | |
278 | + Result := FIsSpecialBuild; | |
279 | +end; | |
280 | + | |
281 | +function TVersionInfo.GetLegalCopyright: string; | |
282 | +begin | |
283 | + Result := FLegalCopyright; | |
284 | +end; | |
285 | + | |
286 | +function TVersionInfo.GetLegalTrademarks: string; | |
287 | +begin | |
288 | + Result := FLegalTrademarks; | |
289 | +end; | |
290 | + | |
291 | +function TVersionInfo.GetMajorVer: Integer; | |
292 | +begin | |
293 | + Result := FMajorVer; | |
294 | +end; | |
295 | + | |
296 | +function TVersionInfo.GetMinorVer: Integer; | |
297 | +begin | |
298 | + Result := FMinorVer; | |
299 | +end; | |
300 | + | |
301 | +function TVersionInfo.GetOriginalFilename: string; | |
302 | +begin | |
303 | + Result := FOriginalFilename; | |
304 | +end; | |
305 | + | |
306 | +function TVersionInfo.GetPrivateBuildComments: string; | |
307 | +begin | |
308 | + Result := FPrivateBuildComments; | |
309 | +end; | |
310 | + | |
311 | +function TVersionInfo.GetProductName: string; | |
312 | +begin | |
313 | + Result := FProductName; | |
314 | +end; | |
315 | + | |
316 | +function TVersionInfo.GetProductVersion: string; | |
317 | +begin | |
318 | + Result := FProductVersion; | |
319 | +end; | |
320 | + | |
321 | +function TVersionInfo.GetRelease: Integer; | |
322 | +begin | |
323 | + Result := FRelease; | |
324 | +end; | |
325 | + | |
326 | +function TVersionInfo.GetSpecialBuildComments: string; | |
327 | +begin | |
328 | + Result := FSpecialBuildComments; | |
329 | +end; | |
330 | + | |
331 | +function TVersionInfo.GetSCMRevision: string; | |
332 | +begin | |
333 | + Result := FSCMRevision; | |
334 | +end; | |
335 | + | |
336 | +procedure TVersionInfo.SetAutoIncBuild(_AutoIncBuild: Boolean); | |
337 | +begin | |
338 | + FAutoIncBuild := _AutoIncBuild; | |
339 | +end; | |
340 | + | |
341 | +procedure TVersionInfo.SetBuild(_Build: Integer); | |
342 | +begin | |
343 | + FBuild := _Build; | |
344 | +end; | |
345 | + | |
346 | +procedure TVersionInfo.SetBuildDateTime(const _BuildDateTime: string); | |
347 | +begin | |
348 | + FBuildDateTime := _BuildDateTime; | |
349 | +end; | |
350 | + | |
351 | +procedure TVersionInfo.SetComments(const _Comments: string); | |
352 | +begin | |
353 | + FComments := _Comments; | |
354 | +end; | |
355 | + | |
356 | +procedure TVersionInfo.SetCompanyName(_CompanyName: string); | |
357 | +begin | |
358 | + FCompanyName := _CompanyName; | |
359 | +end; | |
360 | + | |
361 | +procedure TVersionInfo.SetFileDescription(_FileDescription: string); | |
362 | +begin | |
363 | + FFileDescription := _FileDescription; | |
364 | +end; | |
365 | + | |
366 | +procedure TVersionInfo.SetFileVersion(_FileVersion: string); | |
367 | +begin | |
368 | + FFileVersion := _FileVersion; | |
369 | +end; | |
370 | + | |
371 | +procedure TVersionInfo.SetInternalName(_InternalName: string); | |
372 | +begin | |
373 | + FInternalName := _InternalName; | |
374 | +end; | |
375 | + | |
376 | +procedure TVersionInfo.SetIsPrivateBuild(const _IsPrivateBuild: Boolean); | |
377 | +begin | |
378 | + FIsPrivateBuild := _IsPrivateBuild; | |
379 | +end; | |
380 | + | |
381 | +procedure TVersionInfo.SetIsSpecialBuild(const _IsSpecialBuild: Boolean); | |
382 | +begin | |
383 | + FIsSpecialBuild := _IsSpecialBuild; | |
384 | +end; | |
385 | + | |
386 | +procedure TVersionInfo.SetLegalCopyright(_LegalCopyright: string); | |
387 | +begin | |
388 | + FLegalCopyright := _LegalCopyright; | |
389 | +end; | |
390 | + | |
391 | +procedure TVersionInfo.SetLegalTrademarks(_LegalTrademarks: string); | |
392 | +begin | |
393 | + FLegalTrademarks := _LegalTrademarks; | |
394 | +end; | |
395 | + | |
396 | +procedure TVersionInfo.SetMajorVer(_MajorVer: Integer); | |
397 | +begin | |
398 | + FMajorVer := _MajorVer; | |
399 | +end; | |
400 | + | |
401 | +procedure TVersionInfo.SetMinorVer(_MinorVer: Integer); | |
402 | +begin | |
403 | + FMinorVer := _MinorVer; | |
404 | +end; | |
405 | + | |
406 | +procedure TVersionInfo.SetOriginalFilename(_OriginalFilename: string); | |
407 | +begin | |
408 | + FOriginalFilename := _OriginalFilename; | |
409 | +end; | |
410 | + | |
411 | +procedure TVersionInfo.SetPrivateBuildComments(const _PrivateBuildComments: string); | |
412 | +begin | |
413 | + FPrivateBuildComments := _PrivateBuildComments; | |
414 | +end; | |
415 | + | |
416 | +procedure TVersionInfo.SetProductName(_ProductName: string); | |
417 | +begin | |
418 | + FProductName := _ProductName; | |
419 | +end; | |
420 | + | |
421 | +procedure TVersionInfo.SetProductVersion(_ProductVersion: string); | |
422 | +begin | |
423 | + FProductVersion := _ProductVersion; | |
424 | +end; | |
425 | + | |
426 | +procedure TVersionInfo.SetRelease(_Release: Integer); | |
427 | +begin | |
428 | + FRelease := _Release; | |
429 | +end; | |
430 | + | |
431 | +procedure TVersionInfo.SetSpecialBuildComments(const _SpecialBuildComments: string); | |
432 | +begin | |
433 | + FSpecialBuildComments := _SpecialBuildComments; | |
434 | +end; | |
435 | + | |
436 | +procedure TVersionInfo.SetSCMRevision(const _SCMRevision: string); | |
437 | +begin | |
438 | + FSCMRevision := _SCMRevision; | |
439 | +end; | |
440 | + | |
441 | +procedure TVersionInfo.UpdateFileVersion; | |
442 | +begin | |
443 | + FileVersion := Format('%d.%d.%d.%d', [MajorVer, MinorVer, Release, Build]); | |
444 | +end; | |
445 | + | |
446 | +end. | |
447 | + |
@@ -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> |
@@ -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> |
@@ -0,0 +1,50 @@ | ||
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 | |
15 | + type="win32" | |
16 | + name="Microsoft.Windows.Common-Controls" | |
17 | + version="6.0.0.0" | |
18 | + publicKeyToken="6595b64144ccf1df" | |
19 | + language="*" | |
20 | + processorArchitecture="*" | |
21 | + /> | |
22 | + </dependentAssembly> | |
23 | + </dependency> | |
24 | + --> | |
25 | + <description>FileDescription goes here</description> | |
26 | + <!-- COMPATIBILITY SECTION SPECIFIES IF APP IS COMPLIANT | |
27 | + DISABLES PCA IF SPECIFIED --> | |
28 | + <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> | |
29 | + <application> | |
30 | + <!-- We support Windows Vista --> | |
31 | + <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> | |
32 | + <!-- We support Windows 7 --> | |
33 | + <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> | |
34 | + <!-- We support Windows 8 --> | |
35 | + <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> | |
36 | + </application> | |
37 | + </compatibility> | |
38 | + | |
39 | + <!-- TRUSTINFO SECTION SPECIFIES REQUESTED PERMISSIONS AND | |
40 | + UIPI DISABLEMENT (SPECIAL CONDITIONS APPLY TO UIPI DISABLEMENT)--> | |
41 | + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> | |
42 | + <security> | |
43 | + <requestedPrivileges> | |
44 | + <requestedExecutionLevel | |
45 | + level="asInvoker" | |
46 | + uiAccess="false"/> | |
47 | + </requestedPrivileges> | |
48 | + </security> | |
49 | + </trustInfo> | |
50 | +</assembly> | |
\ No newline at end of file |
@@ -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={ProjectName} | |
14 | +LegalCopyright=Copyright 2002-{ThisYear} by Thomas Mueller | |
15 | +LegalTrademarks= | |
16 | +OriginalFilename={ProjectName}.exe | |
17 | +ProductName=Testproduct | |
18 | +ProductVersion={MajorVer}.{MinorVer} | |
19 | +Comments=<svn range="{read:svn_version.ini,SVN,VersionRange}" modified="{read:svn_version.ini,SVN,LocalModifications}" url="{read:svn_version.ini,SVN,url}" /> |
@@ -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 | + |