mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 21:20:30 +02:00
IDE: loading active build mode if session has no modes, bug #20008
git-svn-id: trunk@34632 -
This commit is contained in:
parent
7ede455eae
commit
bdad5a8977
@ -10512,7 +10512,7 @@ begin
|
|||||||
if not FileExistsUTF8(AFilename) then
|
if not FileExistsUTF8(AFilename) then
|
||||||
CopySecondaryConfigFile(DefaultProjectOptionsFilename);
|
CopySecondaryConfigFile(DefaultProjectOptionsFilename);
|
||||||
if FileExistsUTF8(AFilename) then begin
|
if FileExistsUTF8(AFilename) then begin
|
||||||
if AProject.ReadProject(AFilename,[prfMerge,prfMergeBuildModes])<>mrOk then
|
if AProject.ReadProject(AFilename,[prfLoadParts,prfLoadPartBuildModes])<>mrOk then
|
||||||
DebugLn(['TMainIDE.DoLoadDefaultCompilerOptions failed']);
|
DebugLn(['TMainIDE.DoLoadDefaultCompilerOptions failed']);
|
||||||
end else begin
|
end else begin
|
||||||
// old way (<0.9.31)
|
// old way (<0.9.31)
|
||||||
|
@ -2684,6 +2684,7 @@ function TProject.WriteProject(ProjectWriteFlags: TProjectWriteFlags;
|
|||||||
for i:=0 to BuildModes.Count-1 do
|
for i:=0 to BuildModes.Count-1 do
|
||||||
begin
|
begin
|
||||||
CurMode:=BuildModes[i];
|
CurMode:=BuildModes[i];
|
||||||
|
//debugln(['SaveBuildModes ',i,'/',BuildModes.Count,' Identifier=',CurMode.Identifier,' InSession=',CurMode.InSession,' SaveSession=',SaveSession,' SaveData=',SaveData]);
|
||||||
if (CurMode.InSession and SaveSession)
|
if (CurMode.InSession and SaveSession)
|
||||||
or ((not CurMode.InSession) and SaveData) then
|
or ((not CurMode.InSession) and SaveData) then
|
||||||
begin
|
begin
|
||||||
@ -2701,6 +2702,7 @@ function TProject.WriteProject(ProjectWriteFlags: TProjectWriteFlags;
|
|||||||
XMLConfig.SetDeleteValue(Path+'BuildModes/Count',Cnt,0);
|
XMLConfig.SetDeleteValue(Path+'BuildModes/Count',Cnt,0);
|
||||||
|
|
||||||
// save what mode is currently active in the session
|
// save what mode is currently active in the session
|
||||||
|
//debugln(['SaveBuildModes SaveSession=',SaveSession,' ActiveBuildMode.Identifier=',ActiveBuildMode.Identifier]);
|
||||||
if SaveSession then
|
if SaveSession then
|
||||||
XMLConfig.SetDeleteValue(Path+'BuildModes/Active',ActiveBuildMode.Identifier,'default');
|
XMLConfig.SetDeleteValue(Path+'BuildModes/Active',ActiveBuildMode.Identifier,'default');
|
||||||
end;
|
end;
|
||||||
@ -3094,7 +3096,7 @@ const
|
|||||||
'Application', 'Program', 'Custom program'
|
'Application', 'Program', 'Custom program'
|
||||||
);
|
);
|
||||||
var
|
var
|
||||||
Merge: boolean;
|
LoadParts: boolean;
|
||||||
FileVersion: Integer;
|
FileVersion: Integer;
|
||||||
NewMainUnitID: LongInt;
|
NewMainUnitID: LongInt;
|
||||||
|
|
||||||
@ -3110,8 +3112,9 @@ var
|
|||||||
MacroValsPath: String;
|
MacroValsPath: String;
|
||||||
ActiveIdentifier: String;
|
ActiveIdentifier: String;
|
||||||
begin
|
begin
|
||||||
if Merge then begin
|
if LoadParts then begin
|
||||||
if not (prfMergeBuildModes in ReadFlags) then exit;
|
if not (prfLoadPartBuildModes in ReadFlags) then exit;
|
||||||
|
if LoadData then
|
||||||
ClearBuildModes;
|
ClearBuildModes;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3148,11 +3151,6 @@ var
|
|||||||
CurMode.CompilerOptions.LoadFromXMLConfig(XMLConfig,CompOptsPath);
|
CurMode.CompilerOptions.LoadFromXMLConfig(XMLConfig,CompOptsPath);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ActiveIdentifier:=XMLConfig.GetValue(Path+'BuildModes/Active','default');
|
|
||||||
CurMode:=BuildModes.Find(ActiveIdentifier);
|
|
||||||
if CurMode=nil then
|
|
||||||
CurMode:=BuildModes[0];
|
|
||||||
ActiveBuildMode:=CurMode;
|
|
||||||
end else if LoadData then begin
|
end else if LoadData then begin
|
||||||
// no build modes => an old file format
|
// no build modes => an old file format
|
||||||
CompOptsPath:='CompilerOptions/';
|
CompOptsPath:='CompilerOptions/';
|
||||||
@ -3164,8 +3162,14 @@ var
|
|||||||
CurMode:=BuildModes[0];
|
CurMode:=BuildModes[0];
|
||||||
CurMode.MacroValues.LoadFromXMLConfig(XMLConfig,MacroValsPath);
|
CurMode.MacroValues.LoadFromXMLConfig(XMLConfig,MacroValsPath);
|
||||||
CurMode.CompilerOptions.LoadFromXMLConfig(XMLConfig,CompOptsPath);
|
CurMode.CompilerOptions.LoadFromXMLConfig(XMLConfig,CompOptsPath);
|
||||||
ActiveBuildMode:=BuildModes[0];
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// set active mode
|
||||||
|
ActiveIdentifier:=XMLConfig.GetValue(Path+'BuildModes/Active','default');
|
||||||
|
CurMode:=BuildModes.Find(ActiveIdentifier);
|
||||||
|
if CurMode=nil then
|
||||||
|
CurMode:=BuildModes[0];
|
||||||
|
ActiveBuildMode:=CurMode;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ReadOldProjectType(XMLConfig: TXMLConfig;
|
function ReadOldProjectType(XMLConfig: TXMLConfig;
|
||||||
@ -3334,10 +3338,10 @@ var
|
|||||||
xmlconfig: TXMLConfig;
|
xmlconfig: TXMLConfig;
|
||||||
begin
|
begin
|
||||||
Result := mrCancel;
|
Result := mrCancel;
|
||||||
Merge:=prfMerge in ReadFlags;
|
LoadParts:=prfLoadParts in ReadFlags;
|
||||||
BeginUpdate(true);
|
BeginUpdate(true);
|
||||||
try
|
try
|
||||||
if Merge then begin
|
if LoadParts then begin
|
||||||
// read only parts of the lpi, keep other values
|
// read only parts of the lpi, keep other values
|
||||||
try
|
try
|
||||||
xmlconfig := TCodeBufXMLConfig.CreateWithCache(NewProjectInfoFile,true)
|
xmlconfig := TCodeBufXMLConfig.CreateWithCache(NewProjectInfoFile,true)
|
||||||
@ -3393,7 +3397,7 @@ begin
|
|||||||
|
|
||||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject C reading values');{$ENDIF}
|
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject C reading values');{$ENDIF}
|
||||||
FileVersion:= XMLConfig.GetValue(Path+'Version/Value',0);
|
FileVersion:= XMLConfig.GetValue(Path+'Version/Value',0);
|
||||||
if (Fileversion=0) and (not Merge)
|
if (Fileversion=0) and (not LoadParts)
|
||||||
and (xmlconfig.GetValue(Path+'Units/Count',0)=0) then
|
and (xmlconfig.GetValue(Path+'Units/Count',0)=0) then
|
||||||
begin
|
begin
|
||||||
if MessageDlg(lisStrangeLpiFile,
|
if MessageDlg(lisStrangeLpiFile,
|
||||||
@ -3401,7 +3405,7 @@ begin
|
|||||||
mtConfirmation,[mbIgnore,mbAbort],0)<>mrIgnore then exit;
|
mtConfirmation,[mbIgnore,mbAbort],0)<>mrIgnore then exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if not Merge then begin
|
if not LoadParts then begin
|
||||||
LoadFlags(XMLConfig,Path);
|
LoadFlags(XMLConfig,Path);
|
||||||
SessionStorage:=StrToProjectSessionStorage(
|
SessionStorage:=StrToProjectSessionStorage(
|
||||||
XMLConfig.GetValue(Path+'General/SessionStorage/Value',
|
XMLConfig.GetValue(Path+'General/SessionStorage/Value',
|
||||||
@ -3415,7 +3419,7 @@ begin
|
|||||||
// added to the lpi.
|
// added to the lpi.
|
||||||
// Changing the default value to 0 avoids the redundancy and
|
// Changing the default value to 0 avoids the redundancy and
|
||||||
// automatically fixes broken lpi files.
|
// automatically fixes broken lpi files.
|
||||||
if not Merge then begin
|
if not LoadParts then begin
|
||||||
NewMainUnitID := xmlconfig.GetValue(Path+'General/MainUnit/Value', 0);
|
NewMainUnitID := xmlconfig.GetValue(Path+'General/MainUnit/Value', 0);
|
||||||
Title := xmlconfig.GetValue(Path+'General/Title/Value', '');
|
Title := xmlconfig.GetValue(Path+'General/Title/Value', '');
|
||||||
UseAppBundle := xmlconfig.GetValue(Path+'General/UseAppBundle/Value', True);
|
UseAppBundle := xmlconfig.GetValue(Path+'General/UseAppBundle/Value', True);
|
||||||
@ -3424,13 +3428,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// Lazdoc
|
// Lazdoc
|
||||||
if not Merge then begin
|
if not LoadParts then begin
|
||||||
LazDocPaths := SwitchPathDelims(xmlconfig.GetValue(Path+'LazDoc/Paths', ''),
|
LazDocPaths := SwitchPathDelims(xmlconfig.GetValue(Path+'LazDoc/Paths', ''),
|
||||||
fPathDelimChanged);
|
fPathDelimChanged);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// i18n
|
// i18n
|
||||||
if not Merge then begin
|
if not LoadParts then begin
|
||||||
if FileVersion<6 then begin
|
if FileVersion<6 then begin
|
||||||
POOutputDirectory := SwitchPathDelims(
|
POOutputDirectory := SwitchPathDelims(
|
||||||
xmlconfig.GetValue(Path+'RST/OutDir', ''),fPathDelimChanged);
|
xmlconfig.GetValue(Path+'RST/OutDir', ''),fPathDelimChanged);
|
||||||
@ -3448,40 +3452,40 @@ begin
|
|||||||
LoadBuildModes(XMLConfig,Path,true);
|
LoadBuildModes(XMLConfig,Path,true);
|
||||||
|
|
||||||
// Resources
|
// Resources
|
||||||
if not Merge then
|
if not LoadParts then
|
||||||
ProjResources.ReadFromProjectFile(xmlconfig, Path);
|
ProjResources.ReadFromProjectFile(xmlconfig, Path);
|
||||||
|
|
||||||
// load custom data
|
// load custom data
|
||||||
if not Merge then
|
if not LoadParts then
|
||||||
LoadStringToStringTree(xmlconfig,CustomData,Path+'CustomData/');
|
LoadStringToStringTree(xmlconfig,CustomData,Path+'CustomData/');
|
||||||
|
|
||||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject update ct boss');{$ENDIF}
|
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject update ct boss');{$ENDIF}
|
||||||
if not Merge then begin
|
if not LoadParts then begin
|
||||||
CodeToolBoss.GlobalValues.Variables[ExternalMacroStart+'ProjPath']:=
|
CodeToolBoss.GlobalValues.Variables[ExternalMacroStart+'ProjPath']:=
|
||||||
ProjectDirectory;
|
ProjectDirectory;
|
||||||
CodeToolBoss.DefineTree.ClearCache;
|
CodeToolBoss.DefineTree.ClearCache;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// load the dependencies
|
// load the dependencies
|
||||||
if not Merge then
|
if not LoadParts then
|
||||||
LoadPkgDependencyList(XMLConfig,Path+'RequiredPackages/',
|
LoadPkgDependencyList(XMLConfig,Path+'RequiredPackages/',
|
||||||
FFirstRequiredDependency,pdlRequires,Self,true,false);
|
FFirstRequiredDependency,pdlRequires,Self,true,false);
|
||||||
|
|
||||||
// load the Run and Build parameter Options
|
// load the Run and Build parameter Options
|
||||||
if not Merge then
|
if not LoadParts then
|
||||||
RunParameterOptions.Load(xmlconfig,Path,fPathDelimChanged);
|
RunParameterOptions.Load(xmlconfig,Path,fPathDelimChanged);
|
||||||
|
|
||||||
// load the Publish Options
|
// load the Publish Options
|
||||||
if not Merge then
|
if not LoadParts then
|
||||||
PublishOptions.LoadFromXMLConfig(xmlconfig,
|
PublishOptions.LoadFromXMLConfig(xmlconfig,
|
||||||
Path+'PublishOptions/',fPathDelimChanged);
|
Path+'PublishOptions/',fPathDelimChanged);
|
||||||
|
|
||||||
// load session info
|
// load session info
|
||||||
if not Merge then
|
if not LoadParts then
|
||||||
LoadSessionInfo(XMLConfig,Path,false);
|
LoadSessionInfo(XMLConfig,Path,false);
|
||||||
|
|
||||||
// call hooks to read their info (e.g. DebugBoss)
|
// call hooks to read their info (e.g. DebugBoss)
|
||||||
if (not Merge) and Assigned(OnLoadProjectInfo) then begin
|
if (not LoadParts) and Assigned(OnLoadProjectInfo) then begin
|
||||||
OnLoadProjectInfo(Self,XMLConfig,false);
|
OnLoadProjectInfo(Self,XMLConfig,false);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
@ -3496,7 +3500,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// load session file (if available)
|
// load session file (if available)
|
||||||
if (not Merge)
|
if (not LoadParts)
|
||||||
and (SessionStorage in [pssInProjectDir,pssInIDEConfig])
|
and (SessionStorage in [pssInProjectDir,pssInIDEConfig])
|
||||||
and (CompareFilenames(ProjectInfoFile,ProjectSessionFile)<>0) then begin
|
and (CompareFilenames(ProjectInfoFile,ProjectSessionFile)<>0) then begin
|
||||||
if FileExistsUTF8(ProjectSessionFile) then begin
|
if FileExistsUTF8(ProjectSessionFile) then begin
|
||||||
|
@ -47,8 +47,8 @@ type
|
|||||||
TOnLoadSaveFilename = procedure(var Filename:string; Load:boolean) of object;
|
TOnLoadSaveFilename = procedure(var Filename:string; Load:boolean) of object;
|
||||||
|
|
||||||
TProjectReadFlag = (
|
TProjectReadFlag = (
|
||||||
prfMerge,
|
prfLoadParts,
|
||||||
prfMergeBuildModes
|
prfLoadPartBuildModes
|
||||||
);
|
);
|
||||||
TProjectReadFlags = set of TProjectReadFlag;
|
TProjectReadFlags = set of TProjectReadFlag;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user