IDE: package editor: disable Compile button if package has no commands

git-svn-id: trunk@42639 -
This commit is contained in:
mattias 2013-09-06 13:55:32 +00:00
parent 736edb7c29
commit 00b45080ca
3 changed files with 30 additions and 3 deletions

View File

@ -350,6 +350,7 @@ type
procedure IncreaseChangeStamp;
property OnChanged: TNotifyEvent read FOnChanged write FOnChanged;
function GetParsedCommand: string; // resolved macros
function HasCommands: boolean; // true if there is something to execute
public
property Owner: TObject read FOwner;
property Command: string read FCommand write SetCommand;
@ -536,6 +537,7 @@ type
function GetDefaultMainSourceFileName: string; virtual;
function CanBeDefaulForProject: boolean; virtual;
function NeedsLinkerOpts: boolean;
function HasCommands: boolean; // true if there is at least one commad to execute
function GetEffectiveTargetOS: string; override;
function GetEffectiveTargetCPU: string; override;
function GetEffectiveLCLWidgetType: string; override;
@ -2052,6 +2054,16 @@ begin
Result:=not (ccloNoLinkerOpts in fDefaultMakeOptionsFlags);
end;
function TBaseCompilerOptions.HasCommands: boolean;
begin
Result:=true;
if CreateMakefileOnBuild then exit;
if CompilerPath<>'' then exit;
if ExecuteBefore.HasCommands then exit;
if ExecuteAfter.HasCommands then exit;
Result:=false;
end;
function TBaseCompilerOptions.GetEffectiveTargetOS: string;
var
Vars: TCTCfgScriptVariables;
@ -4252,6 +4264,13 @@ begin
Result:=FParsedCommand;
end;
function TCompilationToolOptions.HasCommands: boolean;
begin
Result:=true;
if GetParsedCommand<>'' then exit;
Result:=false;
end;
{ TIDEBuildMacro }
procedure TIDEBuildMacro.SetIdentifier(const AValue: string);

View File

@ -31,12 +31,14 @@ interface
uses
// LCL FCL
Classes, SysUtils, Forms, Controls, StdCtrls, ComCtrls, Buttons, Graphics, LCLType, LCLProc, Menus, Dialogs, FileUtil,
Classes, SysUtils, Forms, Controls, StdCtrls, ComCtrls, Buttons, Graphics,
LCLType, LCLProc, Menus, Dialogs, FileUtil,
contnrs,
// IDEIntf CodeTools
IDEImagesIntf, MenuIntf, ExtCtrls, LazIDEIntf, ProjectIntf,
CodeToolsStructs, FormEditingIntf, TreeFilterEdit, PackageIntf,
IDEDialogs, IDEHelpIntf, IDEOptionsIntf, IDEProcs, LazarusIDEStrConsts, IDEDefs, CompilerOptions, ComponentReg,
IDEDialogs, IDEHelpIntf, IDEOptionsIntf, IDEProcs, LazarusIDEStrConsts,
IDEDefs, CompilerOptions, ComponentReg,
PackageDefs, AddToPackageDlg, PkgVirtualUnitEditor,
MissingPkgFilesDlg, PackageSystem, CleanPkgDeps;
@ -1703,7 +1705,7 @@ begin
SaveBitBtn.Enabled:=(not LazPackage.ReadOnly)
and (LazPackage.IsVirtual or LazPackage.Modified);
CompileBitBtn.Enabled:=(not LazPackage.IsVirtual);
CompileBitBtn.Enabled:=(not LazPackage.IsVirtual) and LazPackage.CompilerOptions.HasCommands;
AddBitBtn.Enabled:=not LazPackage.ReadOnly;
RemoveBitBtn.Enabled:=(not LazPackage.ReadOnly)
and (not Removed)

View File

@ -3373,6 +3373,12 @@ begin
end;
end;
if not APackage.CompilerOptions.HasCommands then begin
// package provides no compilation
Result:=mrOk;
exit;
end;
// check if compilation is needed and if a clean build is needed
NeedBuildAllFlag:=false;
Note:='';