From 1ce5f8f65f00dabfaa41872d9010f7b398acabb0 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Mon, 7 Jul 2014 04:17:02 +0200 Subject: [PATCH] support for multiple version identifiers --- src/ce_dmdwrap.pas | 51 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/src/ce_dmdwrap.pas b/src/ce_dmdwrap.pas index 4556aea5..c660b191 100644 --- a/src/ce_dmdwrap.pas +++ b/src/ce_dmdwrap.pas @@ -103,6 +103,7 @@ type fBinKind: TBinaryKind; fUt: boolean; fVerId: string; + fVerIds: TStringList; fInline: boolean; fNoBounds: boolean; fOptimz: boolean; @@ -119,6 +120,7 @@ type procedure setGenStack(const aValue: boolean); procedure setMain(const aValue: boolean); procedure setRelease(const aValue: boolean); + procedure setVerIds(const aValue: TStringList); published property targetKind: TTargetSystem read fTrgKind write setTrgKind; property binaryKind: TBinaryKind read fBinKind write setBinKind; @@ -130,7 +132,10 @@ type property release: boolean read fRelease write setRelease; property unittest: boolean read fUt write setUt; property versionIdentifier: string read fVerId write setVerId; + property versionIdentifiers: TStringList read fVerIds write setVerIds; public + constructor create; + destructor destroy; override; procedure assign(aValue: TPersistent); override; procedure getOpts(const aList: TStrings); override; end; @@ -286,6 +291,12 @@ end; procedure TDocOpts.setGenDoc(const aValue: boolean); begin + if fDocDir <> '' then + begin + fGenDoc := true; + exit; + end; + // if fGenDoc = aValue then exit; fGenDoc := aValue; doChanged; @@ -293,6 +304,12 @@ end; procedure TDocOpts.setGenJSON(const aValue: boolean); begin + if fJsonFname <> '' then + begin + fGenJson := true; + exit; + end; + // if fGenJson = aValue then exit; fGenJson := aValue; doChanged; @@ -302,6 +319,7 @@ procedure TDocOpts.setDocDir(const aValue: string); begin if fDocDir = aValue then exit; fDocDir := patchPlateformPath(aValue); + if fDocDir <> '' then setGenDoc(true); doChanged; end; @@ -309,6 +327,7 @@ procedure TDocOpts.setJSONFile(const aValue: string); begin if fJsonFname = aValue then exit; fJsonFname := patchPlateformPath(aValue); + if fJsonFname <> '' then setGenJSON(true); doChanged; end; @@ -397,6 +416,18 @@ end; (******************************************************************************* * TOutputOpts *) +constructor TOutputOpts.create; +begin + fVerIds := TStringList.Create; + //fVerId := 'deprecated_field'; +end; + +destructor TOutputOpts.destroy; +begin + fVerIds.Free; + inherited; +end; + procedure TOutputOpts.getOpts(const aList: TStrings); var opt: string; @@ -416,6 +447,8 @@ begin if fGenStack then aList.Add('-gs'); if fMain then aList.Add('-main'); if fRelease then aList.Add('-release'); + for opt in fVerIds do + aList.Add('-version=' + opt ); end; procedure TOutputOpts.assign(aValue: TPersistent); @@ -453,6 +486,12 @@ begin doChanged; end; +procedure TOutputOpts.setVerIds(const aValue: TStringList); +begin + fVerIds.Assign(aValue); + doChanged; +end; + procedure TOutputOpts.setTrgKind(const aValue: TTargetSystem); begin if fTrgKind = aValue then exit; @@ -683,10 +722,16 @@ end; procedure TOtherOpts.getOpts(const aList: TStrings); var - str: string; + str1, str2: string; begin - for str in fCustom do if str <> '' then - aList.Add(str); + for str1 in fCustom do if str1 <> '' then + begin + if str1[1] <> '-' then + str2 := '-' + str1 + else + str2 := str1; + aList.Add(str2); + end; end; procedure TOtherOpts.setCustom(const aValue: TStringList);