craft_parts.plugins.dotnet_plugin module

The Dotnet plugin.

class craft_parts.plugins.dotnet_plugin.DotPluginEnvironmentValidator(*, part_name, env, properties)[source]

Bases: PluginEnvironmentValidator

Check the execution environment for the Dotnet plugin.

Parameters:
  • part_name (str) – The part whose build environment is being validated.

  • env (str) – A string containing the build step environment setup.

  • properties (PluginProperties)

validate_environment(*, part_dependencies=None)[source]

Ensure the environment contains dependencies needed by the plugin.

Parameters:

part_dependencies (Optional[list[str]]) – A list of the parts this part depends on.

Return type:

None

class craft_parts.plugins.dotnet_plugin.DotnetPlugin(*, properties, part_info)[source]

Bases: Plugin

A plugin for dotnet projects.

The dotnet plugin requires dotnet installed on your system. This can be achieved by adding the appropriate dotnet snap package to build-snaps, or to have it installed or built in a different part. In this case, the name of the part supplying the dotnet compiler must be “dotnet”.

The dotnet plugin uses the common plugin keywords as well as those for “sources”. Additionally, the following plugin-specific keywords can be used:

  • dotnet-build-configuration (string) The dotnet build configuration to use. The default is “Release”.

  • dotnet-self-contained-runtime-identifier (string) Create a self contained dotnet application using the specified RuntimeIdentifier.

Parameters:
get_build_commands()[source]

Return a list of commands to run during the build step.

Return type:

list[str]

get_build_environment()[source]

Return a dictionary with the environment to use in the build step.

Return type:

dict[str, str]

get_build_packages()[source]

Return a set of required packages to install in the build environment.

Return type:

set[str]

get_build_snaps()[source]

Return a set of required snaps to install in the build environment.

Return type:

set[str]

properties_class

alias of DotnetPluginProperties

validator_class

alias of DotPluginEnvironmentValidator

class craft_parts.plugins.dotnet_plugin.DotnetPluginProperties(**data)[source]

Bases: PluginProperties

The part properties used by the Dotnet plugin.

Parameters:

data (Any)

dotnet_build_configuration: str
dotnet_self_contained_runtime_identifier: str | None
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'alias_generator': <function PluginProperties.<lambda>>, 'extra': 'forbid', 'frozen': True, 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'dotnet_build_configuration': FieldInfo(annotation=str, required=False, default='Release', alias='dotnet-build-configuration', alias_priority=1), 'dotnet_self_contained_runtime_identifier': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, alias='dotnet-self-contained-runtime-identifier', alias_priority=1), 'plugin': FieldInfo(annotation=Literal['dotnet'], required=False, default='dotnet', alias='plugin', alias_priority=1), 'source': FieldInfo(annotation=str, required=True, alias='source', alias_priority=1)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

plugin: Literal['dotnet']
source: str