mirror of https://gitlab.com/basile.b/dexed.git
fix #265 - In the libman allow to register projects that are not libraries
This commit is contained in:
parent
e1b07c6168
commit
f8c5e686c8
|
@ -479,11 +479,14 @@ procedure TLibraryManager.getLibFiles(aliases, list: TStrings);
|
||||||
procedure add(lib: TLibraryItem);
|
procedure add(lib: TLibraryItem);
|
||||||
var
|
var
|
||||||
j: integer;
|
j: integer;
|
||||||
|
e: string;
|
||||||
|
f: string;
|
||||||
|
x: string;
|
||||||
dir: string;
|
dir: string;
|
||||||
lst: TstringList;
|
lst: TstringList;
|
||||||
begin
|
begin
|
||||||
// as a trick a folder can be set as source, this allows to pass
|
// as a trick a folder can be set as source, this allows to pass
|
||||||
// multiple sources in an automated way.
|
// multiple sources | static libs in an automated way.
|
||||||
if lib.libFile.dirExists then
|
if lib.libFile.dirExists then
|
||||||
begin
|
begin
|
||||||
lst := TStringList.Create;
|
lst := TStringList.Create;
|
||||||
|
@ -491,12 +494,20 @@ procedure TLibraryManager.getLibFiles(aliases, list: TStrings);
|
||||||
dir := lib.libFile;
|
dir := lib.libFile;
|
||||||
if lib.libFile[dir.length] = DirectorySeparator then
|
if lib.libFile[dir.length] = DirectorySeparator then
|
||||||
dir := dir[1..dir.length-1];
|
dir := dir[1..dir.length-1];
|
||||||
listFiles(lst, dir);
|
listFiles(lst, dir, true);
|
||||||
for j:= 0 to lst.Count-1 do
|
for j:= 0 to lst.Count-1 do
|
||||||
begin
|
begin
|
||||||
if lst[j].extractFileExt = libExt then
|
f := lst[j];
|
||||||
if list.IndexOf(lst[j]) = -1 then
|
x := f.extractFileName;
|
||||||
list.Add(lst[j]);
|
// The libman allows registration of projects thate not libs and using
|
||||||
|
// a folder of sources instead of the *.a / *.lib file.
|
||||||
|
// Following DUB conventions here are filtered out named supposed to
|
||||||
|
// contain the __Dmain() func, which is not wanted for runnables mods.
|
||||||
|
if (x = 'app.d') or (x = 'main.d') then
|
||||||
|
continue;
|
||||||
|
e := f.extractFileExt;
|
||||||
|
if ((e = libExt) or (e = '.d')) and (list.IndexOf(f) = -1) then
|
||||||
|
list.Add(f);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
lst.Free;
|
lst.Free;
|
||||||
|
|
|
@ -13,14 +13,14 @@ inherited CELibManEditorWidget: TCELibManEditorWidget
|
||||||
ClientHeight = 297
|
ClientHeight = 297
|
||||||
ClientWidth = 641
|
ClientWidth = 641
|
||||||
inherited Content: TPanel
|
inherited Content: TPanel
|
||||||
Height = 263
|
Height = 261
|
||||||
Top = 34
|
Top = 36
|
||||||
Width = 641
|
Width = 641
|
||||||
ClientHeight = 263
|
ClientHeight = 261
|
||||||
ClientWidth = 641
|
ClientWidth = 641
|
||||||
object List: TListView[0]
|
object List: TListView[0]
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 255
|
Height = 253
|
||||||
Top = 4
|
Top = 4
|
||||||
Width = 633
|
Width = 633
|
||||||
Align = alClient
|
Align = alClient
|
||||||
|
@ -58,7 +58,6 @@ inherited CELibManEditorWidget: TCELibManEditorWidget
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
inherited toolbar: TCEToolBar
|
inherited toolbar: TCEToolBar
|
||||||
Height = 28
|
|
||||||
Width = 633
|
Width = 633
|
||||||
object btnSelProj: TCEToolButton[0]
|
object btnSelProj: TCEToolButton[0]
|
||||||
Left = 342
|
Left = 342
|
||||||
|
|
|
@ -91,6 +91,15 @@ const
|
||||||
notav: string = '< n/a >';
|
notav: string = '< n/a >';
|
||||||
enableStr: array [boolean] of string = ('false','true');
|
enableStr: array [boolean] of string = ('false','true');
|
||||||
|
|
||||||
|
|
||||||
|
function YesOrNoAddProjSourceFolder: TModalResult;
|
||||||
|
begin
|
||||||
|
result :=
|
||||||
|
dlgYesNo('The registered project is not a library '+
|
||||||
|
'however it is possible to make its sources accessible for unittesting and executing runnable modules. ' +
|
||||||
|
'If you click `YES` this will be done, otherwise the new entry will only be used for the completions.');
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TCELibManEditorWidget.Create(aOwner: TComponent);
|
constructor TCELibManEditorWidget.Create(aOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
@ -101,8 +110,7 @@ procedure TCELibManEditorWidget.updateButtonsState;
|
||||||
var
|
var
|
||||||
i: TIconScaledSize;
|
i: TIconScaledSize;
|
||||||
begin
|
begin
|
||||||
btnReg.Enabled := (fProj <> nil) and (fProj.binaryKind = staticlib) and
|
btnReg.Enabled := (fProj <> nil) and fProj.Filename.fileExists;
|
||||||
fProj.Filename.fileExists;
|
|
||||||
btnOpenProj.Enabled := List.Selected.isNotNil and
|
btnOpenProj.Enabled := List.Selected.isNotNil and
|
||||||
List.Selected.SubItems[2].fileExists;
|
List.Selected.SubItems[2].fileExists;
|
||||||
i := GetIconScaledSize;
|
i := GetIconScaledSize;
|
||||||
|
@ -595,7 +603,7 @@ begin
|
||||||
prj := TCEDubProject.create(nil);
|
prj := TCEDubProject.create(nil);
|
||||||
try
|
try
|
||||||
prj.loadFromFile(dfn);
|
prj.loadFromFile(dfn);
|
||||||
if prj.filename.isNotEmpty and (prj.binaryKind = staticlib) then
|
if prj.filename.isNotEmpty then
|
||||||
begin
|
begin
|
||||||
if (ovw and not List.items.findCaption(nme, row)) or not ovw then
|
if (ovw and not List.items.findCaption(nme, row)) or not ovw then
|
||||||
row := List.Items.Add;
|
row := List.Items.Add;
|
||||||
|
@ -603,7 +611,15 @@ begin
|
||||||
row.Data := LibMan.libraries.Add;
|
row.Data := LibMan.libraries.Add;
|
||||||
row.Caption := nme;
|
row.Caption := nme;
|
||||||
row.SubItems.Clear;
|
row.SubItems.Clear;
|
||||||
row.SubItems.Add(prj.outputFilename);
|
if prj.binaryKind = staticlib then
|
||||||
|
row.SubItems.Add(prj.outputFilename)
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if YesOrNoAddProjSourceFolder() = mrYes then
|
||||||
|
row.SubItems.add(projectSourcePath(prj))
|
||||||
|
else
|
||||||
|
row.SubItems.Add('');
|
||||||
|
end;
|
||||||
row.SubItems.Add(projectSourcePath(prj as ICECommonProject));
|
row.SubItems.Add(projectSourcePath(prj as ICECommonProject));
|
||||||
row.SubItems.Add(prj.filename);
|
row.SubItems.Add(prj.filename);
|
||||||
row.SubItems.Add(enableStr[true]);
|
row.SubItems.Add(enableStr[true]);
|
||||||
|
@ -695,6 +711,7 @@ var
|
||||||
root: string;
|
root: string;
|
||||||
lalias: string;
|
lalias: string;
|
||||||
row: TListItem;
|
row: TListItem;
|
||||||
|
itf: ICEMessagesDisplay;
|
||||||
begin
|
begin
|
||||||
if fProj = nil then
|
if fProj = nil then
|
||||||
exit;
|
exit;
|
||||||
|
@ -708,6 +725,8 @@ begin
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
itf := getMessageDisplay;
|
||||||
|
|
||||||
str := TStringList.Create;
|
str := TStringList.Create;
|
||||||
try
|
try
|
||||||
root := projectSourcePath(fProj);
|
root := projectSourcePath(fProj);
|
||||||
|
@ -720,15 +739,28 @@ begin
|
||||||
row := List.Items.Add;
|
row := List.Items.Add;
|
||||||
row.Data := LibMan.libraries.Add;
|
row.Data := LibMan.libraries.Add;
|
||||||
row.Caption := lalias;
|
row.Caption := lalias;
|
||||||
if fname.extractFileExt <> libExt then
|
if (fname.extractFileExt <> libExt) then
|
||||||
row.SubItems.add(fname + libExt)
|
begin
|
||||||
|
if (fname + libExt).fileExists then
|
||||||
|
begin
|
||||||
|
row.SubItems.add(fname + libExt);
|
||||||
|
if not row.SubItems[0].fileExists then
|
||||||
|
itf.message('warning, the library file does not exist, maybe the project not been already compiled ?',
|
||||||
|
nil, amcMisc, amkWarn);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if YesOrNoAddProjSourceFolder() = mrYes then
|
||||||
|
row.SubItems.add(projectSourcePath(fProj))
|
||||||
|
else
|
||||||
|
row.SubItems.add('');
|
||||||
|
end;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
row.SubItems.add(fname);
|
row.SubItems.add(fname);
|
||||||
row.SubItems.add(root);
|
row.SubItems.add(root);
|
||||||
row.SubItems.add(fProj.filename);
|
row.SubItems.add(fProj.filename);
|
||||||
row.SubItems.add(enableStr[true]);
|
row.SubItems.add(enableStr[true]);
|
||||||
if not row.SubItems[0].fileExists then
|
|
||||||
dlgOkInfo('the library file does not exist, maybe the project not been already compiled ?');
|
|
||||||
row.Selected:= true;
|
row.Selected:= true;
|
||||||
row.MakeVisible(false);
|
row.MakeVisible(false);
|
||||||
SetFocus;
|
SetFocus;
|
||||||
|
|
Loading…
Reference in New Issue