mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-19 09:08:26 +02:00
windows ide:
- create rc files instead of res for version info and manifest - remove no more needed ide resources git-svn-id: trunk@13045 -
This commit is contained in:
parent
636bc20c12
commit
277aed08b2
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1963,9 +1963,7 @@ ide/mainintf.pas svneol=native#text/pascal
|
|||||||
ide/makeresstrdlg.lfm svneol=native#text/plain
|
ide/makeresstrdlg.lfm svneol=native#text/plain
|
||||||
ide/makeresstrdlg.lrs svneol=native#text/plain
|
ide/makeresstrdlg.lrs svneol=native#text/plain
|
||||||
ide/makeresstrdlg.pas svneol=native#text/pascal
|
ide/makeresstrdlg.pas svneol=native#text/pascal
|
||||||
ide/manifest.lrs svneol=native#text/pascal
|
|
||||||
ide/manifest.rc svneol=native#text/plain
|
ide/manifest.rc svneol=native#text/plain
|
||||||
ide/manifest.res -text
|
|
||||||
ide/miscoptions.pas svneol=native#text/pascal
|
ide/miscoptions.pas svneol=native#text/pascal
|
||||||
ide/msgquickfixes.pas svneol=native#text/plain
|
ide/msgquickfixes.pas svneol=native#text/plain
|
||||||
ide/msgview.lfm svneol=native#text/plain
|
ide/msgview.lfm svneol=native#text/plain
|
||||||
|
@ -8399,7 +8399,7 @@ begin
|
|||||||
|
|
||||||
// handle versioninfo
|
// handle versioninfo
|
||||||
VersionInfo := Project1.VersionInfo;
|
VersionInfo := Project1.VersionInfo;
|
||||||
Result := VersionInfo.CompileRCFile(Project1.MainFilename,
|
Result := VersionInfo.CreateRCFile(Project1.MainFilename,
|
||||||
MainBuildBoss.GetTargetOS(true));
|
MainBuildBoss.GetTargetOS(true));
|
||||||
|
|
||||||
for Count := 1 to VersionInfo.VersionInfoMessages.Count do
|
for Count := 1 to VersionInfo.VersionInfoMessages.Count do
|
||||||
@ -8408,7 +8408,7 @@ begin
|
|||||||
if Result <> mrOk then exit;
|
if Result <> mrOk then exit;
|
||||||
|
|
||||||
// handle manifest
|
// handle manifest
|
||||||
Result := Project1.XPManifest.CompileRCFile(Project1.MainFilename,
|
Result := Project1.XPManifest.CreateRCFile(Project1.MainFilename,
|
||||||
MainBuildBoss.GetTargetOS(true));
|
MainBuildBoss.GetTargetOS(true));
|
||||||
for Count := 1 to Project1.XPManifest.Messages.Count do
|
for Count := 1 to Project1.XPManifest.Messages.Count do
|
||||||
MessagesView.AddMsg(Format(Project1.XPManifest.Messages[Count - 1],
|
MessagesView.AddMsg(Format(Project1.XPManifest.Messages[Count - 1],
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
LazarusResources.Add('manifest','RES',[
|
|
||||||
#0#0#0#0' '#0#0#0#255#255#0#0#255#255#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#220
|
|
||||||
+#2#0#0' '#0#0#0#255#255#24#0#255#255#1#0#0#0#0#0'0'#0#25#4#0#0#0#0#0#0#0#0'<'
|
|
||||||
+'?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly xmlns="urn:'
|
|
||||||
+'schemas-microsoft-com:asm.v1" manifestVersion="1.0"><assemblyIdentity versi'
|
|
||||||
+'on="1.0.0.0" processorArchitecture="*" name="CompanyName.ProductName.YourAp'
|
|
||||||
+'p" type="win32"/><description>Your application description here.</descripti'
|
|
||||||
+'on><dependency><dependentAssembly><assemblyIdentity type="win32" name="Micr'
|
|
||||||
+'osoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" '
|
|
||||||
+'publicKeyToken="6595b64144ccf1df" language="*"/></dependentAssembly></depen'
|
|
||||||
+'dency><trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"><security><reques'
|
|
||||||
+'tedPrivileges><requestedExecutionLevel level="asInvoker" uiAccess="false"/>'
|
|
||||||
+'</requestedPrivileges></security></trustInfo></assembly>'
|
|
||||||
]);
|
|
BIN
ide/manifest.res
BIN
ide/manifest.res
Binary file not shown.
@ -45,14 +45,14 @@ type
|
|||||||
FMessages: TStrings;
|
FMessages: TStrings;
|
||||||
FModified: boolean;
|
FModified: boolean;
|
||||||
FUseManifest: boolean;
|
FUseManifest: boolean;
|
||||||
resFilename: string;
|
rcFilename: string;
|
||||||
procedure SetUseManifest(const AValue: boolean);
|
procedure SetUseManifest(const AValue: boolean);
|
||||||
procedure SetFileNames(const MainFilename: string);
|
procedure SetFileNames(const MainFilename: string);
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
function CompileRCFile(const MainFilename, TargetOS: string): TModalResult;
|
function CreateRCFile(const MainFilename, TargetOS: string): TModalResult;
|
||||||
function CreateManifest: Boolean;
|
function CreateManifest: Boolean;
|
||||||
function UpdateMainSourceFile(const AFilename: string): TModalResult;
|
function UpdateMainSourceFile(const AFilename: string): TModalResult;
|
||||||
|
|
||||||
@ -63,13 +63,39 @@ type
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
const
|
||||||
|
sManifest: String =
|
||||||
|
'#define RT_MANIFEST 24'#$D#$A+
|
||||||
|
'#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1'#$D#$A+
|
||||||
|
'#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2'#$D#$A+
|
||||||
|
'#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3'#$D#$A#$D#$A+
|
||||||
|
'CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST MOVEABLE PURE'#$D#$A+
|
||||||
|
'{'#$D#$A+
|
||||||
|
' "<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?>"'#$D#$A+
|
||||||
|
' "<assembly xmlns=""urn:schemas-microsoft-com:asm.v1"" manifestVersion=""1.0"">"'#$D#$A+
|
||||||
|
' "<assemblyIdentity version=""1.0.0.0"" processorArchitecture=""*"" name=""CompanyName.ProductName.YourApp"" type=""win32""/>"'#$D#$A+
|
||||||
|
' "<description>Your application description here.</description>"'#$D#$A+
|
||||||
|
' "<dependency>"'#$D#$A+
|
||||||
|
' "<dependentAssembly>"'#$D#$A+
|
||||||
|
' "<assemblyIdentity type=""win32"" name=""Microsoft.Windows.Common-Controls"" version=""6.0.0.0"" processorArchitecture=""*"" publicKeyToken=""6595b64144ccf1df"" language=""*""/>"'#$D#$A+
|
||||||
|
' "</dependentAssembly>"'#$D#$A+
|
||||||
|
' "</dependency>"'#$D#$A+
|
||||||
|
' "<trustInfo xmlns=""urn:schemas-microsoft-com:asm.v3"">"'#$D#$A+
|
||||||
|
' "<security>"'#$D#$A+
|
||||||
|
' "<requestedPrivileges>"'#$D#$A+
|
||||||
|
' "<requestedExecutionLevel level=""asInvoker"" uiAccess=""false""/>"'#$D#$A+
|
||||||
|
' "</requestedPrivileges>"'#$D#$A+
|
||||||
|
' "</security>"'#$D#$A+
|
||||||
|
' "</trustInfo>"'#$D#$A+
|
||||||
|
' "</assembly>"'#$D#$A+
|
||||||
|
'}';
|
||||||
|
|
||||||
{-----------------------------------------------------------------------------
|
{-----------------------------------------------------------------------------
|
||||||
TProjectXPManifest CompileRCFile
|
TProjectXPManifest CreateRCFile
|
||||||
-----------------------------------------------------------------------------}
|
-----------------------------------------------------------------------------}
|
||||||
function TProjectXPManifest.CompileRCFile(const MainFilename, TargetOS: string): TModalResult;
|
function TProjectXPManifest.CreateRCFile(const MainFilename, TargetOS: string): TModalResult;
|
||||||
begin
|
begin
|
||||||
// in future we will compile manifest from rc, but now we just add our template
|
// in future we will compile manifest from rc, but now we just add our template
|
||||||
|
|
||||||
Result := mrOk;
|
Result := mrOk;
|
||||||
SetFileNames(MainFilename);
|
SetFileNames(MainFilename);
|
||||||
if (TargetOS = 'win32') and UseManifest then
|
if (TargetOS = 'win32') and UseManifest then
|
||||||
@ -81,31 +107,15 @@ end;
|
|||||||
|
|
||||||
function TProjectXPManifest.CreateManifest: Boolean;
|
function TProjectXPManifest.CreateManifest: Boolean;
|
||||||
var
|
var
|
||||||
Res: TLResource;
|
|
||||||
Stream: TStream;
|
Stream: TStream;
|
||||||
begin
|
begin
|
||||||
// here will be better to compile res from rc, but we will only extract
|
|
||||||
// precompiled res from lazarus resource due to error in windres.
|
|
||||||
|
|
||||||
// Error description:
|
|
||||||
// if we compile manifest by windres then we will not link our project if we
|
|
||||||
// have other res files before manifest (I tested with version info resource)
|
|
||||||
// But if we compile that manifest.rc with other resource compiler then we have
|
|
||||||
// not such errors. So at this moment we decided to extract precompiled res insted
|
|
||||||
// of have problems with rc compilation and further linking
|
|
||||||
|
|
||||||
Result := False;
|
Result := False;
|
||||||
Res := LazarusResources.Find('manifest');
|
try
|
||||||
if (Res <> nil) and (Res.Value <> '') and (Res.ValueType = 'RES') then
|
Stream := TFileStream.Create(rcFileName, fmCreate);
|
||||||
begin
|
Stream.Write(sManifest[1], length(sManifest));
|
||||||
Stream := nil;
|
Result := True;
|
||||||
try
|
finally
|
||||||
Stream := TFileStream.Create(resFileName, fmCreate);
|
Stream.Free;
|
||||||
Stream.Write(Res.Value[1], length(Res.Value));
|
|
||||||
Result := True;
|
|
||||||
finally
|
|
||||||
Stream.Free;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -130,7 +140,7 @@ begin
|
|||||||
if ManifestCodeBuf <> nil then
|
if ManifestCodeBuf <> nil then
|
||||||
begin
|
begin
|
||||||
SetFileNames(AFilename);
|
SetFileNames(AFilename);
|
||||||
Filename:=ExtractFileName(resFileName);
|
Filename:=ExtractFileName(rcFileName);
|
||||||
DebugLn(['TProjectXPManifest.UpdateMainSourceFile ',Filename]);
|
DebugLn(['TProjectXPManifest.UpdateMainSourceFile ',Filename]);
|
||||||
if CodeToolBoss.FindResourceDirective(ManifestCodeBuf, 1, 1,
|
if CodeToolBoss.FindResourceDirective(ManifestCodeBuf, 1, 1,
|
||||||
NewCode, NewX, NewY,
|
NewCode, NewX, NewY,
|
||||||
@ -163,7 +173,7 @@ end;
|
|||||||
-----------------------------------------------------------------------------}
|
-----------------------------------------------------------------------------}
|
||||||
procedure TProjectXPManifest.SetFileNames(const MainFilename: string);
|
procedure TProjectXPManifest.SetFileNames(const MainFilename: string);
|
||||||
begin
|
begin
|
||||||
resFilename := ExtractFilePath(MainFilename) + 'manifest.res';
|
rcFilename := ExtractFilePath(MainFilename) + 'manifest.rc';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TProjectXPManifest.Create;
|
constructor TProjectXPManifest.Create;
|
||||||
@ -177,7 +187,5 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
|
||||||
{$i manifest.lrs}
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -65,7 +65,6 @@ type
|
|||||||
FUseVersionInfo: boolean;
|
FUseVersionInfo: boolean;
|
||||||
FVersionNr: integer;
|
FVersionNr: integer;
|
||||||
rcFilename: string;
|
rcFilename: string;
|
||||||
resFilename: string;
|
|
||||||
rcInFile: text;
|
rcInFile: text;
|
||||||
rcOutFile: text;
|
rcOutFile: text;
|
||||||
rcLine: string;
|
rcLine: string;
|
||||||
@ -79,7 +78,6 @@ type
|
|||||||
procedure RewriteAndSkipRCFile;
|
procedure RewriteAndSkipRCFile;
|
||||||
procedure AppendToRCFile;
|
procedure AppendToRCFile;
|
||||||
procedure RewriteRCFile;
|
procedure RewriteRCFile;
|
||||||
function DoTheRealCompile: TModalResult;
|
|
||||||
procedure SetAutoIncrementBuild(const AValue: boolean);
|
procedure SetAutoIncrementBuild(const AValue: boolean);
|
||||||
procedure SetBuildNr(const AValue: integer);
|
procedure SetBuildNr(const AValue: integer);
|
||||||
procedure SetCommentsString(const AValue: string);
|
procedure SetCommentsString(const AValue: string);
|
||||||
@ -102,7 +100,7 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function CompileRCFile(const MainFilename, TargetOS: string): TModalResult;
|
function CreateRCFile(const MainFilename, TargetOS: string): TModalResult;
|
||||||
function UpdateMainSourceFile(const AFilename: string): TModalResult;
|
function UpdateMainSourceFile(const AFilename: string): TModalResult;
|
||||||
|
|
||||||
property Modified: boolean read FModified write SetModified;
|
property Modified: boolean read FModified write SetModified;
|
||||||
@ -310,70 +308,49 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{-----------------------------------------------------------------------------
|
{-----------------------------------------------------------------------------
|
||||||
TProjectVersionInfo CompileRCFile
|
TProjectVersionInfo CreateRCFile
|
||||||
-----------------------------------------------------------------------------}
|
-----------------------------------------------------------------------------}
|
||||||
function TProjectVersionInfo.CompileRCFile(const MainFilename, TargetOS: string
|
function TProjectVersionInfo.CreateRCFile(const MainFilename, TargetOS: string
|
||||||
): TModalResult;
|
): TModalResult;
|
||||||
begin
|
begin
|
||||||
Result := mrCancel;
|
Result := mrCancel;
|
||||||
SetFileNames(MainFilename);
|
SetFileNames(MainFilename);
|
||||||
if (TargetOS = 'win32') then
|
if (TargetOS = 'win32') then
|
||||||
|
begin
|
||||||
|
// we are building a win32 application
|
||||||
|
if UseVersionInfo then
|
||||||
|
begin
|
||||||
|
// project indicates to use the versioninfo
|
||||||
|
if AutoIncrementBuild then // project indicate to use autoincrementbuild
|
||||||
|
BuildNr := BuildNr + 1;
|
||||||
|
if ProductVersionString = '' then
|
||||||
|
ProductVersionString := IntToStr(VersionNr) + '.' +
|
||||||
|
IntToStr(MajorRevNr) + '.' +
|
||||||
|
IntToStr(MinorRevNr) + '.' +
|
||||||
|
IntToStr(BuildNr);
|
||||||
|
if (FileExists(rcFilename)) then // we found an existing .rc file
|
||||||
|
RewriteRCFile
|
||||||
|
else
|
||||||
begin
|
begin
|
||||||
{ we are building a win32 application }
|
// there is no .rc file
|
||||||
if UseVersionInfo then
|
AssignFile(rcOutFile, rcFilename);
|
||||||
begin
|
Rewrite(rcOutFile);
|
||||||
{ project indicates to use the versioninfo }
|
AppendToRCFile;
|
||||||
if AutoIncrementBuild then
|
CloseFile(rcOutFile);
|
||||||
begin
|
|
||||||
{ project indicate to use autoincrementbuild }
|
|
||||||
BuildNr := BuildNr + 1;
|
|
||||||
end;
|
|
||||||
if ProductVersionString = '' then
|
|
||||||
ProductVersionString := IntToStr(VersionNr) + '.' +
|
|
||||||
IntToStr(MajorRevNr) + '.' +
|
|
||||||
IntToStr(MinorRevNr) + '.' +
|
|
||||||
IntToStr(BuildNr);
|
|
||||||
if (FileExists(rcFilename)) then
|
|
||||||
begin
|
|
||||||
{ we found an existing .rc file }
|
|
||||||
RewriteRCFile;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
{ there is no .rc file }
|
|
||||||
AssignFile(rcOutFile, rcFilename);
|
|
||||||
Rewrite(rcOutFile);
|
|
||||||
AppendToRCFile;
|
|
||||||
CloseFile(rcOutFile);
|
|
||||||
end;
|
|
||||||
{ now it's time to do the real compile }
|
|
||||||
Result := DoTheRealCompile;
|
|
||||||
if (Result = mrOk) then
|
|
||||||
begin
|
|
||||||
{ compilation succeeded }
|
|
||||||
VersionInfoMessages.Clear;
|
|
||||||
VersionInfoMessages.Add('Resource file ' + rcFilename +
|
|
||||||
' has been compiled successfully!');
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
{ compilation failed }
|
|
||||||
VersionInfoMessages.Add('Errors found while compiling ' +
|
|
||||||
rcFilename);
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
{ project indicates to not use the versioninfo }
|
|
||||||
Result := mrOk;
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
{ on systems other then win32, there is nothing to do, just return
|
|
||||||
with Result = mrOk }
|
|
||||||
Result := mrOk;
|
|
||||||
end;
|
end;
|
||||||
|
Result := mrOk;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
// project indicates to not use the versioninfo
|
||||||
|
Result := mrOk;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
// on systems other then win32, there is nothing to do, just return with Result = mrOk
|
||||||
|
Result := mrOk;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{-----------------------------------------------------------------------------
|
{-----------------------------------------------------------------------------
|
||||||
@ -472,64 +449,64 @@ end;
|
|||||||
-----------------------------------------------------------------------------}
|
-----------------------------------------------------------------------------}
|
||||||
procedure TProjectVersionInfo.AppendToRCFile;
|
procedure TProjectVersionInfo.AppendToRCFile;
|
||||||
begin
|
begin
|
||||||
rcLine := '1 VERSIONINFO';
|
rcLine := '1 VERSIONINFO';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := 'FILEVERSION ' + IntToStr(VersionNr) + ',' +
|
rcLine := 'FILEVERSION ' + IntToStr(VersionNr) + ',' +
|
||||||
IntToStr(MajorRevNr) + ',' +
|
IntToStr(MajorRevNr) + ',' +
|
||||||
IntToStr(MinorRevNr) + ',' +
|
IntToStr(MinorRevNr) + ',' +
|
||||||
IntToStr(BuildNr);
|
IntToStr(BuildNr);
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := 'PRODUCTVERSION ' + StringReplace(ProductVersionString, '.', ',', [rfReplaceAll]);
|
rcLine := 'PRODUCTVERSION ' + StringReplace(ProductVersionString, '.', ',', [rfReplaceAll]);
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := '{';
|
rcLine := '{';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := ' BLOCK "StringFileInfo"';
|
rcLine := ' BLOCK "StringFileInfo"';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := ' {';
|
rcLine := ' {';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := ' BLOCK "' + HexLang + HexCharSet + '"';
|
rcLine := ' BLOCK "' + HexLang + HexCharSet + '"';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := ' {';
|
rcLine := ' {';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := ' VALUE "Comments", "' + CommentsString + '\000"';
|
rcLine := ' VALUE "Comments", "' + CommentsString + '\000"';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := ' VALUE "CompanyName", "' + CompanyString + '\000"';
|
rcLine := ' VALUE "CompanyName", "' + CompanyString + '\000"';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := ' VALUE "FileDescription", "' + DescriptionString + '\000"';
|
rcLine := ' VALUE "FileDescription", "' + DescriptionString + '\000"';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := ' VALUE "FileVersion", "' + IntToStr(VersionNr) + '.' +
|
rcLine := ' VALUE "FileVersion", "' + IntToStr(VersionNr) + '.' +
|
||||||
IntToStr(MajorRevNr) + '.' +
|
IntToStr(MajorRevNr) + '.' +
|
||||||
IntToStr(MinorRevNr) + '.' +
|
IntToStr(MinorRevNr) + '.' +
|
||||||
IntToStr(BuildNr) + '\000"';
|
IntToStr(BuildNr) + '\000"';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := ' VALUE "InternalName", "' + InternalNameString + '\000"';
|
rcLine := ' VALUE "InternalName", "' + InternalNameString + '\000"';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := ' VALUE "LegalCopyright", "' + CopyrightString + '\000"';
|
rcLine := ' VALUE "LegalCopyright", "' + CopyrightString + '\000"';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := ' VALUE "LegalTrademarks", "' + TrademarksString + '\000"';
|
rcLine := ' VALUE "LegalTrademarks", "' + TrademarksString + '\000"';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := ' VALUE "OriginalFilename", "' + OriginalFilenameString + '\000"';
|
rcLine := ' VALUE "OriginalFilename", "' + OriginalFilenameString + '\000"';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := ' VALUE "ProductName", "' + ProdNameString + '\000"';
|
rcLine := ' VALUE "ProductName", "' + ProdNameString + '\000"';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := ' VALUE "ProductVersion", "' +
|
rcLine := ' VALUE "ProductVersion", "' +
|
||||||
StringReplace(ProductVersionString, ',', '.', [rfReplaceAll]) +
|
StringReplace(ProductVersionString, ',', '.', [rfReplaceAll]) +
|
||||||
'\000"';
|
'\000"';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := ' }';
|
rcLine := ' }';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := ' }';
|
rcLine := ' }';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := ' BLOCK "VarFileInfo"';
|
rcLine := ' BLOCK "VarFileInfo"';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := ' {';
|
rcLine := ' {';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := ' VALUE "Translation", 0x' + HexLang + ', 0x' + HexCharSet;
|
rcLine := ' VALUE "Translation", 0x' + HexLang + ', 0x' + HexCharSet;
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := ' }';
|
rcLine := ' }';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
rcLine := '}';
|
rcLine := '}';
|
||||||
WriteLn(rcoutFile, rcLine);
|
WriteLn(rcoutFile, rcLine);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{-----------------------------------------------------------------------------
|
{-----------------------------------------------------------------------------
|
||||||
@ -611,58 +588,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{-----------------------------------------------------------------------------
|
|
||||||
TProjectVersionInfo DoTheRealCompile
|
|
||||||
-----------------------------------------------------------------------------}
|
|
||||||
function TProjectVersionInfo.DoTheRealCompile: TModalResult;
|
|
||||||
const READ_BYTES = 2048;
|
|
||||||
var rcProcess: TProcess;
|
|
||||||
rcMemStream: TMemoryStream;
|
|
||||||
rcStringList: TStringList;
|
|
||||||
BytesRead: longint;
|
|
||||||
n: longint;
|
|
||||||
begin
|
|
||||||
Result := mrCancel;
|
|
||||||
rcMemStream := TMemoryStream.Create;
|
|
||||||
BytesRead := 0;
|
|
||||||
try
|
|
||||||
rcProcess := TProcess.Create(nil);
|
|
||||||
rcProcess.CommandLine := 'windres -v ' + rcFilename + ' ' + resFilename;
|
|
||||||
rcProcess.ShowWindow := swoHIDE;
|
|
||||||
rcProcess.Options := [poUsePipes, poStdErrToOutput];
|
|
||||||
rcProcess.Execute;
|
|
||||||
while rcProcess.Running do
|
|
||||||
begin
|
|
||||||
rcMemStream.SetSize(BytesRead + READ_BYTES);
|
|
||||||
n := rcProcess.OutPut.Read((rcMemStream.Memory + BytesRead)^, READ_BYTES);
|
|
||||||
if n > 0 then
|
|
||||||
begin
|
|
||||||
inc(BytesRead, n);
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
sleep(100);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
repeat
|
|
||||||
rcMemStream.SetSize(BytesRead + READ_BYTES);
|
|
||||||
n := rcProcess.Output.Read((rcMemStream.Memory + BytesRead)^, READ_BYTES);
|
|
||||||
if n > 0 then
|
|
||||||
begin
|
|
||||||
inc(BytesRead, n);
|
|
||||||
end;
|
|
||||||
until n <= 0;
|
|
||||||
finally
|
|
||||||
if rcProcess.ExitStatus = 0 then Result := mrOk;
|
|
||||||
rcProcess.Free;
|
|
||||||
end;
|
|
||||||
rcMemStream.SetSize(BytesRead);
|
|
||||||
rcStringList := TStringList.Create;
|
|
||||||
rcStringList.LoadFromStream(rcMemStream);
|
|
||||||
for n := 1 to rcStringList.Count do
|
|
||||||
VersionInfoMessages.Add(rcStringList[n - 1]);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TProjectVersionInfo.SetAutoIncrementBuild(const AValue: boolean);
|
procedure TProjectVersionInfo.SetAutoIncrementBuild(const AValue: boolean);
|
||||||
begin
|
begin
|
||||||
if FAutoIncrementBuild=AValue then exit;
|
if FAutoIncrementBuild=AValue then exit;
|
||||||
@ -807,7 +732,7 @@ begin
|
|||||||
VersionInfoCodeBuf:=CodeToolBoss.LoadFile(AFilename,false,false);
|
VersionInfoCodeBuf:=CodeToolBoss.LoadFile(AFilename,false,false);
|
||||||
if VersionInfoCodeBuf=nil then exit;
|
if VersionInfoCodeBuf=nil then exit;
|
||||||
SetFileNames(AFilename);
|
SetFileNames(AFilename);
|
||||||
Filename:=ExtractFileName(resFilename);
|
Filename:=ExtractFileName(rcFilename);
|
||||||
//DebugLn(['TProjectVersionInfo.UpdateMainSourceFile ',Filename,' UseVersionInfo=',UseVersionInfo]);
|
//DebugLn(['TProjectVersionInfo.UpdateMainSourceFile ',Filename,' UseVersionInfo=',UseVersionInfo]);
|
||||||
if CodeToolBoss.FindResourceDirective(VersionInfoCodeBuf,1,1,
|
if CodeToolBoss.FindResourceDirective(VersionInfoCodeBuf,1,1,
|
||||||
NewCode,NewX,NewY,
|
NewCode,NewX,NewY,
|
||||||
@ -843,8 +768,7 @@ end;
|
|||||||
-----------------------------------------------------------------------------}
|
-----------------------------------------------------------------------------}
|
||||||
procedure TProjectVersionInfo.SetFileNames(const MainFilename: string);
|
procedure TProjectVersionInfo.SetFileNames(const MainFilename: string);
|
||||||
begin
|
begin
|
||||||
rcFilename := Copy(MainFilename, 1, Length(MainFilename) - 4) + '.rc';
|
rcFilename := Copy(MainFilename, 1, Length(MainFilename) - 4) + '.rc';
|
||||||
resFilename := Copy(MainFilename, 1, Length(MainFilename) - 4) + '.res';
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
finalization
|
finalization
|
||||||
|
Loading…
Reference in New Issue
Block a user