Configuration¶
PyDjinni can be configured in different ways:
- Configuration file: If a file named
pydjinni.yaml
exists, it is picked up automatically. With the parameter--config
a custom filename can be specified. The type of the file is determined by the filename extension.
Supported extensions are:.yaml
,.yml
,.json
,.toml
Example:pydjinni --config=custom_filename.yaml generate input.djinni cpp
- CLI: The CLI
--option
parameter allows to set one or more configuration keys. Values from the configuration file can be overridden by commandline parameters.
Example:pydjinni --option generate.cpp.out=cpp_out_path generate input.djinni cpp
- Environment Variables: Options can also be provided by setting environment variables.
Environment variables can also be set in a
.env
file. The file is automatically detected if present in the working directory.
Example: the environment variablepydjinni__generate__cpp__out=header_out
is the equivalent to passing--option generate.cpp.out
to the CLI. - For some common settings a shortcut in the form of a special argument is provided by the CLI.
Example: When packaging a library, the default build configuration can be overridden like so:pydjinni package --configuration Debug aar android
. The--configuration
argument is equivalent to setting thepackage.configuration
value in the configuration file or to passing the argument-o package.configuration=Debug
to the CLI.
Configuration Parameters¶
generate¶
Configuration options related to language gluecode generation
Name | Type | Description |
---|---|---|
list_processed_files |
string | File that reports all the parsed and generated files. File format is determined by the file extension. Supported extensions: .yaml , .yml , .json , .toml (Optional) |
include_dirs |
array | Include directories that are searched for @import and @extern directives.Default: [] |
default_deriving |
array | Deriving functionality that should be added to every record by default. Default: [] |
support_lib_sources |
boolean | Whether the required support lib sources should be copied to the generated output. Default: True |
cpp¶
Name | Type | Description |
---|---|---|
out |
string, OutPaths | The output folder for the generated files. Separate folders for source and header files can be specified. |
namespace |
string, array | The namespace name to use for generated C++ classes Default: [] |
include_prefix |
string | The prefix for #includes of header files from C++ files(Optional) |
header_extension |
string | The filename extension for C++ header files Default: hpp |
source_extension |
string | The filename extension for C++ files Default: cpp |
string_serialization |
boolean | Whether to generate to_string and std::formatter overloads for stringifying records, enums and flagsDefault: True |
not_null¶
Configuration for wrapping std::shared_ptr
with a not_null
type.
Name | Type | Description |
---|---|---|
header |
string | The header file to include for not_null (e.g. <gsl/pointers> )(Optional) |
type |
string | The type to use for not_null (e.g. ::gsl::not_null )(Optional) |
identifier¶
Name | Type | Description |
---|---|---|
type |
IdentifierStyle, string | Default: PascalCase |
enum |
IdentifierStyle, string | Default: TRAIN_CASE |
file |
IdentifierStyle, string | Default: snake_case |
field |
IdentifierStyle, string | Default: snake_case |
method |
IdentifierStyle, string | Default: snake_case |
namespace |
IdentifierStyle, string | Default: snake_case |
cppcli¶
Name | Type | Description |
---|---|---|
out |
string, OutPaths | The output folder for the generated files. Separate folders for source and header files can be specified. |
namespace |
string, array | The namespace name to use for generated C++/CLI classes Default: [] |
include_cpp_prefix |
string | The prefix for #includes of header files from C++ files(Optional) |
nullability_attributes |
boolean | Whether diagnostics nullability attributes should be added to methods, functions and fields (Not available in .NET Framework) Default: True |
string_serialization |
boolean | Whether to generate ToString overloads for recordsDefault: True |
identifier¶
Name | Type | Description |
---|---|---|
type |
IdentifierStyle, string | Default: PascalCase |
type_param |
IdentifierStyle, string | Default: PascalCase |
property |
IdentifierStyle, string | Default: PascalCase |
method |
IdentifierStyle, string | Default: PascalCase |
local |
IdentifierStyle, string | Default: camelCase |
enum |
IdentifierStyle, string | Default: PascalCase |
const |
IdentifierStyle, string | Default: snake_case |
file |
IdentifierStyle, string | Default: - style: PascalCase - prefix: CppCli |
namespace |
IdentifierStyle, string | Default: PascalCase |
java¶
Java configuration options
Name | Type | Description |
---|---|---|
out |
string | The output folder for the generated files. |
package |
string, array | The package name to use for generated Java classes Examples: - my.package.name - other.package.name |
support_types_package |
string, array | The subpackage name where required support types are generated to Default: ['pydjinni'] |
interfaces |
boolean | Whether Java interfaces should be used instead of abstract classes where possible Default: False |
class_access_modifier |
string | One of public , package |
cpp_exception |
string | The type for translated C++ exceptions in Java Default: java.lang.RuntimeException |
annotation |
string | Java annotation to place on all generated Java classes (Optional)Example: @Foo |
nullable_annotation |
string | annotation that is added to all optional fields, parameters and return types. E.g. @org.jetbrains.annotations.Nullable (Optional) |
nonnull_annotation |
string | annotation that is added to all non-optional fields, parameters and return types. E.g. @org.jetbrains.annotations.NotNull (Optional) |
use_final_for_record |
boolean | Whether generated Java classes for records should be marked final Default: True |
native_lib |
string | Name of the native library containing the JNI interface. If this option is set and an interface is marked as main , a static block will be added to the interface, that loads the native library.(Optional) |
function_prefix |
string | Prefix for generated functional interfaces. Default: Functional |
string_serialization |
boolean | Whether to generate toString overloads for recordsDefault: True |
identifier¶
Name | Type | Description |
---|---|---|
enum |
IdentifierStyle, string | Default: TRAIN_CASE |
field |
IdentifierStyle, string | Default: camelCase |
type |
IdentifierStyle, string | Default: PascalCase |
method |
IdentifierStyle, string | Default: camelCase |
package |
IdentifierStyle, string | Default: snake_case |
jni¶
Name | Type | Description |
---|---|---|
out |
string, OutPaths | The output folder for the generated files. Separate folders for source and header files can be specified. |
namespace |
string, array | The namespace name to use for generated JNI C++ classes |
include_prefix |
string | The prefix for #includes of JNI header files from JNI C++ files.(Optional) |
include_cpp_prefix |
string | The prefix for #includes of the main header files from JNI C++ files.(Optional) |
header_extension |
string | The filename extension for JNI C++ header files Default: hpp |
source_extension |
string | The filename extension for JNI C++ files Default: cpp |
loader |
boolean | If enabled, a minimal JNI_OnLoad /JNI_OnUnload implementation is generated.Default: True |
identifier¶
Name | Type | Description |
---|---|---|
file |
IdentifierStyle, string | Default: snake_case |
class_name |
IdentifierStyle, string | Default: PascalCase |
enum |
IdentifierStyle, string | Default: TRAIN_CASE |
field |
IdentifierStyle, string | Default: camelCase |
method |
IdentifierStyle, string | Default: camelCase |
namespace |
IdentifierStyle, string | Default: PascalCase |
objc¶
Name | Type | Description |
---|---|---|
out |
string, OutPaths | The output folder for the generated files. Separate folders for source and header files can be specified. |
type_prefix |
string | The prefix for Objective-C data types (usually two or three letters). (Optional)Default: `` |
header_extension |
string | The filename extension for Objective-C header files. Default: h |
source_extension |
string | The filename extension for Objective-C source files. Default: m |
swift_bridging_header |
string | The name of the Objective-C Bridging Header required for using the interface from Swift. (Optional) |
strict_protocols |
boolean | All generated @protocol will implement <NSObject> Default: False |
string_serialization |
boolean | Whether to generate description overloads for recordsDefault: True |
swift¶
Configuration options related to using the Objective-C interface from Swift
Name | Type | Description |
---|---|---|
rename_interfaces |
boolean | Whether the Objective-C interface should be annotated with improved Swift method and class names. Default: True |
bridging_header |
string | The name of the Objective-C Bridging Header required for using the interface from Swift. (Optional) |
identifier¶
Name | Type | Description |
---|---|---|
enum |
IdentifierStyle, string | Default: PascalCase |
field |
IdentifierStyle, string | Default: camelCase |
method |
IdentifierStyle, string | Default: camelCase |
type |
IdentifierStyle, string | Default: PascalCase |
param |
IdentifierStyle, string | Default: PascalCase |
local |
IdentifierStyle, string | Default: camelCase |
objcpp¶
Name | Type | Description |
---|---|---|
out |
string, OutPaths | The output folder for the generated files. Separate folders for source and header files can be specified. |
namespace |
string, array | The namespace name to use for generated Objective-C++ classes Default: [] |
header_extension |
string | The filename extension for Objective-C++ header files Default: h |
source_extension |
string | The filename extension for Objective-C++ source files Default: mm |
yaml¶
When generating the interface for your project and wish to make it available to other users you can tell Djinni to generate a special YAML file as part of the code generation process. This file then contains all the information Djinni requires to include your types in a different project.
Name | Type | Description |
---|---|---|
out |
string | The output folder for YAML files (One for each type by default). |
out_file |
string | If specified, all types are merged into a single YAML file instead of generating one file per type (relative to yaml.out ).(Optional) |
build¶
Build strategy configuration
conan¶
Settings specific to the Conan build strategy
Name | Type | Description |
---|---|---|
profiles |
string | The base directory where the target profiles are located Default: profiles |
package¶
Packaging configuration
Name | Type | Description |
---|---|---|
out |
string | output base directory for the final distributable packages Default: dist |
target |
string | Name of the target that is going to produce the output |
build_strategy |
string | Build system that should be used for compiling Default: conan |
version |
string | Version of the produced package Default: 0.0.0 |
configuration |
string | One of Release , Debug , MinSizeRel , RelWithDebInfo |
aar¶
Android Archive
publish¶
Maven publishing information
Name | Type | Description |
---|---|---|
maven_registry |
string | Url of the maven registry that the package should be published to. |
group_id |
string | Maven package groupId |
artifact_id |
string | Maven package artifactId |
username |
string | Username for the maven registry (Optional) |
password |
string | Password (token) to access the maven registry.It is recommended to set this via the environment variable PACKAGE__AAR__PUBLISH__PASSWORD (Optional) |
platforms¶
Name | Type | Description |
---|---|---|
android |
array | List of targeted architectures. Supported: x86 , x86_64 , armv7 , armv8 |
nuget¶
NuGet Package
publish¶
NuGet packaging and publishing configuration
Name | Type | Description |
---|---|---|
source |
string, string | NuGet server URL or local folder where the package should be published. Examples: - https://nuget.pkg.github.com/NAMESPACE/index.json - C:\Users\Foo\Path\To\Local\Install Default: https://api.nuget.org/v3/index.json |
repository |
string | URL to the source Git repository. (Optional) |
description |
string | (short) description of the package. (Optional)Default: `` |
readme |
string | Path to a Markdown Readme file that should be included in the NuGet package. (Optional) |
net_version |
string | .NET version used to compile the binaries. The packaged binaries have to be compiled for the configured .NET version! Default: net8.0 |
authors |
array | A comma-separated list of packages authors (matching the related profile names on nuget.org if published to the public registry)Default: [] |
username |
string | Username for the NuGet Server (Optional) |
password |
string | Password (token) to access the server.It is recommended to set this via the environment variable PACKAGE__NUGET__PUBLISH__PASSWORD (Optional) |
platforms¶
Name | Type | Description |
---|---|---|
windows |
array | List of targeted architectures. Supported: x86 , x86_64 , armv7 , armv8 |
swiftpackage¶
Swift package
publish¶
Name | Type | Description |
---|---|---|
repository |
string, string | Remote Git repository or path to a local directory where the package should be published Examples: - https://github.com/foo/bar.git - /path/where/swiftpackage/should/be/copied/to - git@github.com:foo/bar.git |
branch |
string | Git repository branch that the package should be pushed to. Default: main |
username |
string | Username of git repository (Optional) |
password |
string | Password (token) to access the git repository.It is recommended to set this via the environment variable PACKAGE__SWIFTPACKAGE__PUBLISH__PASSWORD (Optional) |
platforms¶
Name | Type | Description |
---|---|---|
macos |
array | List of targeted architectures. Supported: x86_64 , armv8 |
ios |
array | List of targeted architectures. Supported: armv8 |
ios_simulator |
array | List of targeted architectures. Supported: x86_64 , armv8 |
Type Definitions¶
OutPaths¶
Name | Type | Description |
---|---|---|
source |
string | The output directory for source files |
header |
string | The output directory for header files |
IdentifierStyle¶
Name | Type | Description |
---|---|---|
style |
string | One of none , camelCase , PascalCase , snake_case , kebab-case , TRAIN_CASE |
prefix |
string | Prefix that is added to the beginning of the identifier (Optional) |