lazbuild: added option --skip-dependencies

git-svn-id: trunk@9826 -
This commit is contained in:
mattias 2006-09-07 00:53:04 +00:00
parent fc1679300f
commit 15c69600cf

View File

@ -49,6 +49,7 @@ type
private private
FBuildAll: boolean; FBuildAll: boolean;
FBuildRecursive: boolean; FBuildRecursive: boolean;
FSkipDependencies: boolean;
fInitialized: boolean; fInitialized: boolean;
fInitResult: boolean; fInitResult: boolean;
// external tools // external tools
@ -111,6 +112,8 @@ type
property BuildAll: boolean read FBuildAll write FBuildAll;// build all files of project/package property BuildAll: boolean read FBuildAll write FBuildAll;// build all files of project/package
property BuildRecursive: boolean read FBuildRecursive // apply BuildAll flag to dependencies property BuildRecursive: boolean read FBuildRecursive // apply BuildAll flag to dependencies
write FBuildRecursive; write FBuildRecursive;
property SkipDependencies: boolean read FSkipDependencies
write FSkipDependencies;
end; end;
var var
@ -293,6 +296,8 @@ begin
Include(Flags,pcfOnlyIfNeeded); Include(Flags,pcfOnlyIfNeeded);
if BuildRecursive and BuildAll then if BuildRecursive and BuildAll then
Include(Flags,pcfCompileDependenciesClean); Include(Flags,pcfCompileDependenciesClean);
if SkipDependencies then
Include(Flags,pcfDoNotCompileDependencies);
CompilePackage(APackage,Flags); CompilePackage(APackage,Flags);
Result:=true; Result:=true;
@ -402,7 +407,6 @@ end;
function TLazBuildApplication.BuildProject(const AFilename: string): boolean; function TLazBuildApplication.BuildProject(const AFilename: string): boolean;
var var
PkgFlags: TPkgCompileFlags;
CompilerFilename: String; CompilerFilename: String;
WorkingDir: String; WorkingDir: String;
SrcFilename: String; SrcFilename: String;
@ -420,20 +424,22 @@ begin
if Project1.MainUnitInfo=nil then if Project1.MainUnitInfo=nil then
Error(ErrorBuildFailed,'project has no main unit'); Error(ErrorBuildFailed,'project has no main unit');
// compile required packages if not SkipDependencies then begin
CheckPackageGraphForCompilation(nil,Project1.FirstRequiredDependency); // compile required packages
CheckPackageGraphForCompilation(nil,Project1.FirstRequiredDependency);
PackageGraph.BeginUpdate(false); PackageGraph.BeginUpdate(false);
try try
// automatically compile required packages // automatically compile required packages
if PackageGraph.CompileRequiredPackages(nil, if PackageGraph.CompileRequiredPackages(nil,
Project1.FirstRequiredDependency, Project1.FirstRequiredDependency,
Project1.CompilerOptions.Globals, Project1.CompilerOptions.Globals,
[pupAsNeeded])<>mrOk [pupAsNeeded])<>mrOk
then then
Error(ErrorBuildFailed,'Project dependencies of '+AFilename); Error(ErrorBuildFailed,'Project dependencies of '+AFilename);
finally finally
PackageGraph.EndUpdate; PackageGraph.EndUpdate;
end;
end; end;
WorkingDir:=Project1.ProjectDirectory; WorkingDir:=Project1.ProjectDirectory;
@ -809,7 +815,8 @@ begin
LongOptions.Add('language'); LongOptions.Add('language');
LongOptions.Add('build-all'); LongOptions.Add('build-all');
LongOptions.Add('recursive'); LongOptions.Add('recursive');
ErrorMsg:=RepairedCheckOptions('lBR',LongOptions,Options,NonOptions); LongOptions.Add('skip-dependencies');
ErrorMsg:=RepairedCheckOptions('lBrd',LongOptions,Options,NonOptions);
if ErrorMsg<>'' then begin if ErrorMsg<>'' then begin
writeln(ErrorMsg); writeln(ErrorMsg);
writeln(''); writeln('');
@ -839,8 +846,10 @@ begin
// build all // build all
if HasOption('B','build-all') then if HasOption('B','build-all') then
BuildAll:=true; BuildAll:=true;
if HasOption('R','recursive') then if HasOption('r','recursive') then
BuildRecursive:=true; BuildRecursive:=true;
if HasOption('d','skip-dependencies') then
SkipDependencies:=true;
finally finally
Options.Free; Options.Free;
NonOptions.Free; NonOptions.Free;
@ -859,10 +868,11 @@ begin
writeln(''); writeln('');
writeln('Options:'); writeln('Options:');
writeln(''); writeln('');
writeln('--help or -? ', listhisHelpMessage); writeln('--help or -? ', listhisHelpMessage);
writeln(''); writeln('');
writeln('-B or --build-all ','build all files of project/package'); writeln('-B or --build-all ','build all files of project/package');
writeln('-R or --recursive ','apply build flags (-B) to dependencies too.'); writeln('-r or --recursive ','apply build flags (-B) to dependencies too.');
writeln('-d or --skip-dependencies ','do not compile dependencies');
writeln(''); writeln('');
writeln(PrimaryConfPathOptLong,' <path>'); writeln(PrimaryConfPathOptLong,' <path>');
writeln('or ',PrimaryConfPathOptShort,' <path>'); writeln('or ',PrimaryConfPathOptShort,' <path>');