mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 00:59:31 +02:00
IDE: build modes: assign/load/save/creatediff
git-svn-id: trunk@17989 -
This commit is contained in:
parent
d8c89b30e2
commit
9e3a20fbaa
@ -3,8 +3,8 @@
|
||||
/***************************************************************************
|
||||
compiler.pp - Lazarus IDE unit
|
||||
-------------------------------------
|
||||
TCompiler is responsible for configuration and running
|
||||
the Free Pascal Compiler.
|
||||
TCompiler is responsible for configuration and running
|
||||
the Free Pascal Compiler.
|
||||
|
||||
|
||||
Initial Revision : Sun Mar 28 23:15:32 CST 1999
|
||||
|
@ -64,6 +64,8 @@ type
|
||||
procedure Assign(Source: TLazBuildMode); override;
|
||||
procedure LoadFromXMLConfig(AXMLConfig: TXMLConfig; const Path: string; DoSwitchPathDelims: boolean);
|
||||
procedure SaveToXMLConfig(AXMLConfig: TXMLConfig; const Path: string);
|
||||
procedure CreateDiff(OtherMode: TLazBuildMode; Tool: TCompilerDiffTool);
|
||||
procedure Assign(Source: TIDEBuildMode);
|
||||
end;
|
||||
|
||||
{ TIDEBuildModes }
|
||||
@ -84,6 +86,8 @@ type
|
||||
procedure Move(OldIndex, NewIndex: integer); override;
|
||||
procedure LoadFromXMLConfig(AXMLConfig: TXMLConfig; const Path: string; DoSwitchPathDelims: boolean);
|
||||
procedure SaveToXMLConfig(AXMLConfig: TXMLConfig; const Path: string);
|
||||
procedure CreateDiff(OtherModes: TLazBuildModes; Tool: TCompilerDiffTool);
|
||||
procedure Assign(Source: TLazBuildModes);
|
||||
end;
|
||||
|
||||
{ TBuildModeSet }
|
||||
@ -2578,8 +2582,9 @@ begin
|
||||
DebugPath := CompOpts.DebugPath;
|
||||
|
||||
// conditionals
|
||||
fLCLWidgetType := CompOpts.fLCLWidgetType;
|
||||
Conditionals.Assign(CompOpts.Conditionals);
|
||||
TIDEBuildModes(BuildModes).Assign(CompOpts.BuildModes);
|
||||
fLCLWidgetType := CompOpts.fLCLWidgetType;
|
||||
|
||||
// Parsing
|
||||
FSyntaxMode := CompOpts.FSyntaxMode;
|
||||
@ -2702,6 +2707,7 @@ begin
|
||||
|
||||
// conditionals
|
||||
TCompOptConditionals(Conditionals).CreateDiff(CompOpts.Conditionals,Tool);
|
||||
TIDEBuildModes(fBuildModes).CreateDiff(CompOpts.BuildModes,Tool);
|
||||
Tool.AddDiff('LCLWidgetType',fLCLWidgetType,CompOpts.fLCLWidgetType);
|
||||
|
||||
// parsing
|
||||
@ -3298,17 +3304,34 @@ procedure TIDEBuildMode.LoadFromXMLConfig(AXMLConfig: TXMLConfig;
|
||||
const Path: string; DoSwitchPathDelims: boolean);
|
||||
begin
|
||||
FIdentifier:=AXMLConfig.GetValue(Path+'Identifier/Value','');
|
||||
LoadStringList(AXMLConfig,FValues,Path+'Values/');
|
||||
TCompOptConditionals(FDefaultValue).LoadFromXMLConfig(AXMLConfig,Path+'DefaultValue',
|
||||
DoSwitchPathDelims);
|
||||
LoadStringList(AXMLConfig,FValues,Path+'Values/');
|
||||
end;
|
||||
|
||||
procedure TIDEBuildMode.SaveToXMLConfig(AXMLConfig: TXMLConfig;
|
||||
const Path: string);
|
||||
begin
|
||||
AXMLConfig.SetDeleteValue(Path+'Identifier/Value',FIdentifier,'');
|
||||
TCompOptConditionals(FDefaultValue).SaveToXMLConfig(AXMLConfig,Path+'DefaultValue');
|
||||
SaveStringList(AXMLConfig,FValues,Path+'Values/');
|
||||
TCompOptConditionals(FDefaultValue).SaveToXMLConfig(AXMLConfig,Path+'DefaultValue');
|
||||
end;
|
||||
|
||||
procedure TIDEBuildMode.CreateDiff(OtherMode: TLazBuildMode;
|
||||
Tool: TCompilerDiffTool);
|
||||
begin
|
||||
Tool.AddDiff('Identifier',Identifier,OtherMode.Identifier);
|
||||
Tool.AddStringsDiff('Values',Values,OtherMode.Values);
|
||||
TCompOptConditionals(DefaultValue).CreateDiff(OtherMode.DefaultValue,Tool);
|
||||
end;
|
||||
|
||||
procedure TIDEBuildMode.Assign(Source: TIDEBuildMode);
|
||||
begin
|
||||
Identifier:=Source.Identifier;
|
||||
Values:=Source.Values;
|
||||
DefaultValue.Assign(Source.DefaultValue);
|
||||
LocalizedName:=Source.LocalizedName;
|
||||
LocalizedValues:=Source.LocalizedValues;
|
||||
end;
|
||||
|
||||
{ TIDEBuildModes }
|
||||
@ -3409,6 +3432,30 @@ begin
|
||||
TIDEBuildMode(Items[i]).SaveToXMLConfig(AXMLConfig,Path+'Item'+IntToStr(i+1)+'/');
|
||||
end;
|
||||
|
||||
procedure TIDEBuildModes.CreateDiff(OtherModes: TLazBuildModes;
|
||||
Tool: TCompilerDiffTool);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Tool.AddDiff('Count',Count,OtherModes.Count);
|
||||
for i:=0 to Count-1 do begin
|
||||
if i<OtherModes.Count then
|
||||
TIDEBuildMode(Items[i]).CreateDiff(OtherModes.Items[i],Tool);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TIDEBuildModes.Assign(Source: TLazBuildModes);
|
||||
var
|
||||
i: Integer;
|
||||
Item: TLazBuildMode;
|
||||
begin
|
||||
Clear;
|
||||
for i:=0 to Source.Count-1 do begin
|
||||
Item:=Add(Source[i].Identifier);
|
||||
TIDEBuildMode(Item).Assign(Source[i]);
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
CompilerParseStamp:=1;
|
||||
CompilerParseStampIncreased:=nil;
|
||||
|
@ -60,6 +60,7 @@ type
|
||||
procedure AddDiff(const PropertyName: string; const Old, New: string);
|
||||
procedure AddDiff(const PropertyName: string; const Old, New: integer);
|
||||
procedure AddDiff(const PropertyName: string; const Old, New: boolean);
|
||||
procedure AddStringsDiff(const PropertyName: string; const OldList, NewList: TStrings);
|
||||
procedure AddPathsDiff(const PropertyName: string; const Old, New: string);
|
||||
procedure AddSetDiff(const PropertyName: string; const Old, New: integer;
|
||||
const EnumNames: PString);
|
||||
@ -436,6 +437,18 @@ begin
|
||||
AddDiffItem(PropertyName,dbgs(New));
|
||||
end;
|
||||
|
||||
procedure TCompilerDiffTool.AddStringsDiff(const PropertyName: string;
|
||||
const OldList, NewList: TStrings);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
AddDiff(PropertyName+'/Count',OldList.Count,NewList.Count);
|
||||
for i:=0 to OldList.Count-1 do begin
|
||||
if (i>=NewList.Count) or (OldList[i]<>NewList[i]) then
|
||||
AddDiffItem(PropertyName+'/Item'+IntToStr(i),NewList[i]);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCompilerDiffTool.AddPathsDiff(const PropertyName: string; const Old,
|
||||
New: string);
|
||||
begin
|
||||
|
@ -11,7 +11,7 @@
|
||||
*****************************************************************************
|
||||
|
||||
Author: Mattias Gaertner
|
||||
|
||||
|
||||
Abstract:
|
||||
IDE interface to the IDE projects.
|
||||
}
|
||||
@ -187,7 +187,7 @@ type
|
||||
end;
|
||||
|
||||
{ TLazCompilerOptions }
|
||||
|
||||
|
||||
TCompilationExecutableType = (
|
||||
cetProgram,
|
||||
cetLibrary
|
||||
@ -420,7 +420,7 @@ type
|
||||
property ConfigFilePath: String read fConfigFilePath write fConfigFilePath;
|
||||
property CustomOptions: string read fCustomOptions write SetCustomOptions;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
{ TLazProjectFile }
|
||||
|
||||
@ -447,10 +447,10 @@ type
|
||||
property CustomSessionData: TStringToStringTree read FCustomSessionData;
|
||||
end;
|
||||
TLazProjectFileClass = class of TLazProjectFile;
|
||||
|
||||
|
||||
|
||||
{ TProjectFileDescriptor
|
||||
|
||||
|
||||
ResourceClass: When the IDE creates a new unit of this type the IDE will
|
||||
create a direct descendant from this class.
|
||||
You should also register this class, so that, when the IDE
|
||||
@ -510,8 +510,8 @@ type
|
||||
property AddToProject: boolean read FAddToProject write FAddToProject;// only if there is choice
|
||||
end;
|
||||
TProjectFileDescriptorClass = class of TProjectFileDescriptor;
|
||||
|
||||
|
||||
|
||||
|
||||
{ TNewItemProjectFile - a new item for project file descriptors }
|
||||
|
||||
TNewItemProjectFile = class(TNewIDEItemTemplate)
|
||||
@ -562,7 +562,7 @@ type
|
||||
|
||||
|
||||
{ TProjectFileDescriptors }
|
||||
|
||||
|
||||
TProjectFileDescriptors = class(TPersistent)
|
||||
protected
|
||||
function GetItems(Index: integer): TProjectFileDescriptor; virtual; abstract;
|
||||
@ -578,7 +578,7 @@ type
|
||||
property Items[Index: integer]: TProjectFileDescriptor read GetItems; default;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
var
|
||||
ProjectFileDescriptors: TProjectFileDescriptors; // will be set by the IDE
|
||||
|
||||
@ -592,7 +592,7 @@ type
|
||||
TLazProject = class;
|
||||
|
||||
{ TProjectDescriptor - Template for initializing new projects }
|
||||
|
||||
|
||||
TProjectFlag = (
|
||||
pfSaveClosedUnits, // save info about closed files (not part of project)
|
||||
pfSaveOnlyProjectUnits, // save no info about foreign files (not part of project)
|
||||
@ -605,7 +605,7 @@ type
|
||||
pfLRSFilesInOutputDirectory // put .lrs files in output directory
|
||||
);
|
||||
TProjectFlags = set of TProjectFlag;
|
||||
|
||||
|
||||
TProjectSessionStorage = (
|
||||
pssInProjectInfo, // save session info in .lpi file
|
||||
pssInProjectDir, // save session info in .lps file in project directory
|
||||
@ -808,7 +808,7 @@ const
|
||||
'AlwaysBuild',
|
||||
'LRSInOutputDirectory'
|
||||
);
|
||||
|
||||
|
||||
ProjectSessionStorageNames: array[TProjectSessionStorage] of string = (
|
||||
'InProjectInfo',
|
||||
'InProjectDir',
|
||||
|
Loading…
Reference in New Issue
Block a user