Skip to content

Commit

Permalink
Delphi12 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleteti committed Nov 6, 2023
1 parent 5d34165 commit e1aa50d
Show file tree
Hide file tree
Showing 21 changed files with 543 additions and 205 deletions.
4 changes: 2 additions & 2 deletions lib/swagdoc/Source/Json.Schema.pas
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function TJsonSchema.GetJsonFieldClass<T>: TJsonFieldClass;
vSchemaKind: TSchemaKind;
vClass: TPersistentClass;
begin
Result := nil;
//Result := nil; //dt
vSchemaKind := GetSchemaKind<T>;
if (vSchemaKind = skUnknown) then
raise ETypeNotSupportedByAField.Create(c_ErrorTypeNotSupportedByAField);
Expand Down Expand Up @@ -129,7 +129,7 @@ procedure TJsonSchema.SetRef(const Value: string);
function TJsonSchema.GetSchemaKind<T>: TSchemaKind;
var
vTypeInfo: PTypeInfo;
vClass: TPersistentClass;
//vClass: TPersistentClass; //dt
begin
Result := skUnknown;
vTypeInfo := System.TypeInfo(T);
Expand Down
158 changes: 131 additions & 27 deletions lib/swagdoc/Source/SwagDoc.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<ProjectGuid>{5B9408E7-46AC-4431-9716-C9EB9F8589B1}</ProjectGuid>
<MainSource>SwagDoc.dpk</MainSource>
<ProjectVersion>19.5</ProjectVersion>
<ProjectVersion>20.1</ProjectVersion>
<FrameworkType>None</FrameworkType>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
Expand All @@ -13,16 +13,6 @@
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Android' and '$(Base)'=='true') or '$(Base_Android)'!=''">
<Base_Android>true</Base_Android>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Android64' and '$(Base)'=='true') or '$(Base_Android64)'!=''">
<Base_Android64>true</Base_Android64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
Expand Down Expand Up @@ -64,19 +54,6 @@
<RuntimeOnlyPackage>true</RuntimeOnlyPackage>
<DCC_OutputNeverBuildDcps>true</DCC_OutputNeverBuildDcps>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Android)'!=''">
<DCC_CBuilderOutput>None</DCC_CBuilderOutput>
<EnabledSysJars>android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar</EnabledSysJars>
<Android_LauncherIcon192>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_192x192.png</Android_LauncherIcon192>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Android64)'!=''">
<VerInfo_Keys>package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=</VerInfo_Keys>
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_IncludeVerInfo>false</VerInfo_IncludeVerInfo>
<DCC_CBuilderOutput>None</DCC_CBuilderOutput>
<EnabledSysJars>android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar</EnabledSysJars>
<Android_LauncherIcon192>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_192x192.png</Android_LauncherIcon192>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<BT_BuildType>Debug</BT_BuildType>
Expand Down Expand Up @@ -272,6 +249,16 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashImageDefV21">
<Platform Name="Android">
<RemoteDir>res\drawable-anydpi-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-anydpi-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStyles">
<Platform Name="Android">
<RemoteDir>res\values</RemoteDir>
Expand All @@ -292,6 +279,66 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStylesV31">
<Platform Name="Android">
<RemoteDir>res\values-v31</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\values-v31</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_AdaptiveIcon">
<Platform Name="Android">
<RemoteDir>res\drawable-anydpi-v26</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-anydpi-v26</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_AdaptiveIconBackground">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_AdaptiveIconForeground">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_AdaptiveIconMonochrome">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_AdaptiveIconV33">
<Platform Name="Android">
<RemoteDir>res\drawable-anydpi-v33</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-anydpi-v33</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_Colors">
<Platform Name="Android">
<RemoteDir>res\values</RemoteDir>
Expand All @@ -302,6 +349,16 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_ColorsDark">
<Platform Name="Android">
<RemoteDir>res\values-night-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\values-night-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_DefaultAppIcon">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
Expand Down Expand Up @@ -472,6 +529,56 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_VectorizedNotificationIcon">
<Platform Name="Android">
<RemoteDir>res\drawable-anydpi-v24</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-anydpi-v24</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_VectorizedSplash">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_VectorizedSplashDark">
<Platform Name="Android">
<RemoteDir>res\drawable-night-anydpi-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-night-anydpi-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_VectorizedSplashV31">
<Platform Name="Android">
<RemoteDir>res\drawable-anydpi-v31</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-anydpi-v31</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_VectorizedSplashV31Dark">
<Platform Name="Android">
<RemoteDir>res\drawable-night-anydpi-v31</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-night-anydpi-v31</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DebugSymbols">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
Expand Down Expand Up @@ -912,9 +1019,6 @@
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
</Deployment>
<Platforms>
<Platform value="Android">False</Platform>
<Platform value="Android64">False</Platform>
<Platform value="Linux64">False</Platform>
<Platform value="Win32">True</Platform>
<Platform value="Win64">False</Platform>
</Platforms>
Expand Down
10 changes: 0 additions & 10 deletions sources/MVCFramework.ActiveRecord.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3025,10 +3025,6 @@ class function TMVCActiveRecordHelper.SelectByNamedQuery<T>(

class function TMVCActiveRecordHelper.Select<T>(const SQL: string; const Params: array of Variant;
const ParamTypes: array of TFieldType; const Options: TMVCActiveRecordLoadOptions): TObjectList<T>;
var
lDataSet: TDataSet;
lAR: TMVCActiveRecord;
lHandled: Boolean;
begin
Result := TObjectList<T>.Create(True);
try
Expand All @@ -3049,12 +3045,8 @@ class function TMVCActiveRecordHelper.SelectOne<T>(const SQL: string; const Para
const ParamTypes: array of TFieldType; const Options: TMVCActiveRecordLoadOptions;
const RaiseExceptionIfNotFound: Boolean): T;
var
lDataSet: TDataSet;
lAR: TMVCActiveRecord;
lHandled: Boolean;
lList: TObjectList<T>;
begin
Result := nil;
lList := Select<T>(SQL, Params, ParamTypes, Options);
try
if (lList.Count = 0) then
Expand Down Expand Up @@ -3606,8 +3598,6 @@ class function TMVCActiveRecordHelper.Merge<T>(CurrentList, NewList: TObjectList
var
I: Integer;
lFoundAtIndex: Integer;
lCurrPKValue: Integer;
lPKValue: TValue;
lUnitOfWork: IMVCUnitOfWork<T>;
lPKType: TFieldType;
lNeedsToBeUpdated: Boolean;
Expand Down
2 changes: 0 additions & 2 deletions sources/MVCFramework.IntfObjectPool.pas
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,10 @@ constructor TIntfCleanupThread<IInterface>.Create(ObjectPool: TIntfObjectPool);

procedure TIntfCleanupThread<IInterface>.Execute;
var
lTargetSize: Integer;
lAvgSize: TPoolSizeSamples;
lArrIndex: Integer;
lSampleTick: Integer;
begin
lArrIndex := 0;
lSampleTick := 0;
while not Terminated do
begin
Expand Down
5 changes: 5 additions & 0 deletions sources/MVCFramework.JSONRPC.pas
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
https://www.jsonrpc.org/historical/json-rpc-over-http.html
}

{$I dmvcframework.inc}

interface

uses
Expand Down Expand Up @@ -2907,6 +2909,9 @@ class function TJSONUtilsHelper.JSONObjectToRecord<T>(
else
begin
RaiseSerializationError('Parameter doesn''t support IJSONRPCResponse');
{$IF Defined(DELPHI12ORBETTER)}
Result := Default(T);
{$ENDIF}
end;
end;

Expand Down
1 change: 0 additions & 1 deletion sources/MVCFramework.LRUCache.pas
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ procedure TMVCLRUCache<T>.Put(const Key: string; const Item: T);

procedure TMVCLRUCache<T>.RemoveIf(const Action: TMVCLRUCacheAction);
var
I: Integer;
lIndex: Integer;
lCacheSize: Integer;
begin
Expand Down
4 changes: 0 additions & 4 deletions sources/MVCFramework.ObjectPool.pas
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ implementation
{ TObjectPool<T> }

constructor TObjectPool<T>.Create(MaxSize: Integer; ShrinkTriggerSize, ShrinkTargetSize: Integer; const Factory: TFunc<T>);
var
i: Integer;
begin
inherited Create;
fOnResetState := nil;
Expand Down Expand Up @@ -222,12 +220,10 @@ constructor TCleanupThread<T>.Create(ObjectPool: TObjectPool<T>);

procedure TCleanupThread<T>.Execute;
var
lTargetSize: Integer;
lAvgSize: TPoolSizeSamples;
lArrIndex: Integer;
lSampleTick: Integer;
begin
lArrIndex := 0;
lSampleTick := 0;
while not Terminated do
begin
Expand Down
8 changes: 8 additions & 0 deletions sources/MVCFramework.RESTClient.pas
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,11 @@ function TMVCRESTClient.AddBodyFieldFormData(const aName: string; aStreamValue:
const aContentType: string): IMVCRESTClient;
begin
Result := Self;
{$IF Defined(DELPHI12ORBETTER)}
GetBodyFormData.AddStream(aName, aStreamValue, False, '', aContentType);
{$ELSE}
GetBodyFormData.AddStream(aName, aStreamValue, '', aContentType);
{$ENDIF}
SetContentType(TMVCMediaType.MULTIPART_FORM_DATA);
end;
{$ENDIF}
Expand Down Expand Up @@ -706,7 +710,11 @@ function TMVCRESTClient.AddFile(const aName, aFileName, aContentType: string): I
function TMVCRESTClient.AddFile(const aName: string; aFileStreamValue: TStream; const aFileName, aContentType: string): IMVCRESTClient;
begin
Result := Self;
{$IF Defined(DELPHI12ORBETTER)}
GetBodyFormData.AddStream(aName, aFileStreamValue, False, aFileName, aContentType);
{$ELSE}
GetBodyFormData.AddStream(aName, aFileStreamValue, aFileName, aContentType);
{$ENDIF}
SetContentType(TMVCMediaType.MULTIPART_FORM_DATA);
end;
{$ENDIF}
Expand Down
1 change: 0 additions & 1 deletion sources/MVCFramework.Rtti.Utils.pas
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,6 @@ class function TRttiUtils.FindByProperty<T>(AList: TObjectList<T>; APropertyName
V: TValue;
Found: Boolean;
begin
Found := False;
for elem in AList do
begin
V := GetProperty(elem, APropertyName);
Expand Down
3 changes: 0 additions & 3 deletions sources/MVCFramework.Serializer.JsonDataObjects.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3858,8 +3858,6 @@ procedure TJSONObjectHelper.LoadFromString(const Value: string; Encoding: TEncod

function TMVCJsonDataObjectsSerializer.JSONObjectToRecord<T>(const JSONObject: TJsonObject): T;
var
lTypeSize: Integer;
lTypeInfo: PTypeInfo;
AIgnoredAttributes: TMVCIgnoredList;
lKeyName: string;
lAttributeValue: TValue;
Expand All @@ -3876,7 +3874,6 @@ function TMVCJsonDataObjectsSerializer.JSONObjectToRecord<T>(const JSONObject: T
raise EMVCDeserializationException.Create('Extected record, got ' + lRTTIType.QualifiedName);
end;

lTypeInfo := lRTTIType.Handle;
lBuffer := @Result;
lField := nil;
AIgnoredAttributes := [];
Expand Down
Loading

0 comments on commit e1aa50d

Please sign in to comment.