craft_parts.plugins.ant_plugin module¶
The Ant plugin.
- class craft_parts.plugins.ant_plugin.AntPlugin(*, properties, part_info)[source]¶
Bases:
JavaPluginA plugin for Apache Ant projects.
The plugin requires the
anttool installed on the system. This can be achieved by adding the appropriate declarations tobuild-packagesorbuild-snaps, or by having it installed or built in a different part. In this case, the name of the part supplyingantmust be “ant-deps”.Additionally, Java projects need a dev kit (jdk) to build and a runtime environment (jre) to run. There are multiple choices here, but frequently adding
default-jdk-headlesstobuild-packagesanddefault-jre-headlesstostage-packagesis enough.Once built, the plugin will create the following structure in the part’s install dir (which will later be staged/primed/packaged):
A
bin/javasymlink pointing to the actualjavabinary provided by the jre;A
jar/directory containing the .jar files generated by the build.
The ant plugin uses the common plugin keywords, plus the following ant- specific keywords:
ant-build-targets(list of strings) The ant targets to build. These are directly passed to theantcommand line.ant-build-file(str) The name of the main ant build file. Defaults tobuild.xml.ant-properties(dict of strings to strings) A series of key: value pairs that are passed to ant as properties (using the-D{key}={value}notation).
- Parameters:
properties (
PluginProperties) –part_info (
PartInfo) –
- 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
AntPluginProperties
- validator_class¶
alias of
AntPluginEnvironmentValidator
- class craft_parts.plugins.ant_plugin.AntPluginEnvironmentValidator(*, part_name, env, properties)[source]¶
Bases:
PluginEnvironmentValidatorCheck the execution environment for the Ant 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.- Raises:
PluginEnvironmentValidationError – If
antis invalid
and there are no parts named ant.
- Return type:
None
- class craft_parts.plugins.ant_plugin.AntPluginProperties(**data)[source]¶
Bases:
PluginProperties,PluginModelThe part properties used by the Ant plugin.
- Parameters:
data (
Any) –
- ant_build_file: Optional[str]¶
- ant_build_targets: List[str]¶
- ant_properties: Dict[str, str]¶
- source: str¶