cancel
Showing results for 
Search instead for 
Did you mean: 

Calling the ESP compiler from the SDK

Former Member
0 Kudos

Hi, My customer has the following question.  Can anyone help?  Thanks.../Dan

I’m trying to use  the ESP SDK to compile the ESP ccls to create the ccx files.

I saw the Compiler interface in SDK but could not use it as we do not know about the compiler args needed.

Please check the following queries / comments :

  1. Need to know about the ESP Compiler interface available in ESP SDK .

          It looks like we can create the Compiler in ESP SDK using:

Compiler cclCompiler = CompilerFactory.getCompiler(ServerController);

Or

Compiler cclCompiler = CompilerFactory.getCompiler(compilerInputStr);

 

Need to know about the compilerInputStr that is used in this.

2.  Need to know about the compilerArgs and the CompilerOption used in ESP SDK to compile the ESP ccls.  

  

Eg :

private
Map<Compiler.CompilerOption, String> compilerArgs = new
HashMap<>();                      

CompilationResult compilationResult = cclCompiler.compile(

                                              cclFile.getAbsolutePath(),

                                             ccxFile.getAbsolutePath(), compilerArgs);

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

The SDK Compiler interface is meant for internal use and is hence not as well documented as other SDK interfaces. The recommended method of compilation is to use the executable streamingcompiler or studio compilation and we strongly urge our customers to utilize these methods.

That said, if there is a legitimate use case requiring the compiler SDK, here are instructions for its use.

There are two methods provided by the CompilerFactory to obtain a compiler instance. The first method takes a ServerController as an argument and returns a Compiler instance that runs remotely in the cluster. This is useful if the steaming binaries are not located on the physical device where the client is running.

The second method takes a String argument which is the STREAMING_HOME location. This returns a compiler instance that runs locally. If the customer is using this method, it is almost always better to simply call the executable instead.

Once the Compiler instance is obtained, the compile method may be called. Note that the arguments to this method are projectName (this is the name of the main ccl file) and projectPath (the local path to the project) and NOT (as above) cclFile and ccxFile. The ccx is returned as part of the compilationResult and it is the responsibility of the caller to save to a file if that is desired. Also note that all included ccl files must be located in the projectPath or one of its subdirectories.

As for the CompilerOptions, this parameter has been provided for future use and there are currently no CompilerOptions defined. This value can be passed as null.

Former Member
0 Kudos

Thanks Raphael, this was very informative.

And BTW, the client took your advice and is opting to use streamingcompiler, so long as it works with their deployment manager system.

Answers (0)