Edk2 multipkg aware invocable
edk2_multipkg_aware_invocable ¶
An intermediate class that supports a multi-package aware invocable process.
Provides two main classes, the MultiPkgAwareSettingsInterface and the Edk2MultiPkgAwareInvocable that act as an intermediate class that other invocables that require a multi-package aware invocable process. These classes should only be subclassed if a new invocable is being developed. Any Edk2MultiPkgAwareInvocable should be platform agnostic and work for any platform. Platform specific data is provided via the MultiPkgAwareSettingsInterface
MultiPkgAwareSettingsInterface ¶
Settings to support Multi-Pkg functionality.
This is an interface definition only to show which functions are required to be implemented and which functions can be implemented.
Example of Overriding MultiPkgAwareSettingsInterface
import os
import logging
import argparse
from typing import Iterable, Tuple
from edk2toolext.edk2_multipkg_aware_invocable import MultiPkgAwareSettingsInterface
class NewInvocableSettingsManager(MultiPkgAwareSettingsInterface):
def GetPackagesSupported(self):
return ("PlatformPkg",)
def GetArchitecturesSupported(self):
return ("IA32","X64")
def GetTargetsSupported(self):
return ("TARGET", "RELEASE")
def SetPackages(self, list_of_requested_packages):
if len(filter(lambda pkg: pkg in self.GetPackagesSupported(), list_of_requested_packages)) !=
len(list_of_requested_packages):
raise Exception("Requested Packages contains unsupported Package")
else:
self.pkgs = list_of_requested_packages
def SetArchitectures(self, list_of_requested_architectures):
if list_of_requested_architectures != self.GetPackagesSupported():
raise Exception("Only Support IA32,X64 combination")
def SetTargets(self, list_of_requested_targets):
if list_of_requested_targets != self.GetArchitecturesSupported():
raise Exception("Only Support "TARGET", "RELEASE combination")
Warning
This interface should not be subclassed directly unless creating a new invocable type. Override these methods as a part of other subclasses invocable settings managers such as SetupSettingsManager, etc.
GetPackagesSupported ¶
GetPackagesSupported() -> Iterable[str]
Returns an iterable of edk2 packages supported by this build.
Tip
Required Override in a subclass
Returns:
Type | Description |
---|---|
Iterable
|
edk2 packages |
Note
packages should be relative to workspace or package path
GetArchitecturesSupported ¶
GetArchitecturesSupported() -> Iterable[str]
Returns an iterable of edk2 architectures supported by this build.
Tip
Required Override in a subclass
Returns:
Type | Description |
---|---|
Iterable
|
architectures (X64, I32, etc.) |
GetTargetsSupported ¶
GetTargetsSupported() -> Iterable[str]
Returns an iterable of edk2 target tags supported by this build.
Tip
Required Override in a subclass
Returns:
Type | Description |
---|---|
Iterable
|
targets (DEBUG, RELEASE, etc) |
SetPackages ¶
SetPackages(list_of_requested_packages: list) -> None
Confirms the requested package list is valid.
Tip
Optional Override in a subclass
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_of_requested_packages |
list[str]
|
packages to be built |
required |
Raises:
Type | Description |
---|---|
Exception
|
A requested package is not supported |
SetArchitectures ¶
SetArchitectures(
list_of_requested_architectures: list,
) -> None
Confirms the requested architecture list is valid.
Tip
Optional Override in a subclass
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_of_requested_architectures |
list[str]
|
architectures to be built |
required |
Raises:
Type | Description |
---|---|
Exception
|
A requested architecture is not supported |
SetTargets ¶
SetTargets(list_of_requested_target: list) -> None
Confirms the requested target list is valid.
Tip
Optional Override in a subclass
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_of_requested_target |
list[str]
|
targets to use |
required |
Raises:
Type | Description |
---|---|
Exception
|
A requested target is not supported |
Edk2MultiPkgAwareInvocable ¶
Base class for Multi-Pkg aware invocable.
Attributes:
Name | Type | Description |
---|---|---|
requested_architecture_list |
list
|
requested architectures to build |
requested_package_list |
list
|
requested packages to build |
requested_target_list |
list
|
requested targets to use |
Tip
Checkout Edk2Invocable Attributes to find any additional attributes that might exist.
Warning
This invocable should only be subclassed if creating a new invocable
AddCommandLineOptions ¶
AddCommandLineOptions(
parserObj: argparse.ArgumentParser,
) -> None
Adds command line options to the argparser.
RetrieveCommandLineOptions ¶
RetrieveCommandLineOptions(
args: argparse.Namespace,
) -> None
Retrieve command line options from the argparser .
InputParametersConfiguredCallback ¶
InputParametersConfiguredCallback() -> None
Initializes the environment once input parameters are collected.