fix #434 - Project outputkind not always correctly interpreted from the DUB JSON

This commit is contained in:
Basile Burg 2019-02-03 12:18:14 +01:00
parent 0a4e513871
commit 90ce30f032
1 changed files with 27 additions and 27 deletions

View File

@ -1388,37 +1388,37 @@ end;
procedure TDubProject.updateTargetKindFromJson; procedure TDubProject.updateTargetKindFromJson;
var var
found: boolean = false; a: boolean = false;
conf: TJSONObject; b: boolean = false;
src: string; c: TJSONObject;
s: string;
begin begin
fBinKind := executable; fBinKind := executable;
if fJSON.isNil then exit; if fJSON.isNil then
// note: this is only used to known if output can be launched exit;
found := findTargetKindInd(fJSON); a := findTargetKindInd(fJSON);
conf := getCurrentCustomConfig; c := getCurrentCustomConfig;
if conf.isNotNil then if c.isNotNil then
found := found or findTargetKindInd(conf); b := findTargetKindInd(c);
if not found then if a or b then
exit;
for s in fSrcs do
begin begin
for src in fSrcs do if (s = 'source' + DirectorySeparator + 'app.d')
or (s = 'src' + DirectorySeparator + 'app.d')
or (s = 'source' + DirectorySeparator + 'main.d')
or (s = 'src' + DirectorySeparator + 'main.d')
or (s = 'source' + DirectorySeparator + fPackageName + DirectorySeparator + 'app.d')
or (s = 'src' + DirectorySeparator + fPackageName + DirectorySeparator + 'app.d')
or (s = 'source' + DirectorySeparator + fPackageName + DirectorySeparator + 'main.d')
or (s = 'src' + DirectorySeparator + fPackageName + DirectorySeparator + 'main.d')
then
begin begin
if (src = 'source' + DirectorySeparator + 'app.d') fBinKind:= executable;
or (src = 'src' + DirectorySeparator + 'app.d') break;
or (src = 'source' + DirectorySeparator + 'main.d') end
or (src = 'src' + DirectorySeparator + 'main.d') else fBinKind:= staticlib;
or (src = 'source' + DirectorySeparator + fPackageName + DirectorySeparator + 'app.d')
or (src = 'src' + DirectorySeparator + fPackageName + DirectorySeparator + 'app.d')
or (src = 'source' + DirectorySeparator + fPackageName + DirectorySeparator + 'main.d')
or (src = 'src' + DirectorySeparator + fPackageName + DirectorySeparator + 'main.d')
then
begin
fBinKind:= executable;
break;
end
else
fBinKind:= staticlib;
end;
end; end;
end; end;