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