mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-05 23:58:06 +02:00
IDE: compile IDE with only base packages
git-svn-id: trunk@28612 -
This commit is contained in:
parent
512bbdeb86
commit
98d8c393c9
@ -1880,7 +1880,7 @@ begin
|
||||
NewTargetOS:=GetDefaultTargetOS;
|
||||
if (NewTargetCPU='') or (NewTargetCPU='default') then
|
||||
NewTargetCPU:=GetDefaultTargetCPU;
|
||||
//debugln(['TBuildManager.SetBuildTargetIDE OS=',NewTargetOS,' CPU=',NewTargetCPU,' WS=',NewLCLWidgetSet]);
|
||||
debugln(['TBuildManager.SetBuildTargetIDE OS=',NewTargetOS,' CPU=',NewTargetCPU,' WS=',NewLCLWidgetSet]);
|
||||
SetBuildTarget(NewTargetOS,NewTargetCPU,NewLCLWidgetSet,bmsfsBackground);
|
||||
end;
|
||||
|
||||
|
74
ide/main.pp
74
ide/main.pp
@ -11498,7 +11498,8 @@ begin
|
||||
if (blfWithStaticPackages in Flags)
|
||||
or MiscellaneousOptions.BuildLazOpts.WithStaticPackages then begin
|
||||
// create inherited compiler options
|
||||
PkgOptions:=PkgBoss.DoGetIDEInstallPackageOptions(InheritedOptionStrings);
|
||||
PkgOptions:=PackageGraph.GetIDEInstallPackageOptions(
|
||||
PackageGraph.FirstAutoInstallDependency,InheritedOptionStrings);
|
||||
|
||||
// check ambiguous units
|
||||
CodeToolBoss.GetFPCVersionForDirectory(
|
||||
@ -11521,6 +11522,7 @@ var
|
||||
InheritedOptionStrings: TInheritedCompOptsStrings;
|
||||
CompiledUnitExt: String;
|
||||
FPCVersion, FPCRelease, FPCPatch: integer;
|
||||
OnlyBase: boolean;
|
||||
begin
|
||||
if ToolStatus<>itNone then begin
|
||||
MessageDlg(lisNotNow,
|
||||
@ -11556,57 +11558,65 @@ begin
|
||||
end;
|
||||
|
||||
// then compile the 'installed' packages
|
||||
if ([blfWithStaticPackages,blfOnlyIDE]*Flags=[])
|
||||
if (not (blfOnlyIDE in Flags))
|
||||
and (MiscellaneousOptions.BuildLazProfiles.CurrentIdeMode=mmNone) then begin
|
||||
CompileProgress.Ready;
|
||||
Result:=mrIgnore;
|
||||
exit;
|
||||
end;
|
||||
|
||||
OnlyBase:=not (blfWithStaticPackages in Flags);
|
||||
|
||||
// prepare static auto install packages
|
||||
PkgOptions:='';
|
||||
if (blfWithStaticPackages in Flags)
|
||||
or MiscellaneousOptions.BuildLazOpts.WithStaticPackages then begin
|
||||
// compile auto install static packages
|
||||
Result:=PkgBoss.DoCompileAutoInstallPackages([]);
|
||||
if Result<>mrOk then begin
|
||||
DebugLn('TMainIDE.DoBuildLazarus: Compile AutoInstall Packages failed.');
|
||||
exit;
|
||||
end;
|
||||
// compile auto install static packages
|
||||
Result:=PkgBoss.DoCompileAutoInstallPackages([],OnlyBase);
|
||||
if Result<>mrOk then begin
|
||||
DebugLn('TMainIDE.DoBuildLazarus: Compile AutoInstall Packages failed.');
|
||||
exit;
|
||||
end;
|
||||
|
||||
// create uses section addition for lazarus.pp
|
||||
// create uses section addition for lazarus.pp
|
||||
if not OnlyBase then begin
|
||||
Result:=PkgBoss.DoSaveAutoInstallConfig;
|
||||
if Result<>mrOk then begin
|
||||
DebugLn('TMainIDE.DoBuildLazarus: Save AutoInstall Config failed.');
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
// create inherited compiler options
|
||||
PkgOptions:=PkgBoss.DoGetIDEInstallPackageOptions(InheritedOptionStrings);
|
||||
// create inherited compiler options
|
||||
if OnlyBase then
|
||||
PkgOptions:=''
|
||||
else
|
||||
PkgOptions:=PackageGraph.GetIDEInstallPackageOptions(
|
||||
PackageGraph.FirstAutoInstallDependency,InheritedOptionStrings);
|
||||
|
||||
// check ambiguous units
|
||||
CodeToolBoss.GetFPCVersionForDirectory(
|
||||
EnvironmentOptions.LazarusDirectory,
|
||||
FPCVersion,FPCRelease,FPCPatch);
|
||||
if FPCPatch=0 then ;
|
||||
CompiledUnitExt:=GetDefaultCompiledUnitExt(FPCVersion,FPCRelease);
|
||||
Result:=MainBuildBoss.CheckUnitPathForAmbiguousPascalFiles(
|
||||
EnvironmentOptions.LazarusDirectory,
|
||||
InheritedOptionStrings[icoUnitPath],
|
||||
CompiledUnitExt,'IDE');
|
||||
if Result<>mrOk then begin
|
||||
DebugLn('TMainIDE.DoBuildLazarus: Check UnitPath for ambiguous pascal files failed.');
|
||||
exit;
|
||||
end;
|
||||
// check ambiguous units
|
||||
CodeToolBoss.GetFPCVersionForDirectory(
|
||||
EnvironmentOptions.LazarusDirectory,
|
||||
FPCVersion,FPCRelease,FPCPatch);
|
||||
if FPCPatch=0 then ;
|
||||
CompiledUnitExt:=GetDefaultCompiledUnitExt(FPCVersion,FPCRelease);
|
||||
Result:=MainBuildBoss.CheckUnitPathForAmbiguousPascalFiles(
|
||||
EnvironmentOptions.LazarusDirectory+PathDelim+'ide',
|
||||
InheritedOptionStrings[icoUnitPath],
|
||||
CompiledUnitExt,'IDE');
|
||||
if Result<>mrOk then begin
|
||||
DebugLn('TMainIDE.DoBuildLazarus: Check UnitPath for ambiguous pascal files failed.');
|
||||
exit;
|
||||
end;
|
||||
|
||||
// save extra options
|
||||
IDEBuildFlags:=Flags+[blfOnlyIDE];
|
||||
Result:=SaveIDEMakeOptions(MiscellaneousOptions.BuildLazProfiles,
|
||||
GlobalMacroList,PkgOptions,IDEBuildFlags);
|
||||
if Result<>mrOk then begin
|
||||
DebugLn('TMainIDE.DoBuildLazarus: Save IDEMake options failed.');
|
||||
exit;
|
||||
if not OnlyBase then
|
||||
begin
|
||||
Result:=SaveIDEMakeOptions(MiscellaneousOptions.BuildLazProfiles,
|
||||
GlobalMacroList,PkgOptions,IDEBuildFlags);
|
||||
if Result<>mrOk then begin
|
||||
DebugLn('TMainIDE.DoBuildLazarus: Save IDEMake options failed.');
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
// make ide
|
||||
|
@ -139,13 +139,10 @@ type
|
||||
procedure LoadInstalledPackages; virtual; abstract;
|
||||
function DoShowOpenInstalledPckDlg: TModalResult; virtual; abstract;
|
||||
function ShowConfigureCustomComponents: TModalResult; virtual; abstract;
|
||||
function DoCompileAutoInstallPackages(Flags: TPkgCompileFlags
|
||||
): TModalResult; virtual; abstract;
|
||||
function DoCompileAutoInstallPackages(Flags: TPkgCompileFlags;
|
||||
OnlyBase: boolean): TModalResult; virtual; abstract;
|
||||
function DoSaveAutoInstallConfig: TModalResult; virtual; abstract;
|
||||
function DoGetIDEInstallPackageOptions(
|
||||
var InheritedOptionStrings: TInheritedCompOptsStrings
|
||||
): string; virtual; abstract;
|
||||
|
||||
|
||||
// components
|
||||
function GetUsableComponentUnits(CurRoot: TPersistent): TFPList; virtual; abstract; // list of TUnitInfo
|
||||
procedure IterateComponentNames(CurRoot: TPersistent; TypeData: PTypeData;
|
||||
|
@ -874,7 +874,7 @@ function GetPkgFileTypeLocalizedName(FileType: TPkgFileType): string;
|
||||
function NameToAutoUpdatePolicy(const s: string): TPackageUpdatePolicy;
|
||||
function FileNameToPkgFileType(const AFilename: string): TPkgFileType;
|
||||
|
||||
procedure SortDependencyList(Dependencies: TFPList);
|
||||
procedure SortDependencyListAlphabetically(Dependencies: TFPList);
|
||||
procedure LoadPkgDependencyList(XMLConfig: TXMLConfig; const ThePath: string;
|
||||
var First: TPkgDependency; ListType: TPkgDependencyList; Owner: TObject;
|
||||
HoldPackages, SortList: boolean);
|
||||
@ -897,6 +897,8 @@ function GetDependencyWithIndex(First: TPkgDependency;
|
||||
ListType: TPkgDependencyList; Index: integer): TPkgDependency;
|
||||
function IndexOfDependencyInList(First: TPkgDependency;
|
||||
ListType: TPkgDependencyList; FindDependency: TPkgDependency): integer;
|
||||
function GetFirstDependency(ListItem: TPkgDependency;
|
||||
ListType: TPkgDependencyList): TPkgDependency;
|
||||
|
||||
function FindLowestPkgDependencyWithName(const PkgName: string): TPkgDependency;
|
||||
function FindLowestPkgDependencyNodeWithName(const PkgName: string): TAVLTreeNode;
|
||||
@ -999,7 +1001,7 @@ begin
|
||||
PkgDependency.Free;
|
||||
end;
|
||||
if SortList then
|
||||
SortDependencyList(List);
|
||||
SortDependencyListAlphabetically(List);
|
||||
Last:=First;
|
||||
if Last<>nil then
|
||||
while Last.NextDependency[ListType]<>nil do
|
||||
@ -1072,7 +1074,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure SortDependencyList(Dependencies: TFPList);
|
||||
procedure SortDependencyListAlphabetically(Dependencies: TFPList);
|
||||
var
|
||||
Count: Integer;
|
||||
i, j: Integer;
|
||||
@ -1382,6 +1384,15 @@ begin
|
||||
Result:=-1;
|
||||
end;
|
||||
|
||||
function GetFirstDependency(ListItem: TPkgDependency;
|
||||
ListType: TPkgDependencyList): TPkgDependency;
|
||||
begin
|
||||
Result:=ListItem;
|
||||
if Result=nil then exit;
|
||||
while Result.PrevDependency[ListType]<>nil do
|
||||
Result:=Result.PrevDependency[ListType];
|
||||
end;
|
||||
|
||||
function FindLowestPkgDependencyWithName(const PkgName: string): TPkgDependency;
|
||||
var
|
||||
ANode: TAVLTreeNode;
|
||||
|
@ -299,7 +299,7 @@ type
|
||||
procedure LoadStaticBasePackages;
|
||||
procedure LoadAutoInstallPackages(PkgList: TStringList);
|
||||
procedure SortAutoInstallDependencies;
|
||||
function GetIDEInstallPackageOptions(
|
||||
function GetIDEInstallPackageOptions(FirstDependency: TPkgDependency;
|
||||
var InheritedOptionStrings: TInheritedCompOptsStrings): string;
|
||||
function SaveAutoInstallConfig: TModalResult;// for the uses section
|
||||
function IsStaticBasePackage(PackageName: string): boolean;
|
||||
@ -1947,6 +1947,7 @@ begin
|
||||
end;
|
||||
|
||||
function TLazPackageGraph.GetIDEInstallPackageOptions(
|
||||
FirstDependency: TPkgDependency;
|
||||
var InheritedOptionStrings: TInheritedCompOptsStrings): string;
|
||||
|
||||
procedure AddOption(const s: string);
|
||||
@ -1968,7 +1969,7 @@ begin
|
||||
|
||||
// get all required packages
|
||||
PkgList:=nil;
|
||||
OnGetAllRequiredPackages(PackageGraph.FirstAutoInstallDependency,PkgList);
|
||||
OnGetAllRequiredPackages(FirstDependency,PkgList);
|
||||
if PkgList=nil then exit;
|
||||
// get all usage options
|
||||
AddOptionsList:=GetUsageOptionsList(PkgList);
|
||||
|
@ -308,12 +308,9 @@ type
|
||||
CheckList: boolean = true): TModalResult;
|
||||
procedure DoTranslatePackage(APackage: TLazPackage);
|
||||
function DoOpenPackageSource(APackage: TLazPackage): TModalResult;
|
||||
function DoCompileAutoInstallPackages(Flags: TPkgCompileFlags
|
||||
): TModalResult; override;
|
||||
function DoCompileAutoInstallPackages(Flags: TPkgCompileFlags;
|
||||
OnlyBase: boolean): TModalResult; override;
|
||||
function DoSaveAutoInstallConfig: TModalResult; override;
|
||||
function DoGetIDEInstallPackageOptions(
|
||||
var InheritedOptionStrings: TInheritedCompOptsStrings
|
||||
): string; override;
|
||||
function DoPublishPackage(APackage: TLazPackage; Flags: TPkgSaveFlags;
|
||||
ShowDialog: boolean): TModalResult;
|
||||
|
||||
@ -3917,34 +3914,64 @@ begin
|
||||
Result:=MainIDE.DoOpenEditorFile(Filename,-1,-1,[ofRegularFile]);
|
||||
end;
|
||||
|
||||
function TPkgManager.DoCompileAutoInstallPackages(
|
||||
Flags: TPkgCompileFlags): TModalResult;
|
||||
function TPkgManager.DoCompileAutoInstallPackages(Flags: TPkgCompileFlags;
|
||||
OnlyBase: boolean): TModalResult;
|
||||
var
|
||||
Dependency: TPkgDependency;
|
||||
OldDependency: TPkgDependency;
|
||||
Dependencies: TPkgDependency;
|
||||
AutoRemove: Boolean;
|
||||
begin
|
||||
PackageGraph.BeginUpdate(false);
|
||||
Dependencies:=PackageGraph.FirstAutoInstallDependency;
|
||||
try
|
||||
Dependency:=PackageGraph.FirstAutoInstallDependency;
|
||||
if OnlyBase then
|
||||
begin
|
||||
// create the list of base packages
|
||||
OldDependency:=PackageGraph.FirstAutoInstallDependency;
|
||||
Dependencies:=nil;
|
||||
while OldDependency<>nil do begin
|
||||
if (OldDependency.RequiredPackage<>nil)
|
||||
and PackageGraph.IsStaticBasePackage(OldDependency.RequiredPackage.Name) then
|
||||
begin
|
||||
Dependency:=TPkgDependency.Create;
|
||||
Dependency.Assign(OldDependency);
|
||||
Dependency.AddToEndOfList(Dependencies,pdlRequires);
|
||||
end;
|
||||
OldDependency:=OldDependency.NextRequiresDependency;
|
||||
end;
|
||||
Dependencies:=GetFirstDependency(Dependencies,pdlRequires);
|
||||
PackageGraph.OpenRequiredDependencyList(Dependencies);
|
||||
end;
|
||||
|
||||
// check every installed package if it was loaded correctly
|
||||
Dependency:=Dependencies;
|
||||
AutoRemove:=false;
|
||||
while Dependency<>nil do begin
|
||||
OldDependency:=Dependency;
|
||||
Dependency:=Dependency.NextRequiresDependency;
|
||||
if OldDependency.LoadPackageResult<>lprSuccess then begin
|
||||
Result:=IDEMessageDialog(lisProjAddPackageNotFound,
|
||||
Format(lisPkgMangThePackageIsMarkedForInstallationButCanNotBeFound, [
|
||||
'"', OldDependency.AsString, '"', #13]),
|
||||
mtError,[mbYes,mbNo,mbAbort]);
|
||||
if Result=mrNo then Result:=mrCancel;
|
||||
if Result<>mrYes then exit;
|
||||
if not AutoRemove then begin
|
||||
Result:=IDEMessageDialog(lisProjAddPackageNotFound,
|
||||
Format(lisPkgMangThePackageIsMarkedForInstallationButCanNotBeFound, [
|
||||
'"', OldDependency.AsString, '"', #13]),
|
||||
mtError,[mbYes,mbYesToAll,mbAbort]);
|
||||
case Result of
|
||||
mrYes: ;
|
||||
mrYesToAll: AutoRemove:=true;
|
||||
else
|
||||
SaveAutoInstallDependencies(true);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
OldDependency.RemoveFromList(PackageGraph.FirstAutoInstallDependency,pdlRequires);
|
||||
OldDependency.Free;
|
||||
SaveAutoInstallDependencies(true);
|
||||
end;
|
||||
end;
|
||||
|
||||
SaveAutoInstallDependencies(true);
|
||||
|
||||
// check consistency
|
||||
Result:=CheckPackageGraphForCompilation(nil,
|
||||
PackageGraph.FirstAutoInstallDependency,
|
||||
Result:=CheckPackageGraphForCompilation(nil,Dependencies,
|
||||
EnvironmentOptions.LazarusDirectory,false);
|
||||
if Result<>mrOk then exit;
|
||||
//DebugLn(['TPkgManager.DoCompileAutoInstallPackages LCLUnitPath=',PackageGraph.LCLPackage.CompilerOptions.GetUnitPath(true)]);
|
||||
@ -3957,12 +3984,13 @@ begin
|
||||
|
||||
// compile all auto install dependencies
|
||||
MiscellaneousOptions.BuildLazProfiles.UpdateGlobals;
|
||||
Result:=PackageGraph.CompileRequiredPackages(nil,
|
||||
PackageGraph.FirstAutoInstallDependency,
|
||||
MiscellaneousOptions.BuildLazProfiles.Globals,[pupAsNeeded]);
|
||||
Result:=PackageGraph.CompileRequiredPackages(nil,Dependencies,
|
||||
MiscellaneousOptions.BuildLazProfiles.Globals,[pupAsNeeded]);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
finally
|
||||
if OnlyBase then
|
||||
FreeDependencyList(Dependencies,pdlRequires);
|
||||
PackageGraph.EndUpdate;
|
||||
end;
|
||||
Result:=mrOk;
|
||||
@ -3986,12 +4014,6 @@ begin
|
||||
Result:=PackageGraph.SaveAutoInstallConfig;
|
||||
end;
|
||||
|
||||
function TPkgManager.DoGetIDEInstallPackageOptions(
|
||||
var InheritedOptionStrings: TInheritedCompOptsStrings): string;
|
||||
begin
|
||||
Result:=PackageGraph.GetIDEInstallPackageOptions(InheritedOptionStrings);
|
||||
end;
|
||||
|
||||
function TPkgManager.DoPublishPackage(APackage: TLazPackage;
|
||||
Flags: TPkgSaveFlags; ShowDialog: boolean): TModalResult;
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user