fix #98 - sources not detected in subPackages described in JSON objects

This commit is contained in:
Basile Burg 2021-10-18 12:11:26 +02:00
parent 56a9024583
commit f4e95cc4c5
2 changed files with 23 additions and 14 deletions

View File

@ -3,6 +3,7 @@
## Bugs fixed
- DUB projects, access violation for subpackages entries described using JSON objects.
- DUB projects, source files of subpackage described in an object not visible in the project inspector (#98)
# v3.9.14

View File

@ -1371,6 +1371,26 @@ begin
fSrcs.Add(patchPlateformPath(ExtractRelativepath(fBasePath, abs)));
end;
end;
procedure trySubpPackages(a: TJSONArray);
var
n: TJSONData;
o: TJSONObject;
i: integer;
j: TJSONtype;
begin
for i := 0 to a.Count-1 do
begin
j := a.Types[i] ;
if j = jtString then
tryAddFromFolder(fBasePath + a.Strings[i])
else if j = jtObject then
begin
o := a.Objects[i];
if o.findAny('name', n) then
tryAddFromFolder(fBasePath + n.AsString);
end;
end;
end;
var
pth: string;
//glb: TRegExpr;
@ -1407,13 +1427,7 @@ begin
tryAddRelOrAbsFile(arr.Strings[i]);
// subpackages
if fJSON.findArray('subPackages', arr) then
for i := 0 to arr.Count-1 do
begin
if arr.JSONType = jtString then
tryAddFromFolder(fBasePath + arr.Strings[i])
else if arr.JSONType = jtObject then
tryAddFromFolder(arr.Objects[i].Strings['name']);
end;
trySubpPackages(arr);
// by config
conf := getCurrentCustomConfig;
if conf.isAssigned then
@ -1438,13 +1452,7 @@ begin
end;
// subpackages
if conf.findArray('subPackages', arr) then
for i := 0 to arr.Count-1 do
begin
if arr.JSONType = jtString then
tryAddFromFolder(fBasePath + arr.Strings[i])
else if arr.JSONType = jtObject then
tryAddFromFolder(arr.Objects[i].Strings['name']);
end;
trySubpPackages(arr);
// custom files in current config
if conf.findArray('sourceFiles', arr) then
for i := 0 to arr.Count-1 do