libman, output a message when a library item is selected but deactivated

This commit is contained in:
Basile Burg 2016-07-07 20:52:01 +02:00
parent b86e65cba0
commit be6ea9d712
1 changed files with 25 additions and 4 deletions

View File

@ -89,6 +89,7 @@ type
strict private
fCollection: TCollection;
fItemsByAlias: TItemsByAlias;
fMsgs: ICEMessagesDisplay;
function getLibraryByIndex(index: integer): TLibraryItem;
function getLibraryByAlias(const value: string): TLibraryItem;
function getLibraryByImport(const value: string): TLibraryItem;
@ -135,6 +136,10 @@ var
implementation
const
deactivatedMessage = 'Library item "%s" could be detected but it is marked disabled, ' +
'the compilation will fail.';
constructor TModuleInfo.Create(ACollection: TCollection);
begin
inherited create(ACollection);
@ -544,15 +549,23 @@ var
lib: TLibraryItem;
i: Integer;
begin
if fMsgs = nil then
fMsgs := getMessageDisplay;
// no selector = all libs
if aliases.isNil then
begin
for i:= 0 to librariesCount-1 do
begin
lib := libraryByIndex[i];
if lib.enabled and lib.hasValidLibSourcePath then
if lib.hasValidLibSourcePath then
begin
if not lib.enabled then
fMsgs.message(format(deactivatedMessage, [lib.libAlias]),
nil, amcAutoCompile, amkWarn)
else
list.Add('-I' + lib.libSourcePath);
end;
end;
end
// else get selected libs
else
@ -574,6 +587,8 @@ var
dep: TLibraryItem;
sel: TLibraryList;
begin
if fMsgs = nil then
fMsgs := getMessageDisplay;
imp := TStringList.Create;
sel := TLibraryList.create;
try
@ -603,9 +618,15 @@ begin
if not sel.IsEmpty then with sel.Iterator do
begin
while true do if data.hasValidLibFile then
begin
if not data.enabled then
fMsgs.message(format(deactivatedMessage, [data.libAlias]),
nil, amcAutoCompile, amkWarn)
else
begin
libs.Add(Data.libFile);
paths.Add('-I' + Data.libSourcePath);
end;
if not Next then
break;
end;