more for #10, get output filename

This commit is contained in:
Basile Burg 2015-09-19 09:04:47 +02:00
parent ed3022016b
commit 845053b5e0
1 changed files with 43 additions and 2 deletions

View File

@ -27,6 +27,7 @@ type
fBinKind: TProjectBinaryKind; fBinKind: TProjectBinaryKind;
fBasePath: string; fBasePath: string;
fModificationCount: integer; fModificationCount: integer;
fOutputFileName: string;
// //
procedure doModified; procedure doModified;
procedure updateFields; procedure updateFields;
@ -35,6 +36,7 @@ type
procedure updateSourcesFromJson; procedure updateSourcesFromJson;
procedure updateTargetKindFromJson; procedure updateTargetKindFromJson;
procedure updateImportPathsFromJson; procedure updateImportPathsFromJson;
procedure updateOutputNameFromJson;
function findTargetKindInd(value: TJSONObject): boolean; function findTargetKindInd(value: TJSONObject): boolean;
procedure dubProcOutput(proc: TProcess); procedure dubProcOutput(proc: TProcess);
function getCurrentCustomConfig: TJSONObject; function getCurrentCustomConfig: TJSONObject;
@ -213,8 +215,7 @@ end;
function TCEDubProject.outputFilename: string; function TCEDubProject.outputFilename: string;
begin begin
//TODO-cDUB: implement outputFilename exit(fOutputFileName);
exit('');
end; end;
{$ENDREGION --------------------------------------------------------------------} {$ENDREGION --------------------------------------------------------------------}
@ -604,6 +605,45 @@ begin
if assigned(conf) then addFrom(conf); if assigned(conf) then addFrom(conf);
end; end;
procedure TCEDubProject.updateOutputNameFromJson;
procedure setFrom(obj: TJSONObject);
var
item: TJSONData;
begin
item := obj.Find('targetPath');
if assigned(item) then
fOutputFileName := item.AsString;
item := obj.Find('targetName');
if assigned(item) then
fOutputFileName += DirectorySeparator + item.AsString;
end;
var
conf: TJSONObject;
item: TJSONData;
begin
fOutputFileName := '';
setFrom(fJSON);
conf := getCurrentCustomConfig;
if assigned(conf) then setFrom(conf);
if fOutputFileName <> '' then
begin
patchPlateformPath(fOutputFileName);
expandFilenameEx(fBasePath, fOutputFileName);
end
else
begin
item := fJSON.Find('name');
if assigned(item) then
fOutputFileName := item.AsString;
end;
case fBinKind of
executable: fOutputFileName += exeExt;
staticlib: fOutputFileName += libExt;
obj: fOutputFileName += objExt;
sharedlib: fOutputFileName += dynExt;
end;
end;
procedure TCEDubProject.updateFields; procedure TCEDubProject.updateFields;
begin begin
updatePackageNameFromJson; updatePackageNameFromJson;
@ -611,6 +651,7 @@ begin
updateSourcesFromJson; updateSourcesFromJson;
updateTargetKindFromJson; updateTargetKindFromJson;
updateImportPathsFromJson; updateImportPathsFromJson;
updateOutputNameFromJson;
end; end;
procedure TCEDubProject.beginModification; procedure TCEDubProject.beginModification;