Compilation
Prerequisites
Be sure to have read the previous section before proceeding.
This section will use Python as an example but the process can be adapted for any programming language when generating code from Sift's protocol buffers.
Selecting Plugins
The Buf Schema Registry hosts various plugins that you can use to generate code for your language of choice. The plugins can be found at this link.
- Identify plugins for your chosen programming language
- Create a
buf.gen.yaml
file to specify your selected plugins
You can modify the out
field for each plugin to change where the generated code gets emitted.
Runtime Dependencies
For many of these plugins to work properly after the code has been generated, additional runtime dependencies may be required. Visit the documentation for each plugin you're using for more information on what is needed.
Generating Code
After creating your buf.gen.yaml
, follow these steps to generate code from Sift's protocol buffers:
-
Export Sift's protocol buffers to your project directory:
Replace:
<OUTPUT_DIR>
with the path to where protocol buffers will be emitted<PATH_TO_SIFT_BUF_CONFIG>
should be replaced with the path to the cloned buf.yaml
-
Verify that Sift's protocol buffers are now in your
<OUTPUT_DIR>
-
Ensure that you are in the same directory as your
buf.gen.yaml
-
Run the following command:
OUTPUT_DIR
is the same directory containing Sift's protocol buffers.
If successful, the generated code will be emitted in the directory specified in your buf.gen.yaml
.