mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 10:19:16 +02:00
lazbuild: fixed compilation
git-svn-id: trunk@9798 -
This commit is contained in:
parent
8cbbf72054
commit
73a7e056b6
@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
ToDo:
|
ToDo:
|
||||||
Separate the visual parts in the IDE from the package and build system.
|
Separate the visual parts in the IDE from the package and build system.
|
||||||
Then use the non visual parts here.
|
|
||||||
}
|
}
|
||||||
program lazbuild;
|
program lazbuild;
|
||||||
|
|
||||||
@ -31,10 +30,10 @@ program lazbuild;
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, CustApp, LCLProc, Forms, Controls, FileUtil,
|
Classes, SysUtils, CustApp, LCLProc, Forms, Controls, FileUtil,
|
||||||
CodeToolManager,
|
CodeToolManager, Laz_XMLCfg,
|
||||||
MacroIntf,
|
MacroIntf,
|
||||||
IDEProcs, InitialSetupDlgs, OutputFilter, Compiler,
|
IDEProcs, InitialSetupDlgs, OutputFilter, Compiler, TransferMacros,
|
||||||
EnvironmentOpts, IDETranslations, LazarusIDEStrConsts, LazConf, MainIntf,
|
EnvironmentOpts, IDETranslations, LazarusIDEStrConsts, LazConf,
|
||||||
BasePkgManager, PackageDefs, PackageLinks, PackageSystem;
|
BasePkgManager, PackageDefs, PackageLinks, PackageSystem;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -52,6 +51,7 @@ type
|
|||||||
ErrorOccurred: boolean);
|
ErrorOccurred: boolean);
|
||||||
procedure OnExtToolNeedsOutputFilter(var OutputFilter: TOutputFilter;
|
procedure OnExtToolNeedsOutputFilter(var OutputFilter: TOutputFilter;
|
||||||
var Abort: boolean);
|
var Abort: boolean);
|
||||||
|
procedure OnCmdLineCreate(var CmdLine: string; var Abort: boolean);
|
||||||
|
|
||||||
// global package functions
|
// global package functions
|
||||||
procedure GetDependencyOwnerDescription(Dependency: TPkgDependency;
|
procedure GetDependencyOwnerDescription(Dependency: TPkgDependency;
|
||||||
@ -64,12 +64,13 @@ type
|
|||||||
procedure PackageGraphAddPackage(Pkg: TLazPackage);
|
procedure PackageGraphAddPackage(Pkg: TLazPackage);
|
||||||
protected
|
protected
|
||||||
function BuildFile(Filename: string): boolean;
|
function BuildFile(Filename: string): boolean;
|
||||||
function BuildPackage(const Filename: string): boolean;
|
function BuildPackage(const AFilename: string): boolean;
|
||||||
function LoadPackage(const Filename: string): TLazPackage;
|
function LoadPackage(const AFilename: string): TLazPackage;
|
||||||
function Init: boolean;
|
function Init: boolean;
|
||||||
procedure LoadEnvironmentOptions;
|
procedure LoadEnvironmentOptions;
|
||||||
procedure SetupOutputFilter;
|
procedure SetupOutputFilter;
|
||||||
procedure SetupCompilerInterface;
|
procedure SetupCompilerInterface;
|
||||||
|
procedure SetupMacros;
|
||||||
procedure SetupPackageSystem;
|
procedure SetupPackageSystem;
|
||||||
public
|
public
|
||||||
Files: TStringList;
|
Files: TStringList;
|
||||||
@ -95,6 +96,13 @@ begin
|
|||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TLazBuildApplication.OnCmdLineCreate(var CmdLine: string;
|
||||||
|
var Abort: boolean);
|
||||||
|
// replace all transfer macros in command line
|
||||||
|
begin
|
||||||
|
Abort:=not GlobalMacroList.SubstituteStr(CmdLine);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLazBuildApplication.GetDependencyOwnerDescription(
|
procedure TLazBuildApplication.GetDependencyOwnerDescription(
|
||||||
Dependency: TPkgDependency; var Description: string);
|
Dependency: TPkgDependency; var Description: string);
|
||||||
begin
|
begin
|
||||||
@ -147,13 +155,22 @@ begin
|
|||||||
Result:=BuildPackage(Filename);
|
Result:=BuildPackage(Filename);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLazBuildApplication.BuildPackage(const Filename: string): boolean;
|
function TLazBuildApplication.BuildPackage(const AFilename: string): boolean;
|
||||||
|
var
|
||||||
|
APackage: TLazPackage;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
Init;
|
Init;
|
||||||
|
APackage:=LoadPackage(AFilename);
|
||||||
|
if APackage=nil then
|
||||||
|
Error('unable to load package "'+AFilename+'"');
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLazBuildApplication.LoadPackage(const Filename: string): TLazPackage;
|
function TLazBuildApplication.LoadPackage(const AFilename: string): TLazPackage;
|
||||||
|
var
|
||||||
|
XMLConfig: TXMLConfig;
|
||||||
|
ConflictPkg: TLazPackage;
|
||||||
begin
|
begin
|
||||||
// check if package is already loaded
|
// check if package is already loaded
|
||||||
Result:=PackageGraph.FindPackageWithFilename(AFilename,true);
|
Result:=PackageGraph.FindPackageWithFilename(AFilename,true);
|
||||||
@ -162,17 +179,15 @@ begin
|
|||||||
// load the package file
|
// load the package file
|
||||||
XMLConfig:=TXMLConfig.Create(AFilename);
|
XMLConfig:=TXMLConfig.Create(AFilename);
|
||||||
try
|
try
|
||||||
APackage.Filename:=AFilename;
|
Result.Filename:=AFilename;
|
||||||
APackage.LoadFromXMLConfig(XMLConfig,'Package/');
|
Result.LoadFromXMLConfig(XMLConfig,'Package/');
|
||||||
finally
|
finally
|
||||||
XMLConfig.Free;
|
XMLConfig.Free;
|
||||||
end;
|
end;
|
||||||
// check Package Name
|
// check Package Name
|
||||||
if (Result.Name='') or (not IsValidIdent(Result.Name)) then begin
|
if (Result.Name='') or (not IsValidIdent(Result.Name)) then begin
|
||||||
Error(
|
Error(Format(lisPkgMangThePackageNameOfTheFileIsInvalid, ['"', Result.Name,
|
||||||
Format(lisPkgMangThePackageNameOfTheFileIsInvalid, ['"', Result.Name,
|
'"', #13, '"', Result.Filename, '"']));
|
||||||
'"', #13, '"', Result.Filename, '"']),
|
|
||||||
mtError,[mbCancel,mbAbort],0);
|
|
||||||
end;
|
end;
|
||||||
// check if Package with same name is already loaded
|
// check if Package with same name is already loaded
|
||||||
ConflictPkg:=PackageGraph.FindAPackageWithName(Result.Name,nil);
|
ConflictPkg:=PackageGraph.FindAPackageWithName(Result.Name,nil);
|
||||||
@ -201,7 +216,7 @@ begin
|
|||||||
InteractiveSetup:=false;
|
InteractiveSetup:=false;
|
||||||
SetupCompilerFilename(InteractiveSetup);
|
SetupCompilerFilename(InteractiveSetup);
|
||||||
SetupLazarusDirectory(InteractiveSetup);
|
SetupLazarusDirectory(InteractiveSetup);
|
||||||
//SetupMacros;
|
SetupMacros;
|
||||||
SetupPackageSystem;
|
SetupPackageSystem;
|
||||||
SetupOutputFilter;
|
SetupOutputFilter;
|
||||||
SetupCompilerInterface;
|
SetupCompilerInterface;
|
||||||
@ -242,6 +257,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TLazBuildApplication.SetupMacros;
|
||||||
|
begin
|
||||||
|
GlobalMacroList:=TTransferMacroList.Create;
|
||||||
|
IDEMacros:=TLazIDEMacros.Create;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLazBuildApplication.SetupPackageSystem;
|
procedure TLazBuildApplication.SetupPackageSystem;
|
||||||
begin
|
begin
|
||||||
OnGetDependencyOwnerDescription:=@GetDependencyOwnerDescription;
|
OnGetDependencyOwnerDescription:=@GetDependencyOwnerDescription;
|
||||||
@ -251,24 +272,10 @@ begin
|
|||||||
// package links
|
// package links
|
||||||
PkgLinks:=TPackageLinks.Create;
|
PkgLinks:=TPackageLinks.Create;
|
||||||
PkgLinks.UpdateAll;
|
PkgLinks.UpdateAll;
|
||||||
//PkgLinks.DependencyOwnerGetPkgFilename:=@PkgLinksDependencyOwnerGetPkgFilename;
|
|
||||||
|
|
||||||
// package graph
|
// package graph
|
||||||
PackageGraph:=TLazPackageGraph.Create;
|
PackageGraph:=TLazPackageGraph.Create;
|
||||||
//PackageGraph.OnChangePackageName:=@PackageGraphChangePackageName;
|
|
||||||
PackageGraph.OnAddPackage:=@PackageGraphAddPackage;
|
PackageGraph.OnAddPackage:=@PackageGraphAddPackage;
|
||||||
//PackageGraph.OnDeletePackage:=@PackageGraphDeletePackage;
|
|
||||||
//PackageGraph.OnDependencyModified:=@PackageGraphDependencyModified;
|
|
||||||
//PackageGraph.OnBeginUpdate:=@PackageGraphBeginUpdate;
|
|
||||||
//PackageGraph.OnEndUpdate:=@PackageGraphEndUpdate;
|
|
||||||
|
|
||||||
// package macros
|
|
||||||
{CodeToolBoss.DefineTree.MacroFunctions.AddExtended(
|
|
||||||
'PKGSRCPATH',nil,@MacroFunctionPkgSrcPath);
|
|
||||||
CodeToolBoss.DefineTree.MacroFunctions.AddExtended(
|
|
||||||
'PKGUNITPATH',nil,@MacroFunctionPkgUnitPath);
|
|
||||||
CodeToolBoss.DefineTree.MacroFunctions.AddExtended(
|
|
||||||
'PKGINCPATH',nil,@MacroFunctionPkgIncPath);}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TLazBuildApplication.Create(TheOwner: TComponent);
|
constructor TLazBuildApplication.Create(TheOwner: TComponent);
|
||||||
@ -286,8 +293,8 @@ begin
|
|||||||
FreeThenNil(PkgLinks);
|
FreeThenNil(PkgLinks);
|
||||||
FreeThenNil(TheCompiler);
|
FreeThenNil(TheCompiler);
|
||||||
FreeThenNil(TheOutputFilter);
|
FreeThenNil(TheOutputFilter);
|
||||||
//FreeThenNil(MacroList);
|
FreeThenNil(GlobalMacroList);
|
||||||
//FreeThenNil(IDEMacros);
|
FreeThenNil(IDEMacros);
|
||||||
FreeThenNil(EnvironmentOptions);
|
FreeThenNil(EnvironmentOptions);
|
||||||
|
|
||||||
FreeAndNil(Files);
|
FreeAndNil(Files);
|
||||||
|
Loading…
Reference in New Issue
Block a user