mirror of https://gitlab.com/basile.b/dexed.git
more for #29, check if proj target is lib and update support
This commit is contained in:
parent
f0622f3c3f
commit
77204119f8
|
@ -1,31 +1,31 @@
|
||||||
inherited CELibManEditorWidget: TCELibManEditorWidget
|
inherited CELibManEditorWidget: TCELibManEditorWidget
|
||||||
Left = 985
|
Left = 772
|
||||||
Height = 349
|
Height = 297
|
||||||
Top = 275
|
Top = 307
|
||||||
Width = 466
|
Width = 641
|
||||||
Caption = 'Library manager'
|
Caption = 'Library manager'
|
||||||
ClientHeight = 349
|
ClientHeight = 297
|
||||||
ClientWidth = 466
|
ClientWidth = 641
|
||||||
inherited Back: TPanel
|
inherited Back: TPanel
|
||||||
Height = 349
|
Height = 297
|
||||||
Width = 466
|
Width = 641
|
||||||
ClientHeight = 349
|
ClientHeight = 297
|
||||||
ClientWidth = 466
|
ClientWidth = 641
|
||||||
inherited Content: TPanel
|
inherited Content: TPanel
|
||||||
Height = 349
|
Height = 297
|
||||||
Width = 466
|
Width = 641
|
||||||
ClientHeight = 349
|
ClientHeight = 297
|
||||||
ClientWidth = 466
|
ClientWidth = 641
|
||||||
object Panel1: TPanel[0]
|
object Panel1: TPanel[0]
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 26
|
Height = 26
|
||||||
Top = 4
|
Top = 4
|
||||||
Width = 458
|
Width = 633
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 4
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 26
|
ClientHeight = 26
|
||||||
ClientWidth = 458
|
ClientWidth = 633
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object btnAddLib: TBitBtn
|
object btnAddLib: TBitBtn
|
||||||
Left = 0
|
Left = 0
|
||||||
|
@ -50,7 +50,7 @@ inherited CELibManEditorWidget: TCELibManEditorWidget
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
object btnSelFile: TBitBtn
|
object btnSelFile: TBitBtn
|
||||||
Left = 374
|
Left = 549
|
||||||
Height = 26
|
Height = 26
|
||||||
Hint = 'select the library file'
|
Hint = 'select the library file'
|
||||||
Top = 0
|
Top = 0
|
||||||
|
@ -61,7 +61,7 @@ inherited CELibManEditorWidget: TCELibManEditorWidget
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
object btnSelRoot: TBitBtn
|
object btnSelRoot: TBitBtn
|
||||||
Left = 430
|
Left = 605
|
||||||
Height = 26
|
Height = 26
|
||||||
Hint = 'select the sources root'
|
Hint = 'select the sources root'
|
||||||
Top = 0
|
Top = 0
|
||||||
|
@ -72,7 +72,7 @@ inherited CELibManEditorWidget: TCELibManEditorWidget
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
end
|
end
|
||||||
object btnEditAlias: TBitBtn
|
object btnEditAlias: TBitBtn
|
||||||
Left = 346
|
Left = 521
|
||||||
Height = 26
|
Height = 26
|
||||||
Hint = 'edit the library alias'
|
Hint = 'edit the library alias'
|
||||||
Top = 0
|
Top = 0
|
||||||
|
@ -103,7 +103,7 @@ inherited CELibManEditorWidget: TCELibManEditorWidget
|
||||||
TabOrder = 6
|
TabOrder = 6
|
||||||
end
|
end
|
||||||
object btnSelfoldOfFiles: TBitBtn
|
object btnSelfoldOfFiles: TBitBtn
|
||||||
Left = 402
|
Left = 577
|
||||||
Height = 26
|
Height = 26
|
||||||
Hint = 'select a folder of library files'
|
Hint = 'select a folder of library files'
|
||||||
Top = 0
|
Top = 0
|
||||||
|
@ -138,9 +138,9 @@ inherited CELibManEditorWidget: TCELibManEditorWidget
|
||||||
end
|
end
|
||||||
object List: TListView[1]
|
object List: TListView[1]
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 311
|
Height = 259
|
||||||
Top = 34
|
Top = 34
|
||||||
Width = 458
|
Width = 633
|
||||||
Align = alClient
|
Align = alClient
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 4
|
||||||
Columns = <
|
Columns = <
|
||||||
|
@ -173,5 +173,8 @@ inherited CELibManEditorWidget: TCELibManEditorWidget
|
||||||
inherited contextMenu: TPopupMenu
|
inherited contextMenu: TPopupMenu
|
||||||
left = 184
|
left = 184
|
||||||
top = 8
|
top = 8
|
||||||
|
object MenuItem1: TMenuItem[0]
|
||||||
|
Caption = 'New Item1'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,6 +25,7 @@ type
|
||||||
btnSelfoldOfFiles: TBitBtn;
|
btnSelfoldOfFiles: TBitBtn;
|
||||||
btnSelRoot: TBitBtn;
|
btnSelRoot: TBitBtn;
|
||||||
List: TListView;
|
List: TListView;
|
||||||
|
MenuItem1: TMenuItem;
|
||||||
Panel1: TPanel;
|
Panel1: TPanel;
|
||||||
procedure btnAddLibClick(Sender: TObject);
|
procedure btnAddLibClick(Sender: TObject);
|
||||||
procedure btnDubFetchClick(Sender: TObject);
|
procedure btnDubFetchClick(Sender: TObject);
|
||||||
|
@ -146,6 +147,7 @@ var
|
||||||
idx: integer;
|
idx: integer;
|
||||||
prj: TCEDubProject;
|
prj: TCEDubProject;
|
||||||
cdy: string;
|
cdy: string;
|
||||||
|
upd: boolean;
|
||||||
begin
|
begin
|
||||||
if not InputQuery('DUB library import', 'please enter the name of the package',
|
if not InputQuery('DUB library import', 'please enter the name of the package',
|
||||||
nme) then exit;
|
nme) then exit;
|
||||||
|
@ -161,22 +163,29 @@ begin
|
||||||
pth := GetEnvironmentVariable('HOME') + '/.dub/packages/' + nme + '-master';
|
pth := GetEnvironmentVariable('HOME') + '/.dub/packages/' + nme + '-master';
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
itf := getMessageDisplay;
|
itf := getMessageDisplay;
|
||||||
if DirectoryExists(pth) then
|
if DirectoryExists(pth) then;
|
||||||
begin
|
begin
|
||||||
itf.message('the dub package is already fetched', nil, amcApp, amkInf);
|
upd := true;
|
||||||
exit;
|
itf.message('information, the dub package is already fetched and will be upgraded', nil, amcApp, amkInf);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// fetch
|
// fetch / updgrade
|
||||||
dub := TProcess.Create(nil);
|
dub := TProcess.Create(nil);
|
||||||
try
|
try
|
||||||
dub.Executable:= 'dub';
|
dub.Executable:= 'dub';
|
||||||
dub.Options:= [poUsePipes, poStderrToOutPut];
|
dub.Options:= [poUsePipes, poStderrToOutPut];
|
||||||
|
if not upd then
|
||||||
|
begin
|
||||||
dub.Parameters.Add('fetch');
|
dub.Parameters.Add('fetch');
|
||||||
dub.Parameters.Add(nme);
|
dub.Parameters.Add(nme);
|
||||||
// fetch project, version handling, pth is hard to set because of semVer suffix.
|
// fetch project, version handling, pth is hard to set because of semVer suffix.
|
||||||
// needed: a folder monitor to detect the one created by dub.
|
// needed: a folder monitor to detect the one created by dub.
|
||||||
dub.Parameters.Add('--version=~master');
|
dub.Parameters.Add('--version=~master');
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
dub.CurrentDirectory := pth;
|
||||||
|
dub.Parameters.Add('upgrade');
|
||||||
|
end;
|
||||||
dub.Execute;
|
dub.Execute;
|
||||||
while dub.Running do sleep(10);
|
while dub.Running do sleep(10);
|
||||||
err := dub.ExitStatus;
|
err := dub.ExitStatus;
|
||||||
|
@ -193,7 +202,7 @@ begin
|
||||||
end;
|
end;
|
||||||
if err <> 0 then
|
if err <> 0 then
|
||||||
begin
|
begin
|
||||||
itf.message('error, failed to fetch the repository using DUB', nil, amcApp, amkErr);
|
itf.message('error, failed to fetch or upgrade the repository', nil, amcApp, amkErr);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -221,7 +230,7 @@ begin
|
||||||
end;
|
end;
|
||||||
if err <> 0 then
|
if err <> 0 then
|
||||||
begin
|
begin
|
||||||
itf.message('error, failed to compile the library to register', nil, amcApp, amkErr);
|
itf.message('error, failed to compile the package to register', nil, amcApp, amkErr);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -233,11 +242,13 @@ begin
|
||||||
prj.loadFromFile(pth + DirectorySeparator + 'dub.json')
|
prj.loadFromFile(pth + DirectorySeparator + 'dub.json')
|
||||||
else if FileExists(pth + DirectorySeparator + 'package.json') then
|
else if FileExists(pth + DirectorySeparator + 'package.json') then
|
||||||
prj.loadFromFile(pth + DirectorySeparator + 'package.json');
|
prj.loadFromFile(pth + DirectorySeparator + 'package.json');
|
||||||
|
if (prj.filename <> '') and (prj.binaryKind = staticlib) then
|
||||||
|
begin
|
||||||
str := TStringList.Create;
|
str := TStringList.Create;
|
||||||
try
|
try
|
||||||
for idx := 0 to prj.sourcesCount-1 do
|
for idx := 0 to prj.sourcesCount-1 do
|
||||||
str.Add(prj.sourceAbsolute(idx));
|
str.Add(prj.sourceAbsolute(idx));
|
||||||
with List.Items.Add do
|
if not upd then with List.Items.Add do
|
||||||
begin
|
begin
|
||||||
Caption := nme;
|
Caption := nme;
|
||||||
SubItems.Add(prj.outputFilename);
|
SubItems.Add(prj.outputFilename);
|
||||||
|
@ -253,6 +264,9 @@ begin
|
||||||
finally
|
finally
|
||||||
str.Free;
|
str.Free;
|
||||||
end;
|
end;
|
||||||
|
end else
|
||||||
|
itf.message('warning, the package to register can not be found or the target is not a static library',
|
||||||
|
nil, amcApp, amkWarn);
|
||||||
finally
|
finally
|
||||||
prj.Free;
|
prj.Free;
|
||||||
EntitiesConnector.endUpdate;
|
EntitiesConnector.endUpdate;
|
||||||
|
|
Loading…
Reference in New Issue