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:
juha 2010-11-14 22:23:37 +00:00
parent 79a8502960
commit 6621b04689
2 changed files with 27 additions and 37 deletions

View File

@ -47,7 +47,7 @@ uses
EditDefineTree, ProjectResources, MiscOptions, LazConf, EnvironmentOpts, EditDefineTree, ProjectResources, MiscOptions, LazConf, EnvironmentOpts,
TransferMacros, CompilerOptions, OutputFilter, Compiler, FPCSrcScan, TransferMacros, CompilerOptions, OutputFilter, Compiler, FPCSrcScan,
PackageDefs, PackageSystem, Project, PackageDefs, PackageSystem, Project,
BaseBuildManager, ApplicationBundle; BaseBuildManager, ApplicationBundle, BuildProfileManager;
type type
TBMScanFPCSources = ( TBMScanFPCSources = (
@ -1871,15 +1871,16 @@ var
NewTargetOS: String; NewTargetOS: String;
NewTargetCPU: String; NewTargetCPU: String;
NewLCLWidgetSet: TLCLPlatform; NewLCLWidgetSet: TLCLPlatform;
BuildIDE: Boolean;
begin begin
MiscellaneousOptions.BuildLazProfiles.UpdateGlobals; MiscellaneousOptions.BuildLazProfiles.UpdateGlobals;
NewTargetOS:=MiscellaneousOptions.BuildLazOpts.TargetOS; NewTargetOS:=LowerCase(MiscellaneousOptions.BuildLazProfiles.Current.TargetOS);
NewTargetCPU:=MiscellaneousOptions.BuildLazOpts.TargetCPU; NewTargetCPU:=LowerCase(MiscellaneousOptions.BuildLazProfiles.Current.TargetCPU);
NewLCLWidgetSet:=MiscellaneousOptions.BuildLazOpts.TargetPlatform; 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]]); //debugln(['TBuildManager.BuildTargetIDEIsDefault NewTargetOS=',NewTargetOS,' Default=',GetDefaultTargetOS,' NewTargetCPU=',NewTargetCPU,' default=',GetDefaultTargetCPU,' ws=',LCLPlatformDisplayNames[NewLCLWidgetSet],' default=',LCLPlatformDisplayNames[GetDefaultLCLWidgetType]]);
Result:=((NewTargetOS='') or (NewTargetOS=GetDefaultTargetOS)) Result:=BuildIDE and ((NewTargetOS='') or (NewTargetOS=GetDefaultTargetOS))
and ((NewTargetCPU='') or (NewTargetCPU=GetDefaultTargetCPU)) and ((NewTargetCPU='') or (NewTargetCPU=GetDefaultTargetCPU));
and (NewLCLWidgetSet=GetDefaultLCLWidgetType);
end; end;
end. end.

View File

@ -870,7 +870,7 @@ type
function DoRunExternalTool(Index: integer): TModalResult; function DoRunExternalTool(Index: integer): TModalResult;
function DoSaveBuildIDEConfigs(Flags: TBuildLazarusFlags): TModalResult; override; function DoSaveBuildIDEConfigs(Flags: TBuildLazarusFlags): TModalResult; override;
function DoBuildLazarus(Flags: TBuildLazarusFlags): TModalResult; override; function DoBuildLazarus(Flags: TBuildLazarusFlags): TModalResult; override;
function DoBuildLazarusAll(ProfileNames: TStringList): TModalResult; function DoBuildAdvancedLazarus(ProfileNames: TStringList): TModalResult;
function DoBuildFile: TModalResult; function DoBuildFile: TModalResult;
function DoRunFile: TModalResult; function DoRunFile: TModalResult;
function DoConfigBuildFile: TModalResult; function DoConfigBuildFile: TModalResult;
@ -4256,7 +4256,7 @@ begin
if DlgResult in [mrOk,mrYes,mrAll] then begin if DlgResult in [mrOk,mrYes,mrAll] then begin
MiscellaneousOptions.Save; MiscellaneousOptions.Save;
if DlgResult=mrAll then if DlgResult=mrAll then
DoBuildLazarusAll(MiscellaneousOptions.BuildLazProfiles.Selected) DoBuildAdvancedLazarus(MiscellaneousOptions.BuildLazProfiles.Selected)
else if DlgResult=mrYes then begin else if DlgResult=mrYes then begin
LazSrcTemplate:= LazSrcTemplate:=
CodeToolBoss.DefineTree.FindDefineTemplateByName(StdDefTemplLazarusSources,true); CodeToolBoss.DefineTree.FindDefineTemplateByName(StdDefTemplLazarusSources,true);
@ -11352,8 +11352,7 @@ begin
DoCheckFilesOnDisk; DoCheckFilesOnDisk;
end; end;
function TMainIDE.DoSaveBuildIDEConfigs(Flags: TBuildLazarusFlags function TMainIDE.DoSaveBuildIDEConfigs(Flags: TBuildLazarusFlags): TModalResult;
): TModalResult;
var var
PkgOptions: string; PkgOptions: string;
InheritedOptionStrings: TInheritedCompOptsStrings; InheritedOptionStrings: TInheritedCompOptsStrings;
@ -11510,46 +11509,32 @@ begin
Result:=DoBuildLazarusSub(Flags); Result:=DoBuildLazarusSub(Flags);
Profiles:=MiscellaneousOptions.BuildLazProfiles; Profiles:=MiscellaneousOptions.BuildLazProfiles;
//debugln(['TMainIDE.DoBuildLazarus Profiles.RestartAfterBuild=',Profiles.RestartAfterBuild,' Profiles.Current.TargetDirectory=',Profiles.Current.TargetDirectory,' ',MainBuildBoss.BuildTargetIDEIsDefault]); //debugln(['TMainIDE.DoBuildLazarus Profiles.RestartAfterBuild=',Profiles.RestartAfterBuild,' Profiles.Current.TargetDirectory=',Profiles.Current.TargetDirectory,' ',MainBuildBoss.BuildTargetIDEIsDefault]);
if (Result=mrOK) and Profiles.RestartAfterBuild if (Result=mrOK) then begin
and (Profiles.Current.TargetDirectory='') if Profiles.RestartAfterBuild
and MainBuildBoss.BuildTargetIDEIsDefault then and (Profiles.Current.TargetDirectory='')
begin and MainBuildBoss.BuildTargetIDEIsDefault then
CompileProgress.Close; begin
mnuRestartClicked(nil); CompileProgress.Close;
mnuRestartClicked(nil);
end
end end
else if Result=mrIgnore then else if Result=mrIgnore then
Result:=mrOK; Result:=mrOK;
end; end;
function TMainIDE.DoBuildLazarusAll(ProfileNames: TStringList): TModalResult; function TMainIDE.DoBuildAdvancedLazarus(ProfileNames: TStringList): TModalResult;
var var
CmdLineDefines: TDefineTemplate; CmdLineDefines: TDefineTemplate;
LazSrcTemplate: TDefineTemplate; LazSrcTemplate: TDefineTemplate;
LazSrcDirTemplate: TDefineTemplate; LazSrcDirTemplate: TDefineTemplate;
i, ProfInd, RealCurInd: Integer; i, ProfInd, RealCurInd: Integer;
MayNeedRestart, FoundProfToBuild: Boolean; MayNeedRestart: Boolean;
s: String;
begin begin
Result:=mrOK; Result:=mrOK;
with MiscellaneousOptions do begin with MiscellaneousOptions do begin
MayNeedRestart:=False; MayNeedRestart:=False;
RealCurInd:=BuildLazProfiles.CurrentIndex; RealCurInd:=BuildLazProfiles.CurrentIndex;
try 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 for i:=0 to ProfileNames.Count-1 do begin
ProfInd:=BuildLazProfiles.IndexByName(ProfileNames[i]); ProfInd:=BuildLazProfiles.IndexByName(ProfileNames[i]);
if ProfInd<>-1 then begin if ProfInd<>-1 then begin
@ -11569,8 +11554,12 @@ begin
end; end;
end; end;
Result:=DoBuildLazarusSub([]); Result:=DoBuildLazarusSub([]);
if Result=mrOK then if (Result=mrOK) then begin
MayNeedRestart:=True if BuildLazProfiles.RestartAfterBuild
and (BuildLazProfiles.Current.TargetDirectory='')
and MainBuildBoss.BuildTargetIDEIsDefault then
MayNeedRestart:=True
end
else if Result=mrIgnore then else if Result=mrIgnore then
Result:=mrOK Result:=mrOK
else else