Automatically generate implementation file from pas file

Hi, i need generate a implementation file of my server during automated build.
I tried use o service build with a option “Import Pas File”, but when a try import a file with a Code First attributes i got a error.
So, there are a alternative to generate this file whitout running my server?

If you have a local copy of the .rodl file (which you can save off your Code First server via a webbrowser or, say, curl, you can run rodl2code on that file instead of the live server url.

Thanks, but it don’t resolve for me. My server is changed constantly, so if i generate a rodl file it was outdate some minutes later.
I need some way to generate a implementation file from server pas files.

Ah. I’m afraid we do not have an option to top that without running the server, sorry.

Hi,

can you describe why you should generate _Impl for CodeFirst services?

in general, it has no sense because all logic of CodeFirst are put into _Impl …

in general, it is possible to generate .RODL from CodeFirst application so you will have always actual .RODL

imagine this scenario: when your server is launched, some code inside your application asks for RODL and save it to file near to .exe

Sorry, I don’t think I explained it correctly.

I have a server that runs a SynapseSuperTCPServer. In my server codes I have my services and classes using CodeFirst. Ex.:

const
coServiceName = ‘smFuncoesAdministração’;
type
[ROService (coServiceName)]
TSMFunctionsAdministration = class (TSMFunctionsBasic)

In my client project, in Delphi, I have a .remoteRODL file in which I right click and choose the “Update interface File (s)” option. Then my PServer_intf.pas file is generated.
My .remoteRODL file is as follows:

<Server>
<Name> PServer </Name>
<ServerUri> supertcp://localhost:3060/bin </ServerUri>
</Server>

I need to generate this same file during the automated build process of my client application, however, I don’t have a server running at this time, so I needed some way to generate this PServer_intf.pas from my server’s .pas.

Gotcha.

I’m afraid this is still something we do not support. Generating the _Intf requires a RODL, whether a local file or one provided by a running server; there is no way to obtain the required information from just the server source code, without running it, sorry.

yours,
marc

Hi,

this _Intf can be generated only from RODL that is created on-fly in a CodeFirst executable.

workaround:
you can create .RODL or _Intf after launching your server with special cmd line parameter

I can give some instructions how to add this workaround to your CodeFirst server

Ok, how would I be able to automatically generate the _Intf file after starting my server?

Something like this:

// 1st: get RODL:
// myRODLLib: TRODLLibrary;
myRODLLib :=  GetRodlLibrary(ServerDataModule.Message.RTTIReader);

// 2nd: generate _Intf. 
// x: TROCodegen4Files;
cg4 := TROCodegen4.Create;
x := cg4.Generate(myRODLLib, cg4l_Delphi, cg4m_Intf);
SaveStringToFile(x[0].FileName, x[0].Content);

//cleanup
x[0].Free;
cg4.Free;
myRODLLib.Free;

Note: it will work only on developer PC, where RO or DA is installed.

Thank you, I will try this.