mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 09:49:22 +02:00
implemented showing auto installed packages
git-svn-id: trunk@4105 -
This commit is contained in:
parent
e291edc8ee
commit
fb8cb0e064
@ -2549,10 +2549,10 @@ Initialization
|
||||
LoadEnvironment;
|
||||
{ heaptrc can be disabled from the environment }
|
||||
if useheaptrace then
|
||||
TraceInit;
|
||||
TraceInit;
|
||||
finalization
|
||||
if useheaptrace then
|
||||
TraceExit;
|
||||
TraceExit;
|
||||
end.
|
||||
|
||||
{$endif VER1_1}
|
||||
@ -2560,6 +2560,9 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.20 2003/04/28 11:44:58 mattias
|
||||
implemented showing auto installed packages
|
||||
|
||||
Revision 1.19 2003/04/12 09:26:58 mattias
|
||||
fixes for current fpc 1.1
|
||||
|
||||
|
@ -125,6 +125,9 @@ begin
|
||||
'Filename: '+CurPkg.Filename;
|
||||
if CurPkg.AutoCreated then
|
||||
HintStr:=HintStr+EndOfLine+'This package was automatically created';
|
||||
if CurPkg.Missing then
|
||||
HintStr:=HintStr+EndOfLine+'This package is installed, '
|
||||
+'but the lpk file was not found';
|
||||
HintStr:=HintStr+EndOfLine+'Description: '
|
||||
+BreakString(CurPkg.Description,60,length('Description: '));
|
||||
HintMemo.Text:=HintStr;
|
||||
@ -242,7 +245,7 @@ begin
|
||||
Cnt:=PackageGraph.Count;
|
||||
for i:=0 to Cnt-1 do begin
|
||||
CurPkg:=PackageGraph[i];
|
||||
if not (CurPkg.Installed in [pitStatic,pitDynamic]) then continue;
|
||||
//if not (CurPkg.Installed in [pitStatic,pitDynamic]) then continue;
|
||||
if PkgListView.Items.Count>i then begin
|
||||
CurListItem:=PkgListView.Items[i];
|
||||
CurListItem.SubItems[0]:=CurPkg.Version.AsString;
|
||||
|
@ -1902,14 +1902,28 @@ begin
|
||||
if UsedUnits<>'' then
|
||||
UsedUnits:=UsedUnits+', ';
|
||||
UsedUnits:=UsedUnits+CurUnitName;
|
||||
if CurFile.HasRegisterProc then begin
|
||||
if (APackage.PackageType in [lptDesignTime,lptRunAndDesignTime])
|
||||
and CurFile.HasRegisterProc then begin
|
||||
RegistrationCode:=RegistrationCode+
|
||||
' RegisterUnit('''+CurUnitName+''',@'+CurUnitName+'.Register);'+e;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
// append registration code only for design time packages
|
||||
if (APackage.PackageType in [lptDesignTime,lptRunAndDesignTime]) then begin
|
||||
RegistrationCode:=
|
||||
+'procedure Register;'+e
|
||||
+'begin'+e
|
||||
+RegistrationCode
|
||||
+'end;'+e
|
||||
+e
|
||||
+'initialization'+e
|
||||
+' RegisterPackage('''+APackage.Name+''',@Register)'
|
||||
+e;
|
||||
if UsedUnits<>'' then UsedUnits:=UsedUnits+', ';
|
||||
UsedUnits:=UsedUnits+'LazarusPackageIntf';
|
||||
end;
|
||||
|
||||
// create source
|
||||
HeaderSrc:=
|
||||
@ -1921,20 +1935,16 @@ begin
|
||||
Src:='unit '+APackage.Name+';'+e
|
||||
+e
|
||||
+'interface'+e
|
||||
+e
|
||||
+e;
|
||||
if UsedUnits<>'' then
|
||||
Src:=Src
|
||||
+'uses'+e
|
||||
+' '+UsedUnits+', LazarusPackageIntf;'+e
|
||||
+e
|
||||
+' '+UsedUnits+';'+e
|
||||
+e;
|
||||
Src:=Src+
|
||||
+'implementation'+e
|
||||
+e
|
||||
+'procedure Register;'+e
|
||||
+'begin'+e
|
||||
+RegistrationCode
|
||||
+'end;'+e
|
||||
+e
|
||||
+'initialization'+e
|
||||
+' RegisterPackage('''+APackage.Name+''',@Register)'
|
||||
+e
|
||||
+'end.'+e;
|
||||
Src:=CodeToolBoss.SourceChangeCache.BeautifyCodeOptions.
|
||||
BeautifyStatement(Src,0);
|
||||
@ -2036,8 +2046,14 @@ end;
|
||||
function TPkgManager.DoInstallPackage(APackage: TLazPackage): TModalResult;
|
||||
var
|
||||
Dependency: TPkgDependency;
|
||||
PkgList: TList;
|
||||
i: Integer;
|
||||
s: String;
|
||||
NeedSaving: Boolean;
|
||||
RequiredPackage: TLazPackage;
|
||||
begin
|
||||
PackageGraph.BeginUpdate(false);
|
||||
PkgList:=nil;
|
||||
try
|
||||
// check if package is designtime package
|
||||
if APackage.PackageType=lptRunTime then begin
|
||||
@ -2057,16 +2073,46 @@ begin
|
||||
// check consistency
|
||||
Result:=CheckPackageGraphForCompilation(APackage,nil);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
// add package to auto installed packages
|
||||
if APackage.AutoInstall=pitNope then begin
|
||||
APackage.AutoInstall:=pitStatic;
|
||||
Dependency:=APackage.CreateDependencyForThisPkg;
|
||||
Dependency.AddToList(FirstAutoInstallDependency,pdlRequires);
|
||||
PackageGraph.OpenDependency(Dependency);
|
||||
SaveAutoInstallDependencies;
|
||||
end;
|
||||
|
||||
// get all required packages, which will also be auto installed
|
||||
APackage.GetAllRequiredPackages(PkgList);
|
||||
if PkgList=nil then PkgList:=TList.Create;
|
||||
|
||||
for i:=PkgList.Count-1 downto 0 do begin
|
||||
RequiredPackage:=TLazPackage(PkgList[i]);
|
||||
if RequiredPackage.AutoInstall<>pitNope then
|
||||
PkgList.Delete(i);
|
||||
end;
|
||||
if PkgList.Count>0 then begin
|
||||
s:='';
|
||||
for i:=0 to PkgList.Count-1 do begin
|
||||
RequiredPackage:=TLazPackage(PkgList[i]);
|
||||
s:=s+RequiredPackage.IDAsString+#13;
|
||||
end;
|
||||
Result:=MessageDlg('Automatically installed packages',
|
||||
'Installing the package '+APackage.IDAsString+' will automatically '
|
||||
+'install the package(s):'#13
|
||||
+s,
|
||||
mtConfirmation,[mbOk,mbCancel,mbAbort],0);
|
||||
if Result<>mrOk then exit;
|
||||
end;
|
||||
|
||||
// add packages to auto installed packages
|
||||
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.CreateDependencyForThisPkg;
|
||||
Dependency.AddToList(FirstAutoInstallDependency,pdlRequires);
|
||||
PackageGraph.OpenDependency(Dependency);
|
||||
NeedSaving:=true;
|
||||
end;
|
||||
end;
|
||||
if NeedSaving then
|
||||
SaveAutoInstallDependencies;
|
||||
|
||||
// ask user to rebuilt Lazarus now
|
||||
Result:=MessageDlg('Rebuild Lazarus?',
|
||||
'The package "'+APackage.IDAsString+'" was marked for installation.'#13
|
||||
@ -2086,6 +2132,7 @@ begin
|
||||
|
||||
finally
|
||||
PackageGraph.EndUpdate;
|
||||
PkgList.Free;
|
||||
end;
|
||||
Result:=mrOk;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user