The google api binding generator "googleapiconv" is generating empty files for the api pascal bindings and it also causes access violations randomly. I have not found the issue with AVs yet, but I found out why it is creating empty source code files.
restcodegen.pp TRestCodeGenerator was refactored in 2018 to use pascodegen:
- TRestCodeGenerator = Class(TComponent)
+ TRestCodeGenerator = Class(TPascalCodeGenerator)
Before the refactoring, TRestCodeGenerator.SaveToStream used to call
"Execute;" if the source code string list was empty:
procedure TRestCodeGenerator.SaveToStream(const AStream : TStream);
begin
if (FSource.Count=0) then
Execute;
FSource.SaveToStream(AStream)
end;Now "Execute;" is not being called and no code is generated because
pascodegen.pp "TPascalCodeGenerator.SaveToStream" looks like this:
procedure TPascalCodeGenerator.SaveToStream(const AStream : TStream);
begin
FSource.SaveToStream(AStream)
end;ref: https://gitlab.com/freepascal.org/fpc/source/-/blob/main/packages/fcl-base/src/pascodegen.pp#L255
Two options to fix this are:
1) Add the "FSource" check and "Execute;" statements to TPascalCodeGenerator.SaveToStream
or
2) Add "Execute;" to TGoogleAPIConverter.DoConversion (googleapiconv.pp) before it calls "SaveToStream" here: https://gitlab.com/freepascal.org/fpc/source/-/blob/main/packages/googleapi/generator/googleapiconv.pp#L575
Question: Do you prefer I discuss issues like this here on the mailing list or instead open a bug report and discuss in the bug report?
