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