mirror of https://gitlab.com/basile.b/dexed.git
libman editor, DUB fetch, allow to register libraries of type "sourceLibrary"
This commit is contained in:
parent
d9bb30f2f5
commit
7fd272608c
|
|
@ -178,27 +178,27 @@ inherited CELibManEditorWidget: TCELibManEditorWidget
|
||||||
item
|
item
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'Alias'
|
Caption = 'Alias'
|
||||||
Width = 39
|
Width = 37
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'Library file'
|
Caption = 'Library file or folder of sources'
|
||||||
Width = 76
|
Width = 67
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'Sources root'
|
Caption = 'Sources root'
|
||||||
Width = 88
|
Width = 78
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'project'
|
Caption = 'project'
|
||||||
Width = 54
|
Width = 49
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'enabled'
|
Caption = 'enabled'
|
||||||
Width = 355
|
Width = 54
|
||||||
end>
|
end>
|
||||||
GridLines = True
|
GridLines = True
|
||||||
HideSelection = False
|
HideSelection = False
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
||||||
Menus, ComCtrls, Buttons, LazFileUtils, strutils, fphttpclient, StdCtrls,
|
Menus, ComCtrls, Buttons, LazFileUtils, strutils, fphttpclient, StdCtrls, xfpjson,
|
||||||
ce_widget, ce_interfaces, ce_nativeproject, ce_dmdwrap, ce_common, ce_dialogs,
|
ce_widget, ce_interfaces, ce_nativeproject, ce_dmdwrap, ce_common, ce_dialogs,
|
||||||
ce_sharedres, process, ce_dubproject, ce_observer, ce_dlang, ce_stringrange,
|
ce_sharedres, process, ce_dubproject, ce_observer, ce_dlang, ce_stringrange,
|
||||||
ce_libman;
|
ce_libman;
|
||||||
|
|
@ -111,7 +111,8 @@ begin
|
||||||
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;
|
||||||
if List.Selected.isNotNil and itemForRow(List.Selected).enabled then
|
if List.Selected.isNotNil and itemForRow(List.Selected).isNotNil and
|
||||||
|
itemForRow(List.Selected).enabled then
|
||||||
AssignPng(btnEnabled, 'book')
|
AssignPng(btnEnabled, 'book')
|
||||||
else
|
else
|
||||||
AssignPng(btnEnabled, 'book_grey');
|
AssignPng(btnEnabled, 'book_grey');
|
||||||
|
|
@ -291,7 +292,6 @@ var
|
||||||
str: TStringList;
|
str: TStringList;
|
||||||
itf: ICEMessagesDisplay;
|
itf: ICEMessagesDisplay;
|
||||||
err: integer;
|
err: integer;
|
||||||
idx: integer;
|
|
||||||
prj: TCEDubProject;
|
prj: TCEDubProject;
|
||||||
upd: boolean = false;
|
upd: boolean = false;
|
||||||
ovw: boolean = false;
|
ovw: boolean = false;
|
||||||
|
|
@ -381,7 +381,41 @@ begin
|
||||||
end;
|
end;
|
||||||
if err <> 0 then
|
if err <> 0 then
|
||||||
begin
|
begin
|
||||||
|
// allow "sourceLibrary"
|
||||||
|
EntitiesConnector.beginUpdate;
|
||||||
|
prj := TCEDubProject.create(nil);
|
||||||
|
try
|
||||||
|
if FileExists(pth + DirectorySeparator + 'dub.json') then
|
||||||
|
prj.loadFromFile(pth + DirectorySeparator + 'dub.json')
|
||||||
|
else if FileExists(pth + DirectorySeparator + 'package.json') then
|
||||||
|
prj.loadFromFile(pth + DirectorySeparator + 'package.json');
|
||||||
|
if prj.json.isNotNil and TJSONObject(prj.json).Find('targetType').isNotNil
|
||||||
|
and (TJSONObject(prj.json).Find('targetType').AsString = 'sourceLibrary')
|
||||||
|
then
|
||||||
|
begin
|
||||||
|
if ovw then
|
||||||
|
row := List.FindCaption(0, nme, true, true, true);
|
||||||
|
if row.isNil then
|
||||||
|
row := List.Items.Add;
|
||||||
|
if row.Data.isNil then
|
||||||
|
row.Data := LibMan.libraries.Add;
|
||||||
|
row.Caption:= nme;
|
||||||
|
row.SubItems.Clear;
|
||||||
|
nme := sourceRoot(prj as ICECommonProject);
|
||||||
|
row.SubItems.Add(nme);
|
||||||
|
row.SubItems.Add(nme);
|
||||||
|
row.SubItems.Add(prj.filename);
|
||||||
|
row.SubItems.Add(enableStr[true]);
|
||||||
|
row.Selected:=true;
|
||||||
|
RowToLibrary(row);
|
||||||
|
itf.message('The package to register is a source library.' +
|
||||||
|
'It is not pre-compiled but its sources are registered', nil, amcMisc, amkInf);
|
||||||
|
end else
|
||||||
itf.message('error, failed to compile the package to register', nil, amcMisc, amkErr);
|
itf.message('error, failed to compile the package to register', nil, amcMisc, amkErr);
|
||||||
|
finally
|
||||||
|
prj.Free;
|
||||||
|
EntitiesConnector.endUpdate;
|
||||||
|
end;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
@ -395,25 +429,20 @@ begin
|
||||||
prj.loadFromFile(pth + DirectorySeparator + 'package.json');
|
prj.loadFromFile(pth + DirectorySeparator + 'package.json');
|
||||||
if prj.filename.isNotEmpty and (prj.binaryKind = staticlib) then
|
if prj.filename.isNotEmpty and (prj.binaryKind = staticlib) then
|
||||||
begin
|
begin
|
||||||
str := TStringList.Create;
|
|
||||||
try
|
|
||||||
for idx := 0 to prj.sourcesCount-1 do
|
|
||||||
str.Add(prj.sourceAbsolute(idx));
|
|
||||||
if ovw then
|
if ovw then
|
||||||
row := List.FindCaption(0, nme, true, true, true);
|
row := List.FindCaption(0, nme, true, true, true);
|
||||||
if row.isNil then
|
if row.isNil then
|
||||||
row := List.Items.Add;
|
row := List.Items.Add;
|
||||||
|
if row.Data.isNil then
|
||||||
row.Data := LibMan.libraries.Add;
|
row.Data := LibMan.libraries.Add;
|
||||||
row.Caption := nme;
|
row.Caption := nme;
|
||||||
|
row.SubItems.Clear;
|
||||||
row.SubItems.Add(prj.outputFilename);
|
row.SubItems.Add(prj.outputFilename);
|
||||||
row.SubItems.Add(sourceRoot(prj as ICECommonProject));
|
row.SubItems.Add(sourceRoot(prj as ICECommonProject));
|
||||||
row.SubItems.Add(prj.filename);
|
row.SubItems.Add(prj.filename);
|
||||||
row.SubItems.Add(enableStr[true]);
|
row.SubItems.Add(enableStr[true]);
|
||||||
row.Selected:=true;
|
row.Selected:=true;
|
||||||
RowToLibrary(row);
|
RowToLibrary(row);
|
||||||
finally
|
|
||||||
str.Free;
|
|
||||||
end;
|
|
||||||
end else
|
end else
|
||||||
itf.message('warning, the package json description can not be found or the target is not a static library',
|
itf.message('warning, the package json description can not be found or the target is not a static library',
|
||||||
nil, amcMisc, amkWarn);
|
nil, amcMisc, amkWarn);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue