mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 01:57:57 +02:00
IDE: install a package and cancel rebuild: fixed saving idemake.cfg
git-svn-id: trunk@48250 -
This commit is contained in:
parent
0ee7878d79
commit
e3aeb5a845
@ -47,6 +47,11 @@ type
|
||||
destructor Destroy; override;
|
||||
property HasGUI: boolean read FHasGUI write FHasGUI;
|
||||
|
||||
// methods for building IDE (will be changed when project groups are there)
|
||||
procedure SetBuildTargetProject1; virtual; abstract;
|
||||
procedure SetBuildTargetIDE; virtual; abstract;
|
||||
function BuildTargetIDEIsDefault: boolean; virtual; abstract;
|
||||
|
||||
function GetBuildMacroOverride(const MacroName: string): string; virtual; abstract;
|
||||
function GetBuildMacroOverrides: TStrings; virtual; abstract;
|
||||
function GetTargetOS: string; virtual; abstract;
|
||||
|
@ -223,10 +223,10 @@ type
|
||||
// methods for building IDE (will be changed when project groups are there)
|
||||
procedure SetBuildTarget(const TargetOS, TargetCPU, LCLWidgetType: string;
|
||||
ScanFPCSrc: TScanModeFPCSources; Quiet: boolean);
|
||||
procedure SetBuildTargetProject1(Quiet: boolean;
|
||||
ScanFPCSrc: TScanModeFPCSources = smsfsBackground);
|
||||
procedure SetBuildTargetIDE;
|
||||
function BuildTargetIDEIsDefault: boolean;
|
||||
procedure SetBuildTargetProject1; override; overload;
|
||||
procedure SetBuildTargetProject1(Quiet: boolean; ScanFPCSrc: TScanModeFPCSources = smsfsBackground); overload;
|
||||
procedure SetBuildTargetIDE; override;
|
||||
function BuildTargetIDEIsDefault: boolean; override;
|
||||
|
||||
property FPCSrcScans: TFPCSrcScans read FFPCSrcScans;
|
||||
property BuildTarget: TObject read FBuildTarget; // TProject or nil
|
||||
@ -2642,6 +2642,11 @@ begin
|
||||
//if (PackageGraph<>nil) and (PackageGraph.CodeToolsPackage<>nil) then debugln(['TBuildManager.SetBuildTarget CODETOOLS OUTDIR=',PackageGraph.CodeToolsPackage.CompilerOptions.GetUnitOutPath(true,coptParsed),' ',PackageGraph.CodeToolsPackage.CompilerOptions.ParsedOpts.ParsedStamp[pcosOutputDir],' ',CompilerParseStamp]);
|
||||
end;
|
||||
|
||||
procedure TBuildManager.SetBuildTargetProject1;
|
||||
begin
|
||||
SetBuildTargetProject1(true);
|
||||
end;
|
||||
|
||||
procedure TBuildManager.SetBuildTargetProject1(Quiet: boolean;
|
||||
ScanFPCSrc: TScanModeFPCSources);
|
||||
begin
|
||||
|
@ -7285,7 +7285,6 @@ begin
|
||||
Builder:=TLazarusBuilder.Create;
|
||||
try
|
||||
// prepare static auto install packages
|
||||
//PkgOptions:='';
|
||||
// create inherited compiler options
|
||||
Builder.PackageOptions:=PackageGraph.GetIDEInstallPackageOptions(InheritedOptionStrings{%H-});
|
||||
|
||||
|
@ -5310,113 +5310,120 @@ var
|
||||
begin
|
||||
if not MainIDE.DoResetToolStatus([rfInteractive]) then exit(mrCancel);
|
||||
|
||||
PackageGraph.BeginUpdate(true);
|
||||
PkgList:=nil;
|
||||
try
|
||||
// check if package is designtime package
|
||||
if APackage.PackageType in [lptRunTime,lptRunTimeOnly] then begin
|
||||
Btns:=[mbAbort];
|
||||
if APackage.PackageType=lptRunTime then
|
||||
Include(Btns,mbIgnore);
|
||||
Result:=IDEMessageDialog(lisPkgMangPackageIsNoDesigntimePackage,
|
||||
Format(lisPkgMangThePackageIsARuntimeOnlyPackageRuntimeOnlyPackages,
|
||||
[APackage.IDAsString, LineEnding]),
|
||||
mtError,Btns);
|
||||
if Result<>mrIgnore then exit;
|
||||
end;
|
||||
// check if package requires a runtime only package
|
||||
ConflictDep:=PackageGraph.FindRuntimePkgOnlyRecursively(
|
||||
APackage.FirstRequiredDependency);
|
||||
if ConflictDep<>nil then begin
|
||||
IDEQuestionDialog(lisNotADesigntimePackage,
|
||||
Format(lisThePackageCanNotBeInstalledBecauseItRequiresWhichI, [
|
||||
APackage.Name, ConflictDep.AsString]),
|
||||
mtError,
|
||||
[mrCancel]
|
||||
);
|
||||
exit;
|
||||
end;
|
||||
BuildBoss.SetBuildTargetIDE;
|
||||
|
||||
// save package
|
||||
if APackage.IsVirtual or APackage.Modified then begin
|
||||
Result:=DoSavePackage(APackage,[]);
|
||||
PackageGraph.BeginUpdate(true);
|
||||
PkgList:=nil;
|
||||
try
|
||||
|
||||
// check if package is designtime package
|
||||
if APackage.PackageType in [lptRunTime,lptRunTimeOnly] then begin
|
||||
Btns:=[mbAbort];
|
||||
if APackage.PackageType=lptRunTime then
|
||||
Include(Btns,mbIgnore);
|
||||
Result:=IDEMessageDialog(lisPkgMangPackageIsNoDesigntimePackage,
|
||||
Format(lisPkgMangThePackageIsARuntimeOnlyPackageRuntimeOnlyPackages,
|
||||
[APackage.IDAsString, LineEnding]),
|
||||
mtError,Btns);
|
||||
if Result<>mrIgnore then exit;
|
||||
end;
|
||||
// check if package requires a runtime only package
|
||||
ConflictDep:=PackageGraph.FindRuntimePkgOnlyRecursively(
|
||||
APackage.FirstRequiredDependency);
|
||||
if ConflictDep<>nil then begin
|
||||
IDEQuestionDialog(lisNotADesigntimePackage,
|
||||
Format(lisThePackageCanNotBeInstalledBecauseItRequiresWhichI, [
|
||||
APackage.Name, ConflictDep.AsString]),
|
||||
mtError,
|
||||
[mrCancel]
|
||||
);
|
||||
exit;
|
||||
end;
|
||||
|
||||
// save package
|
||||
if APackage.IsVirtual or APackage.Modified then begin
|
||||
Result:=DoSavePackage(APackage,[]);
|
||||
if Result<>mrOk then exit;
|
||||
end;
|
||||
|
||||
// check consistency
|
||||
Result:=CheckPackageGraphForCompilation(APackage,nil,
|
||||
EnvironmentOptions.GetParsedLazarusDirectory,false);
|
||||
if Result<>mrOk then exit;
|
||||
end;
|
||||
|
||||
// check consistency
|
||||
Result:=CheckPackageGraphForCompilation(APackage,nil,
|
||||
EnvironmentOptions.GetParsedLazarusDirectory,false);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
// get all required packages, which will also be auto installed
|
||||
APackage.GetAllRequiredPackages(PkgList,false);
|
||||
if PkgList=nil then PkgList:=TFPList.Create;
|
||||
|
||||
// remove packages already marked for installation
|
||||
for i:=PkgList.Count-1 downto 0 do begin
|
||||
RequiredPackage:=TLazPackage(PkgList[i]);
|
||||
if (RequiredPackage.AutoInstall<>pitNope) then
|
||||
PkgList.Delete(i);
|
||||
end;
|
||||
// get all required packages, which will also be auto installed
|
||||
APackage.GetAllRequiredPackages(PkgList,false);
|
||||
if PkgList=nil then PkgList:=TFPList.Create;
|
||||
|
||||
// now PkgList contains only the required packages that were added to the
|
||||
// list of installation packages
|
||||
// => show the user the list
|
||||
if PkgList.Count>0 then begin
|
||||
s:='';
|
||||
// remove packages already marked for installation
|
||||
for i:=PkgList.Count-1 downto 0 do begin
|
||||
RequiredPackage:=TLazPackage(PkgList[i]);
|
||||
if (RequiredPackage.AutoInstall<>pitNope) then
|
||||
PkgList.Delete(i);
|
||||
end;
|
||||
|
||||
// now PkgList contains only the required packages that were added to the
|
||||
// list of installation packages
|
||||
// => show the user the list
|
||||
if PkgList.Count>0 then begin
|
||||
s:='';
|
||||
for i:=0 to PkgList.Count-1 do begin
|
||||
RequiredPackage:=TLazPackage(PkgList[i]);
|
||||
s:=s+RequiredPackage.IDAsString+LineEnding;
|
||||
end;
|
||||
if PkgList.Count=0 then
|
||||
Msg:=Format(lisPkgMangInstallingThePackageWillAutomaticallyInstallThePac,
|
||||
[APackage.IDAsString])
|
||||
else
|
||||
Msg:=Format(lisPkgMangInstallingThePackageWillAutomaticallyInstallThePac2,
|
||||
[APackage.IDAsString]);
|
||||
Result:=IDEMessageDialog(lisPkgMangAutomaticallyInstalledPackages,
|
||||
Msg+LineEnding+s,mtConfirmation,[mbOk,mbCancel]);
|
||||
if Result<>mrOk then exit;
|
||||
end;
|
||||
|
||||
// warn for packages with suspicious settings
|
||||
Result:=WarnForSuspiciousPackage(APackage);
|
||||
if Result<>mrOk then exit;
|
||||
for i:=0 to PkgList.Count-1 do begin
|
||||
RequiredPackage:=TLazPackage(PkgList[i]);
|
||||
s:=s+RequiredPackage.IDAsString+LineEnding;
|
||||
Result:=WarnForSuspiciousPackage(RequiredPackage);
|
||||
if Result<>mrOk then exit;
|
||||
end;
|
||||
if PkgList.Count=0 then
|
||||
Msg:=Format(lisPkgMangInstallingThePackageWillAutomaticallyInstallThePac,
|
||||
[APackage.IDAsString])
|
||||
else
|
||||
Msg:=Format(lisPkgMangInstallingThePackageWillAutomaticallyInstallThePac2,
|
||||
[APackage.IDAsString]);
|
||||
Result:=IDEMessageDialog(lisPkgMangAutomaticallyInstalledPackages,
|
||||
Msg+LineEnding+s,mtConfirmation,[mbOk,mbCancel]);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
// add packages to auto installed packages
|
||||
if GetPkgListIndex(APackage)<0 then
|
||||
PkgList.Add(APackage);
|
||||
NeedSaving:=false;
|
||||
for i:=0 to PkgList.Count-1 do begin
|
||||
RequiredPackage:=TLazPackage(PkgList[i]);
|
||||
if RequiredPackage.AutoInstall=pitNope then begin
|
||||
RequiredPackage.AutoInstall:=pitStatic;
|
||||
Dependency:=RequiredPackage.CreateDependencyWithOwner(Self);
|
||||
Dependency.AddToList(PackageGraph.FirstAutoInstallDependency,pdlRequires);
|
||||
PackageGraph.OpenDependency(Dependency,false);
|
||||
NeedSaving:=true;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
PackageGraph.EndUpdate;
|
||||
PkgList.Free;
|
||||
end;
|
||||
|
||||
// warn for packages with suspicious settings
|
||||
Result:=WarnForSuspiciousPackage(APackage);
|
||||
if NeedSaving then begin
|
||||
PackageGraph.SortAutoInstallDependencies;
|
||||
SaveAutoInstallDependencies;
|
||||
end;
|
||||
|
||||
// save IDE build configs, so user can build IDE on command line
|
||||
BuildIDEFlags:=[blfDontClean,blfOnlyIDE];
|
||||
Result:=MainIDE.DoSaveBuildIDEConfigs(BuildIDEFlags);
|
||||
if Result<>mrOk then exit;
|
||||
for i:=0 to PkgList.Count-1 do begin
|
||||
RequiredPackage:=TLazPackage(PkgList[i]);
|
||||
Result:=WarnForSuspiciousPackage(RequiredPackage);
|
||||
if Result<>mrOk then exit;
|
||||
end;
|
||||
|
||||
// add packages to auto installed packages
|
||||
if GetPkgListIndex(APackage)<0 then
|
||||
PkgList.Add(APackage);
|
||||
NeedSaving:=false;
|
||||
for i:=0 to PkgList.Count-1 do begin
|
||||
RequiredPackage:=TLazPackage(PkgList[i]);
|
||||
if RequiredPackage.AutoInstall=pitNope then begin
|
||||
RequiredPackage.AutoInstall:=pitStatic;
|
||||
Dependency:=RequiredPackage.CreateDependencyWithOwner(Self);
|
||||
Dependency.AddToList(PackageGraph.FirstAutoInstallDependency,pdlRequires);
|
||||
PackageGraph.OpenDependency(Dependency,false);
|
||||
NeedSaving:=true;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
PackageGraph.EndUpdate;
|
||||
PkgList.Free;
|
||||
BuildBoss.SetBuildTargetProject1;
|
||||
end;
|
||||
|
||||
if NeedSaving then begin
|
||||
PackageGraph.SortAutoInstallDependencies;
|
||||
SaveAutoInstallDependencies;
|
||||
end;
|
||||
|
||||
// save IDE build configs, so user can build IDE on command line
|
||||
BuildIDEFlags:=[blfDontClean,blfOnlyIDE];
|
||||
Result:=MainIDE.DoSaveBuildIDEConfigs(BuildIDEFlags);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
// ask user to rebuild Lazarus now
|
||||
Result:=IDEMessageDialog(lisPkgMangRebuildLazarus,
|
||||
Format(lisPkgMangThePackageWasMarkedForInstallationCurrentlyLazarus,
|
||||
@ -5426,7 +5433,7 @@ begin
|
||||
Result:=mrOk;
|
||||
exit;
|
||||
end;
|
||||
|
||||
|
||||
// rebuild Lazarus
|
||||
Result:=MainIDE.DoBuildLazarus(BuildIDEFlags);
|
||||
if Result<>mrOk then exit;
|
||||
|
Loading…
Reference in New Issue
Block a user