mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 23:29:16 +02:00
IDE: fixed the build advanced restart feature. Now it works correctly. Most work done by Stephano.
git-svn-id: trunk@28231 -
This commit is contained in:
parent
79a8502960
commit
6621b04689
@ -47,7 +47,7 @@ uses
|
||||
EditDefineTree, ProjectResources, MiscOptions, LazConf, EnvironmentOpts,
|
||||
TransferMacros, CompilerOptions, OutputFilter, Compiler, FPCSrcScan,
|
||||
PackageDefs, PackageSystem, Project,
|
||||
BaseBuildManager, ApplicationBundle;
|
||||
BaseBuildManager, ApplicationBundle, BuildProfileManager;
|
||||
|
||||
type
|
||||
TBMScanFPCSources = (
|
||||
@ -1871,15 +1871,16 @@ var
|
||||
NewTargetOS: String;
|
||||
NewTargetCPU: String;
|
||||
NewLCLWidgetSet: TLCLPlatform;
|
||||
BuildIDE: Boolean;
|
||||
begin
|
||||
MiscellaneousOptions.BuildLazProfiles.UpdateGlobals;
|
||||
NewTargetOS:=MiscellaneousOptions.BuildLazOpts.TargetOS;
|
||||
NewTargetCPU:=MiscellaneousOptions.BuildLazOpts.TargetCPU;
|
||||
NewLCLWidgetSet:=MiscellaneousOptions.BuildLazOpts.TargetPlatform;
|
||||
NewTargetOS:=LowerCase(MiscellaneousOptions.BuildLazProfiles.Current.TargetOS);
|
||||
NewTargetCPU:=LowerCase(MiscellaneousOptions.BuildLazProfiles.Current.TargetCPU);
|
||||
NewLCLWidgetSet:=MiscellaneousOptions.BuildLazProfiles.Current.TargetPlatform;
|
||||
BuildIDE:=MiscellaneousOptions.BuildLazProfiles.CurrentIdeMode in [mmBuild,mmCleanBuild];
|
||||
//debugln(['TBuildManager.BuildTargetIDEIsDefault NewTargetOS=',NewTargetOS,' Default=',GetDefaultTargetOS,' NewTargetCPU=',NewTargetCPU,' default=',GetDefaultTargetCPU,' ws=',LCLPlatformDisplayNames[NewLCLWidgetSet],' default=',LCLPlatformDisplayNames[GetDefaultLCLWidgetType]]);
|
||||
Result:=((NewTargetOS='') or (NewTargetOS=GetDefaultTargetOS))
|
||||
and ((NewTargetCPU='') or (NewTargetCPU=GetDefaultTargetCPU))
|
||||
and (NewLCLWidgetSet=GetDefaultLCLWidgetType);
|
||||
Result:=BuildIDE and ((NewTargetOS='') or (NewTargetOS=GetDefaultTargetOS))
|
||||
and ((NewTargetCPU='') or (NewTargetCPU=GetDefaultTargetCPU));
|
||||
end;
|
||||
|
||||
end.
|
||||
|
49
ide/main.pp
49
ide/main.pp
@ -870,7 +870,7 @@ type
|
||||
function DoRunExternalTool(Index: integer): TModalResult;
|
||||
function DoSaveBuildIDEConfigs(Flags: TBuildLazarusFlags): TModalResult; override;
|
||||
function DoBuildLazarus(Flags: TBuildLazarusFlags): TModalResult; override;
|
||||
function DoBuildLazarusAll(ProfileNames: TStringList): TModalResult;
|
||||
function DoBuildAdvancedLazarus(ProfileNames: TStringList): TModalResult;
|
||||
function DoBuildFile: TModalResult;
|
||||
function DoRunFile: TModalResult;
|
||||
function DoConfigBuildFile: TModalResult;
|
||||
@ -4256,7 +4256,7 @@ begin
|
||||
if DlgResult in [mrOk,mrYes,mrAll] then begin
|
||||
MiscellaneousOptions.Save;
|
||||
if DlgResult=mrAll then
|
||||
DoBuildLazarusAll(MiscellaneousOptions.BuildLazProfiles.Selected)
|
||||
DoBuildAdvancedLazarus(MiscellaneousOptions.BuildLazProfiles.Selected)
|
||||
else if DlgResult=mrYes then begin
|
||||
LazSrcTemplate:=
|
||||
CodeToolBoss.DefineTree.FindDefineTemplateByName(StdDefTemplLazarusSources,true);
|
||||
@ -11352,8 +11352,7 @@ begin
|
||||
DoCheckFilesOnDisk;
|
||||
end;
|
||||
|
||||
function TMainIDE.DoSaveBuildIDEConfigs(Flags: TBuildLazarusFlags
|
||||
): TModalResult;
|
||||
function TMainIDE.DoSaveBuildIDEConfigs(Flags: TBuildLazarusFlags): TModalResult;
|
||||
var
|
||||
PkgOptions: string;
|
||||
InheritedOptionStrings: TInheritedCompOptsStrings;
|
||||
@ -11510,46 +11509,32 @@ begin
|
||||
Result:=DoBuildLazarusSub(Flags);
|
||||
Profiles:=MiscellaneousOptions.BuildLazProfiles;
|
||||
//debugln(['TMainIDE.DoBuildLazarus Profiles.RestartAfterBuild=',Profiles.RestartAfterBuild,' Profiles.Current.TargetDirectory=',Profiles.Current.TargetDirectory,' ',MainBuildBoss.BuildTargetIDEIsDefault]);
|
||||
if (Result=mrOK) and Profiles.RestartAfterBuild
|
||||
and (Profiles.Current.TargetDirectory='')
|
||||
and MainBuildBoss.BuildTargetIDEIsDefault then
|
||||
begin
|
||||
CompileProgress.Close;
|
||||
mnuRestartClicked(nil);
|
||||
if (Result=mrOK) then begin
|
||||
if Profiles.RestartAfterBuild
|
||||
and (Profiles.Current.TargetDirectory='')
|
||||
and MainBuildBoss.BuildTargetIDEIsDefault then
|
||||
begin
|
||||
CompileProgress.Close;
|
||||
mnuRestartClicked(nil);
|
||||
end
|
||||
end
|
||||
else if Result=mrIgnore then
|
||||
Result:=mrOK;
|
||||
end;
|
||||
|
||||
function TMainIDE.DoBuildLazarusAll(ProfileNames: TStringList): TModalResult;
|
||||
function TMainIDE.DoBuildAdvancedLazarus(ProfileNames: TStringList): TModalResult;
|
||||
var
|
||||
CmdLineDefines: TDefineTemplate;
|
||||
LazSrcTemplate: TDefineTemplate;
|
||||
LazSrcDirTemplate: TDefineTemplate;
|
||||
i, ProfInd, RealCurInd: Integer;
|
||||
MayNeedRestart, FoundProfToBuild: Boolean;
|
||||
s: String;
|
||||
MayNeedRestart: Boolean;
|
||||
begin
|
||||
Result:=mrOK;
|
||||
with MiscellaneousOptions do begin
|
||||
MayNeedRestart:=False;
|
||||
RealCurInd:=BuildLazProfiles.CurrentIndex;
|
||||
try
|
||||
FoundProfToBuild:=False;
|
||||
s:=sLineBreak+sLineBreak;
|
||||
for i:=0 to ProfileNames.Count-1 do
|
||||
if BuildLazProfiles.IndexByName(ProfileNames[i])<>-1 then begin
|
||||
s:=s+ProfileNames[i]+sLineBreak;
|
||||
FoundProfToBuild:=True;
|
||||
end;
|
||||
if not FoundProfToBuild then begin
|
||||
ShowMessage(lisNoBuildProfilesSelected);
|
||||
exit;
|
||||
end;
|
||||
if BuildLazProfiles.ConfirmBuild then
|
||||
if MessageDlg(Format(lisConfirmBuildAllProfiles, [s+sLineBreak]),
|
||||
mtConfirmation, mbYesNo, 0)<>mrYes then
|
||||
exit;
|
||||
for i:=0 to ProfileNames.Count-1 do begin
|
||||
ProfInd:=BuildLazProfiles.IndexByName(ProfileNames[i]);
|
||||
if ProfInd<>-1 then begin
|
||||
@ -11569,8 +11554,12 @@ begin
|
||||
end;
|
||||
end;
|
||||
Result:=DoBuildLazarusSub([]);
|
||||
if Result=mrOK then
|
||||
MayNeedRestart:=True
|
||||
if (Result=mrOK) then begin
|
||||
if BuildLazProfiles.RestartAfterBuild
|
||||
and (BuildLazProfiles.Current.TargetDirectory='')
|
||||
and MainBuildBoss.BuildTargetIDEIsDefault then
|
||||
MayNeedRestart:=True
|
||||
end
|
||||
else if Result=mrIgnore then
|
||||
Result:=mrOK
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user