mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-23 18:28:28 +02:00
IDE: package editor: disable Compile button if package has no commands
git-svn-id: trunk@42639 -
This commit is contained in:
parent
736edb7c29
commit
00b45080ca
@ -350,6 +350,7 @@ type
|
|||||||
procedure IncreaseChangeStamp;
|
procedure IncreaseChangeStamp;
|
||||||
property OnChanged: TNotifyEvent read FOnChanged write FOnChanged;
|
property OnChanged: TNotifyEvent read FOnChanged write FOnChanged;
|
||||||
function GetParsedCommand: string; // resolved macros
|
function GetParsedCommand: string; // resolved macros
|
||||||
|
function HasCommands: boolean; // true if there is something to execute
|
||||||
public
|
public
|
||||||
property Owner: TObject read FOwner;
|
property Owner: TObject read FOwner;
|
||||||
property Command: string read FCommand write SetCommand;
|
property Command: string read FCommand write SetCommand;
|
||||||
@ -536,6 +537,7 @@ type
|
|||||||
function GetDefaultMainSourceFileName: string; virtual;
|
function GetDefaultMainSourceFileName: string; virtual;
|
||||||
function CanBeDefaulForProject: boolean; virtual;
|
function CanBeDefaulForProject: boolean; virtual;
|
||||||
function NeedsLinkerOpts: boolean;
|
function NeedsLinkerOpts: boolean;
|
||||||
|
function HasCommands: boolean; // true if there is at least one commad to execute
|
||||||
function GetEffectiveTargetOS: string; override;
|
function GetEffectiveTargetOS: string; override;
|
||||||
function GetEffectiveTargetCPU: string; override;
|
function GetEffectiveTargetCPU: string; override;
|
||||||
function GetEffectiveLCLWidgetType: string; override;
|
function GetEffectiveLCLWidgetType: string; override;
|
||||||
@ -2052,6 +2054,16 @@ begin
|
|||||||
Result:=not (ccloNoLinkerOpts in fDefaultMakeOptionsFlags);
|
Result:=not (ccloNoLinkerOpts in fDefaultMakeOptionsFlags);
|
||||||
end;
|
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;
|
function TBaseCompilerOptions.GetEffectiveTargetOS: string;
|
||||||
var
|
var
|
||||||
Vars: TCTCfgScriptVariables;
|
Vars: TCTCfgScriptVariables;
|
||||||
@ -4252,6 +4264,13 @@ begin
|
|||||||
Result:=FParsedCommand;
|
Result:=FParsedCommand;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCompilationToolOptions.HasCommands: boolean;
|
||||||
|
begin
|
||||||
|
Result:=true;
|
||||||
|
if GetParsedCommand<>'' then exit;
|
||||||
|
Result:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TIDEBuildMacro }
|
{ TIDEBuildMacro }
|
||||||
|
|
||||||
procedure TIDEBuildMacro.SetIdentifier(const AValue: string);
|
procedure TIDEBuildMacro.SetIdentifier(const AValue: string);
|
||||||
|
@ -31,12 +31,14 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
// LCL FCL
|
// 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,
|
contnrs,
|
||||||
// IDEIntf CodeTools
|
// IDEIntf CodeTools
|
||||||
IDEImagesIntf, MenuIntf, ExtCtrls, LazIDEIntf, ProjectIntf,
|
IDEImagesIntf, MenuIntf, ExtCtrls, LazIDEIntf, ProjectIntf,
|
||||||
CodeToolsStructs, FormEditingIntf, TreeFilterEdit, PackageIntf,
|
CodeToolsStructs, FormEditingIntf, TreeFilterEdit, PackageIntf,
|
||||||
IDEDialogs, IDEHelpIntf, IDEOptionsIntf, IDEProcs, LazarusIDEStrConsts, IDEDefs, CompilerOptions, ComponentReg,
|
IDEDialogs, IDEHelpIntf, IDEOptionsIntf, IDEProcs, LazarusIDEStrConsts,
|
||||||
|
IDEDefs, CompilerOptions, ComponentReg,
|
||||||
PackageDefs, AddToPackageDlg, PkgVirtualUnitEditor,
|
PackageDefs, AddToPackageDlg, PkgVirtualUnitEditor,
|
||||||
MissingPkgFilesDlg, PackageSystem, CleanPkgDeps;
|
MissingPkgFilesDlg, PackageSystem, CleanPkgDeps;
|
||||||
|
|
||||||
@ -1703,7 +1705,7 @@ begin
|
|||||||
|
|
||||||
SaveBitBtn.Enabled:=(not LazPackage.ReadOnly)
|
SaveBitBtn.Enabled:=(not LazPackage.ReadOnly)
|
||||||
and (LazPackage.IsVirtual or LazPackage.Modified);
|
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;
|
AddBitBtn.Enabled:=not LazPackage.ReadOnly;
|
||||||
RemoveBitBtn.Enabled:=(not LazPackage.ReadOnly)
|
RemoveBitBtn.Enabled:=(not LazPackage.ReadOnly)
|
||||||
and (not Removed)
|
and (not Removed)
|
||||||
|
@ -3373,6 +3373,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
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
|
// check if compilation is needed and if a clean build is needed
|
||||||
NeedBuildAllFlag:=false;
|
NeedBuildAllFlag:=false;
|
||||||
Note:='';
|
Note:='';
|
||||||
|
Loading…
Reference in New Issue
Block a user