mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 16:40:54 +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;
|
destructor Destroy; override;
|
||||||
property HasGUI: boolean read FHasGUI write FHasGUI;
|
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 GetBuildMacroOverride(const MacroName: string): string; virtual; abstract;
|
||||||
function GetBuildMacroOverrides: TStrings; virtual; abstract;
|
function GetBuildMacroOverrides: TStrings; virtual; abstract;
|
||||||
function GetTargetOS: string; virtual; abstract;
|
function GetTargetOS: string; virtual; abstract;
|
||||||
|
@ -223,10 +223,10 @@ type
|
|||||||
// methods for building IDE (will be changed when project groups are there)
|
// methods for building IDE (will be changed when project groups are there)
|
||||||
procedure SetBuildTarget(const TargetOS, TargetCPU, LCLWidgetType: string;
|
procedure SetBuildTarget(const TargetOS, TargetCPU, LCLWidgetType: string;
|
||||||
ScanFPCSrc: TScanModeFPCSources; Quiet: boolean);
|
ScanFPCSrc: TScanModeFPCSources; Quiet: boolean);
|
||||||
procedure SetBuildTargetProject1(Quiet: boolean;
|
procedure SetBuildTargetProject1; override; overload;
|
||||||
ScanFPCSrc: TScanModeFPCSources = smsfsBackground);
|
procedure SetBuildTargetProject1(Quiet: boolean; ScanFPCSrc: TScanModeFPCSources = smsfsBackground); overload;
|
||||||
procedure SetBuildTargetIDE;
|
procedure SetBuildTargetIDE; override;
|
||||||
function BuildTargetIDEIsDefault: boolean;
|
function BuildTargetIDEIsDefault: boolean; override;
|
||||||
|
|
||||||
property FPCSrcScans: TFPCSrcScans read FFPCSrcScans;
|
property FPCSrcScans: TFPCSrcScans read FFPCSrcScans;
|
||||||
property BuildTarget: TObject read FBuildTarget; // TProject or nil
|
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]);
|
//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;
|
end;
|
||||||
|
|
||||||
|
procedure TBuildManager.SetBuildTargetProject1;
|
||||||
|
begin
|
||||||
|
SetBuildTargetProject1(true);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TBuildManager.SetBuildTargetProject1(Quiet: boolean;
|
procedure TBuildManager.SetBuildTargetProject1(Quiet: boolean;
|
||||||
ScanFPCSrc: TScanModeFPCSources);
|
ScanFPCSrc: TScanModeFPCSources);
|
||||||
begin
|
begin
|
||||||
|
@ -7285,7 +7285,6 @@ begin
|
|||||||
Builder:=TLazarusBuilder.Create;
|
Builder:=TLazarusBuilder.Create;
|
||||||
try
|
try
|
||||||
// prepare static auto install packages
|
// prepare static auto install packages
|
||||||
//PkgOptions:='';
|
|
||||||
// create inherited compiler options
|
// create inherited compiler options
|
||||||
Builder.PackageOptions:=PackageGraph.GetIDEInstallPackageOptions(InheritedOptionStrings{%H-});
|
Builder.PackageOptions:=PackageGraph.GetIDEInstallPackageOptions(InheritedOptionStrings{%H-});
|
||||||
|
|
||||||
|
@ -5310,113 +5310,120 @@ var
|
|||||||
begin
|
begin
|
||||||
if not MainIDE.DoResetToolStatus([rfInteractive]) then exit(mrCancel);
|
if not MainIDE.DoResetToolStatus([rfInteractive]) then exit(mrCancel);
|
||||||
|
|
||||||
PackageGraph.BeginUpdate(true);
|
|
||||||
PkgList:=nil;
|
|
||||||
try
|
try
|
||||||
// check if package is designtime package
|
BuildBoss.SetBuildTargetIDE;
|
||||||
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
|
PackageGraph.BeginUpdate(true);
|
||||||
if APackage.IsVirtual or APackage.Modified then begin
|
PkgList:=nil;
|
||||||
Result:=DoSavePackage(APackage,[]);
|
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;
|
if Result<>mrOk then exit;
|
||||||
end;
|
|
||||||
|
|
||||||
// check consistency
|
// get all required packages, which will also be auto installed
|
||||||
Result:=CheckPackageGraphForCompilation(APackage,nil,
|
APackage.GetAllRequiredPackages(PkgList,false);
|
||||||
EnvironmentOptions.GetParsedLazarusDirectory,false);
|
if PkgList=nil then PkgList:=TFPList.Create;
|
||||||
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;
|
|
||||||
|
|
||||||
// now PkgList contains only the required packages that were added to the
|
// remove packages already marked for installation
|
||||||
// list of installation packages
|
for i:=PkgList.Count-1 downto 0 do begin
|
||||||
// => show the user the list
|
RequiredPackage:=TLazPackage(PkgList[i]);
|
||||||
if PkgList.Count>0 then begin
|
if (RequiredPackage.AutoInstall<>pitNope) then
|
||||||
s:='';
|
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
|
for i:=0 to PkgList.Count-1 do begin
|
||||||
RequiredPackage:=TLazPackage(PkgList[i]);
|
RequiredPackage:=TLazPackage(PkgList[i]);
|
||||||
s:=s+RequiredPackage.IDAsString+LineEnding;
|
Result:=WarnForSuspiciousPackage(RequiredPackage);
|
||||||
|
if Result<>mrOk then exit;
|
||||||
end;
|
end;
|
||||||
if PkgList.Count=0 then
|
|
||||||
Msg:=Format(lisPkgMangInstallingThePackageWillAutomaticallyInstallThePac,
|
// add packages to auto installed packages
|
||||||
[APackage.IDAsString])
|
if GetPkgListIndex(APackage)<0 then
|
||||||
else
|
PkgList.Add(APackage);
|
||||||
Msg:=Format(lisPkgMangInstallingThePackageWillAutomaticallyInstallThePac2,
|
NeedSaving:=false;
|
||||||
[APackage.IDAsString]);
|
for i:=0 to PkgList.Count-1 do begin
|
||||||
Result:=IDEMessageDialog(lisPkgMangAutomaticallyInstalledPackages,
|
RequiredPackage:=TLazPackage(PkgList[i]);
|
||||||
Msg+LineEnding+s,mtConfirmation,[mbOk,mbCancel]);
|
if RequiredPackage.AutoInstall=pitNope then begin
|
||||||
if Result<>mrOk then exit;
|
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;
|
end;
|
||||||
|
|
||||||
// warn for packages with suspicious settings
|
if NeedSaving then begin
|
||||||
Result:=WarnForSuspiciousPackage(APackage);
|
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;
|
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
|
finally
|
||||||
PackageGraph.EndUpdate;
|
BuildBoss.SetBuildTargetProject1;
|
||||||
PkgList.Free;
|
|
||||||
end;
|
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
|
// ask user to rebuild Lazarus now
|
||||||
Result:=IDEMessageDialog(lisPkgMangRebuildLazarus,
|
Result:=IDEMessageDialog(lisPkgMangRebuildLazarus,
|
||||||
Format(lisPkgMangThePackageWasMarkedForInstallationCurrentlyLazarus,
|
Format(lisPkgMangThePackageWasMarkedForInstallationCurrentlyLazarus,
|
||||||
@ -5426,7 +5433,7 @@ begin
|
|||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// rebuild Lazarus
|
// rebuild Lazarus
|
||||||
Result:=MainIDE.DoBuildLazarus(BuildIDEFlags);
|
Result:=MainIDE.DoBuildLazarus(BuildIDEFlags);
|
||||||
if Result<>mrOk then exit;
|
if Result<>mrOk then exit;
|
||||||
|
Loading…
Reference in New Issue
Block a user