mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-18 05:09:33 +02:00
IDE: clean up, lazbuild: auto create lrs files bug #11063
git-svn-id: trunk@14921 -
This commit is contained in:
parent
be047c5015
commit
f8b5714a8f
@ -68,6 +68,8 @@ type
|
||||
): TModalResult; virtual; abstract;
|
||||
|
||||
function BackupFile(const Filename: string): TModalResult; virtual; abstract;
|
||||
|
||||
function UpdateProjectAutomaticFiles: TModalResult; virtual; abstract;
|
||||
end;
|
||||
|
||||
var
|
||||
|
@ -41,10 +41,9 @@ unit BuildLazDialog;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Math, LCLProc, Forms, Controls, LCLType, LCLIntf,
|
||||
Classes, SysUtils, LCLProc, Forms, Controls, LCLType, LCLIntf,
|
||||
Graphics, GraphType, StdCtrls, ExtCtrls, Buttons, FileUtil, Dialogs,
|
||||
LResources, Laz_XMLCfg, InterfaceBase, ImgList, Themes, ComCtrls,
|
||||
IDEExternToolIntf,
|
||||
LResources, Laz_XMLCfg, InterfaceBase, Themes, ComCtrls,
|
||||
LazarusIDEStrConsts, TransferMacros, LazConf, IDEProcs, DialogProcs,
|
||||
IDEWindowIntf, InputHistory, ExtToolDialog, ExtToolEditDlg,
|
||||
{$IFDEF win32}
|
||||
@ -240,7 +239,7 @@ type
|
||||
private
|
||||
FAdvanced: Boolean;
|
||||
FOptions: TBuildLazarusOptions;
|
||||
function GetMakeModeAtX(const X: Integer; var MakeMode: TMakeMode): boolean;
|
||||
function GetMakeModeAtX(const X: Integer; out MakeMode: TMakeMode): boolean;
|
||||
function MakeModeToInt(MakeMode: TMakeMode): integer;
|
||||
function IntToMakeMode(i: integer): TMakeMode;
|
||||
procedure SetAdvanced(AValue: boolean);
|
||||
@ -979,11 +978,12 @@ begin
|
||||
end;
|
||||
|
||||
function TConfigureBuildLazarusDlg.GetMakeModeAtX(const X: Integer;
|
||||
var MakeMode: TMakeMode): boolean;
|
||||
out MakeMode: TMakeMode): boolean;
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
Result:=True;
|
||||
MakeMode:=mmNone;
|
||||
i := X div ButtonSize;
|
||||
case i of
|
||||
0: MakeMode:=mmNone;
|
||||
|
@ -135,6 +135,9 @@ type
|
||||
): TModalResult; override;
|
||||
function BackupFile(const Filename: string): TModalResult; override;
|
||||
|
||||
function UpdateLRSFromLFM(const LRSFilename: string): TModalResult;
|
||||
function UpdateProjectAutomaticFiles: TModalResult; override;
|
||||
|
||||
// methods for building
|
||||
procedure SetBuildTarget(const TargetOS, TargetCPU, LCLWidgetType: string;
|
||||
DoNotScanFPCSrc: boolean = false);
|
||||
@ -972,6 +975,43 @@ begin
|
||||
until Result<>mrRetry;
|
||||
end;
|
||||
|
||||
function TBuildManager.UpdateLRSFromLFM(const LRSFilename: string
|
||||
): TModalResult;
|
||||
var
|
||||
LFMFilename: String;
|
||||
begin
|
||||
Result:=mrOk;
|
||||
// check if there is a .lrs file
|
||||
if LRSFilename='' then exit;
|
||||
if not FilenameIsAbsolute(LRSFilename) then exit;
|
||||
LFMFilename:=ChangeFileExt(LRSFilename,'.lfm');
|
||||
if LRSFilename=LFMFilename then exit;
|
||||
// check if there is a .lfm file
|
||||
if not FileExists(LFMFilename) then exit;
|
||||
// check if .lrs file is newer than .lfm file
|
||||
if FileExists(LRSFilename) and (FileAge(LFMFilename)<=FileAge(LRSFilename))
|
||||
then exit;
|
||||
debugln('TBuildManager.UpdateLRSFromLFM ',LRSFilename,' LFMAge=',dbgs(FileAge(LFMFilename)),' LRSAge=',dbgs(FileAge(LRSFilename)));
|
||||
// the .lrs file does not exist, or is older than the .lfm file
|
||||
// -> update .lrs file
|
||||
Result:=ConvertLFMToLRSFileInteractive(LFMFilename,LRSFilename);
|
||||
end;
|
||||
|
||||
function TBuildManager.UpdateProjectAutomaticFiles: TModalResult;
|
||||
var
|
||||
AnUnitInfo: TUnitInfo;
|
||||
begin
|
||||
AnUnitInfo:=Project1.FirstPartOfProject;
|
||||
while AnUnitInfo<>nil do begin
|
||||
if AnUnitInfo.HasResources then begin
|
||||
Result:=UpdateLRSFromLFM(AnUnitInfo.ResourceFileName);
|
||||
if Result=mrIgnore then Result:=mrOk;
|
||||
if Result<>mrOk then exit;
|
||||
end;
|
||||
AnUnitInfo:=AnUnitInfo.NextPartOfProject;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TBuildManager.MacroFuncMakeExe(const Filename: string;
|
||||
const Data: PtrInt; var Abort: boolean): string;
|
||||
var
|
||||
|
@ -456,7 +456,7 @@ procedure FindNextEqualLine(
|
||||
const Text1: string; const Start1: TLineExtends;
|
||||
const Text2: string; const Start2: TLineExtends;
|
||||
Flags: TTextDiffFlags;
|
||||
var EqualLine1, EqualLine2: TLineExtends
|
||||
out EqualLine1, EqualLine2: TLineExtends
|
||||
);
|
||||
var
|
||||
Max1, Max2, Cur1, Cur2: TLineExtends;
|
||||
|
@ -3236,6 +3236,8 @@ begin
|
||||
end;
|
||||
if NewIndex < 0 then
|
||||
begin
|
||||
Token:='';
|
||||
Attri:=nil;
|
||||
ColorPreview.GetHighlighterAttriAtRowCol(XY, Token, Attri);
|
||||
if Attri = Nil then
|
||||
Attri := PreviewSyn.WhitespaceAttribute;
|
||||
|
@ -667,7 +667,7 @@ function CheckExecutable(const OldFilename, NewFilename: string;
|
||||
function CheckDirPathExists(const Dir,
|
||||
ErrorCaption, ErrorMsg: string): TModalResult;
|
||||
function SimpleDirectoryCheck(const OldDir, NewDir,
|
||||
NotFoundErrMsg: string; var StopChecking: boolean): boolean;
|
||||
NotFoundErrMsg: string; out StopChecking: boolean): boolean;
|
||||
|
||||
procedure SetComboBoxText(AComboBox:TComboBox; const AText:AnsiString);
|
||||
procedure SetComboBoxText(AComboBox:TComboBox; const AText:AnsiString;
|
||||
@ -749,7 +749,7 @@ begin
|
||||
end;
|
||||
|
||||
function SimpleDirectoryCheck(const OldDir, NewDir,
|
||||
NotFoundErrMsg: string; var StopChecking: boolean): boolean;
|
||||
NotFoundErrMsg: string; out StopChecking: boolean): boolean;
|
||||
var
|
||||
SubResult: TModalResult;
|
||||
begin
|
||||
|
@ -40,7 +40,7 @@ uses
|
||||
MemCheck,
|
||||
{$ENDIF}
|
||||
Classes, SysUtils, Process, LCLType, LCLProc, Controls, Forms, Buttons,
|
||||
StdCtrls, ComCtrls, Dialogs, LResources, Laz_XMLCfg, AsyncProcess,
|
||||
StdCtrls, ComCtrls, Dialogs, LResources,
|
||||
LazConfigStorage, FileUtil,
|
||||
IDEExternToolIntf, IDEImagesIntf,
|
||||
ExtToolEditDlg, IDECommands, KeyMapping, TransferMacros, IDEProcs,
|
||||
|
@ -43,9 +43,9 @@ uses
|
||||
MemCheck,
|
||||
{$ENDIF}
|
||||
Classes, SysUtils, LCLType, Controls, Forms, Buttons, StdCtrls, ComCtrls,
|
||||
Dialogs, LResources, LazConfigStorage, Laz_XMLCfg,
|
||||
Dialogs, LResources,
|
||||
IDEExternToolIntf,
|
||||
KeyMapping, TransferMacros, IDEProcs, LazarusIDEStrConsts, ExtCtrls;
|
||||
KeyMapping, TransferMacros, LazarusIDEStrConsts, ExtCtrls;
|
||||
|
||||
type
|
||||
{ TExternalToolOptions }
|
||||
|
@ -104,7 +104,7 @@ function FileIsTextCached(const AFilename: string): boolean;
|
||||
|
||||
// cmd line
|
||||
procedure SplitCmdLine(const CmdLine: string;
|
||||
var ProgramFilename, Params: string);
|
||||
out ProgramFilename, Params: string);
|
||||
function PrepareCmdLineOption(const Option: string): string;
|
||||
function AddCmdLineParameter(const CmdLine, AddParameter: string): string;
|
||||
|
||||
@ -1025,7 +1025,7 @@ begin
|
||||
end;
|
||||
|
||||
procedure SplitCmdLine(const CmdLine: string;
|
||||
var ProgramFilename, Params: string);
|
||||
out ProgramFilename, Params: string);
|
||||
var p, s, l: integer;
|
||||
quote: char;
|
||||
begin
|
||||
|
@ -30,7 +30,7 @@ unit IDETranslations;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, GetText, LCLProc, LCLStrConsts, Translations,
|
||||
Classes, SysUtils, GetText, LCLProc, Translations,
|
||||
IDEProcs, FileUtil,
|
||||
avl_tree, LazarusIDEStrConsts;
|
||||
{ IDE Language (Human, not computer) }
|
||||
@ -193,7 +193,7 @@ var
|
||||
s: string;
|
||||
NextLineStartPos: integer;
|
||||
|
||||
procedure ReadLine(var Line: string);
|
||||
procedure ReadLine(out Line: string);
|
||||
var
|
||||
p: LongInt;
|
||||
begin
|
||||
|
@ -177,14 +177,14 @@ function KeyAndShiftStateToEditorKeyString(const Key: TIDEShortCut): String;
|
||||
function ShowKeyMappingEditForm(Index: integer;
|
||||
AKeyCommandRelationList: TKeyCommandRelationList): TModalResult;
|
||||
function FindKeymapConflicts(Keymap: TKeyCommandRelationList;
|
||||
Protocol: TStrings; var Index1, Index2: integer): integer;
|
||||
Protocol: TStrings; out Index1, Index2: integer): integer;
|
||||
function EditorCommandToDescriptionString(cmd: word): String;
|
||||
function EditorCommandLocalizedName(cmd: word;
|
||||
const DefaultName: string): string;
|
||||
function EditorKeyStringToVKCode(const s: string): word;
|
||||
|
||||
procedure GetDefaultKeyForCommand(Command: word;
|
||||
var TheKeyA, TheKeyB: TIDEShortCut);
|
||||
out TheKeyA, TheKeyB: TIDEShortCut);
|
||||
procedure GetDefaultKeyForClassicScheme(Command: word;
|
||||
var TheKeyA, TheKeyB: TIDEShortCut);
|
||||
procedure GetDefaultKeyForMacOSXScheme(Command: word;
|
||||
@ -242,7 +242,7 @@ begin
|
||||
end;
|
||||
|
||||
procedure GetDefaultKeyForCommand(Command: word;
|
||||
var TheKeyA, TheKeyB: TIDEShortCut);
|
||||
out TheKeyA, TheKeyB: TIDEShortCut);
|
||||
|
||||
procedure SetResult(NewKeyA: word; NewShiftA: TShiftState;
|
||||
NewKeyB: word; NewShiftB: TShiftState);
|
||||
@ -1545,7 +1545,7 @@ begin
|
||||
end;
|
||||
|
||||
function FindKeymapConflicts(Keymap: TKeyCommandRelationList;
|
||||
Protocol: TStrings; var Index1,Index2:integer):integer;
|
||||
Protocol: TStrings; out Index1,Index2:integer):integer;
|
||||
// 0 = ok, no errors
|
||||
// >0 number of errors found
|
||||
var
|
||||
@ -1592,6 +1592,8 @@ var
|
||||
|
||||
begin
|
||||
Result:=0;
|
||||
Index1:=0;
|
||||
Index2:=0;
|
||||
for a:=0 to Keymap.Count-1 do begin
|
||||
Key1:=Keymap[a];
|
||||
for b:=a+1 to Keymap.Count-1 do begin
|
||||
|
@ -459,6 +459,9 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
// update all lrs files
|
||||
MainBuildBoss.UpdateProjectAutomaticFiles;
|
||||
|
||||
WorkingDir:=Project1.ProjectDirectory;
|
||||
SrcFilename:=CreateRelativePath(Project1.MainUnitInfo.Filename,WorkingDir);
|
||||
|
||||
|
42
ide/main.pp
42
ide/main.pp
@ -646,7 +646,6 @@ type
|
||||
procedure SaveSrcEditorProjectSpecificSettings(AnUnitInfo: TUnitInfo);
|
||||
procedure SaveSourceEditorProjectSpecificSettings;
|
||||
function DoShowSaveProjectAsDialog: TModalResult;
|
||||
function DoUpdateLRSFromLFM(const LRSFilename: string): TModalResult;
|
||||
|
||||
// methods for open project, create project from source
|
||||
function DoCompleteLoadingProjectInfo: TModalResult;
|
||||
@ -718,7 +717,6 @@ type
|
||||
function DoRemoveFromProjectDialog: TModalResult;
|
||||
function DoWarnAmbiguousFiles: TModalResult;
|
||||
procedure DoUpdateProjectResourceInfo;
|
||||
function DoUpdateProjectAutomaticFiles: TModalResult;
|
||||
function DoSaveForBuild: TModalResult; override;
|
||||
function DoCheckIfProjectNeedsCompilation(AProject: TProject;
|
||||
const CompilerFilename, CompilerParams, SrcFilename: string;
|
||||
@ -5475,7 +5473,7 @@ begin
|
||||
end;
|
||||
|
||||
NewComponent:=AnUnitInfo.Component;
|
||||
// create the designer
|
||||
// create the designer (if not already done)
|
||||
if ([ofProjectLoading,ofLoadHiddenResource]*OpenFlags=[]) then
|
||||
FormEditor1.ClearSelection;
|
||||
FormEditor1.CreateComponentInterface(NewComponent,true);
|
||||
@ -6460,27 +6458,6 @@ begin
|
||||
Result:=mrOk;
|
||||
end;
|
||||
|
||||
function TMainIDE.DoUpdateLRSFromLFM(const LRSFilename: string): TModalResult;
|
||||
var
|
||||
LFMFilename: String;
|
||||
begin
|
||||
Result:=mrOk;
|
||||
// check if there is a .lrs file
|
||||
if LRSFilename='' then exit;
|
||||
if not FilenameIsAbsolute(LRSFilename) then exit;
|
||||
LFMFilename:=ChangeFileExt(LRSFilename,'.lfm');
|
||||
if LRSFilename=LFMFilename then exit;
|
||||
// check if there is a .lfm file
|
||||
if not FileExists(LFMFilename) then exit;
|
||||
// check if .lrs file is newer than .lfm file
|
||||
if FileExists(LRSFilename) and (FileAge(LFMFilename)<=FileAge(LRSFilename))
|
||||
then exit;
|
||||
debugln('TMainIDE.DoUpdateLRSFromLFM ',LRSFilename,' ',dbgs(FileAge(LFMFilename)),' ',dbgs(FileAge(LRSFilename)));
|
||||
// the .lrs file does not exist, or is older than the .lfm file
|
||||
// -> update .lrs file
|
||||
Result:=ConvertLFMToLRSFileInteractive(LFMFilename,LRSFilename);
|
||||
end;
|
||||
|
||||
function TMainIDE.DoCompleteLoadingProjectInfo: TModalResult;
|
||||
begin
|
||||
UpdateCaption;
|
||||
@ -8012,7 +7989,7 @@ begin
|
||||
end;
|
||||
|
||||
// update all lrs files
|
||||
DoUpdateProjectAutomaticFiles;
|
||||
MainBuildBoss.UpdateProjectAutomaticFiles;
|
||||
|
||||
// everything went well => clear all modified flags
|
||||
Project1.ClearModifieds(true);
|
||||
@ -8595,21 +8572,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TMainIDE.DoUpdateProjectAutomaticFiles: TModalResult;
|
||||
var
|
||||
AnUnitInfo: TUnitInfo;
|
||||
begin
|
||||
AnUnitInfo:=Project1.FirstPartOfProject;
|
||||
while AnUnitInfo<>nil do begin
|
||||
if AnUnitInfo.HasResources then begin
|
||||
Result:=DoUpdateLRSFromLFM(AnUnitInfo.ResourceFileName);
|
||||
if Result=mrIgnore then Result:=mrOk;
|
||||
if Result<>mrOk then exit;
|
||||
end;
|
||||
AnUnitInfo:=AnUnitInfo.NextPartOfProject;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TMainIDE.DoSaveForBuild: TModalResult;
|
||||
begin
|
||||
Result:=mrCancel;
|
||||
|
@ -31,7 +31,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, BuildLazDialog, CodeToolsStructs, TextTools,
|
||||
Laz_XMLCfg, LazConf, LazarusIDEStrConsts,
|
||||
Laz_XMLCfg, LazConf,
|
||||
IDEProcs;
|
||||
|
||||
type
|
||||
|
@ -27,7 +27,7 @@ unit OutputFilter;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, Math, SysUtils, Forms, Controls, CompilerOptions, Project, Process,
|
||||
Classes, Math, SysUtils, Forms, Controls, CompilerOptions, Process,
|
||||
AsyncProcess, LCLProc, DynQueue, FileUtil,
|
||||
IDEMsgIntf, IDEExternToolIntf,
|
||||
IDEProcs, LazConf;
|
||||
|
@ -39,8 +39,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, Laz_XMLCfg,
|
||||
Forms, SynRegExpr, FileUtil, LCLProc,
|
||||
NewItemIntf, ProjectIntf,
|
||||
LazarusIDEStrConsts, PublishModule;
|
||||
ProjectIntf, PublishModule;
|
||||
|
||||
type
|
||||
TOnLoadSaveFilename = procedure(var Filename:string; Load:boolean) of object;
|
||||
|
@ -35,7 +35,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Process, LCLProc, Controls, Forms,
|
||||
CodeToolManager, CodeCache, CodeAtom, LazConf, SourceChanger, LResources;
|
||||
CodeToolManager, CodeCache, CodeAtom, LazConf, LResources;
|
||||
|
||||
type
|
||||
{ TProjectXPManifest }
|
||||
|
@ -325,7 +325,7 @@ end;
|
||||
procedure TPackageLinks.UpdateGlobalLinks;
|
||||
|
||||
function ParseFilename(const Filename: string;
|
||||
var PkgName: string; var PkgVersion: TPkgVersion): boolean;
|
||||
out PkgName: string; PkgVersion: TPkgVersion): boolean;
|
||||
// checks if filename has the form
|
||||
// <identifier>-<version>.lpl
|
||||
var
|
||||
@ -335,6 +335,7 @@ procedure TPackageLinks.UpdateGlobalLinks;
|
||||
ints: array[1..4] of integer;
|
||||
begin
|
||||
Result:=false;
|
||||
PkgName:='';
|
||||
if CompareFileExt(Filename,'.lpl',false)<>0 then exit;
|
||||
StartPos:=1;
|
||||
// parse identifier
|
||||
|
@ -2160,6 +2160,7 @@ function TLazPackageGraph.FindFPCConflictUnit(APackage: TLazPackage;
|
||||
begin
|
||||
Result:=false;
|
||||
if AnUnitName='' then exit;
|
||||
Filename:='';
|
||||
OnFindFPCUnit(AnUnitName,Directory,Filename);
|
||||
Result:=Filename<>'';
|
||||
end;
|
||||
@ -3219,7 +3220,7 @@ end;
|
||||
procedure TLazPackageGraph.CalculateTopologicalLevels;
|
||||
|
||||
procedure GetTopologicalOrder(CurDependency: TPkgDependency;
|
||||
var MaxChildLevel: integer);
|
||||
out MaxChildLevel: integer);
|
||||
var
|
||||
RequiredPackage: TLazPackage;
|
||||
CurMaxChildLevel: integer;
|
||||
@ -3317,7 +3318,6 @@ begin
|
||||
CurLvl:=Dependency.RequiredPackage.TopologicalLevel
|
||||
else
|
||||
CurLvl:=0;
|
||||
//debugln('BBB1 BucketStarts[',dbgs(CurLvl),']=',dbgs(BucketStarts[CurLvl]),' ',Dependency.AsString);
|
||||
if Dependencies[BucketStarts[CurLvl]]<>nil then
|
||||
RaiseException('');
|
||||
Dependencies[BucketStarts[CurLvl]]:=Dependency;
|
||||
|
@ -45,7 +45,7 @@ uses
|
||||
SynHighlighterLFM, SynHighlighterMulti, SynHighlighterUNIXShellScript,
|
||||
SynHighlighterCss, SynHighlighterPHP, SynHighlighterTeX,
|
||||
SynHighlighterSQL, SynHighlighterPython, SynHighlighterVB, SynHighlighterAny,
|
||||
LazarusPackageIntf, LazarusIDEStrConsts;
|
||||
LazarusPackageIntf;
|
||||
|
||||
procedure Register;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user