generator

package
v0.0.0-...-7b92d88 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtenderName

func ExtenderName(e Extender) string

Types

type Adder

type Adder interface {
	AppConfig() []appconfig.ConfigValue
	ApplyOverlay(overlay *devicetree.DeviceTree) error
}

type Extender

type Extender interface {
	// Includes returns include paths that will be
	// added after all pre-defined includes in main.c
	Includes() []string
	// Template returns template path that will define
	// known extender steps.
	Template() string
	// WriteFiles returns a slice of files that should be written
	// from the template names. Necessary paths will be
	// created if file is located in directory that does not yet exist.
	// If any headers are created - they will not be included in main.c
	// If this is needed - add file path to `Includes()` return value.
	WriteFiles() []WriteFile
	// ZephyrModules adds a list of modules that extender provides.
	// Module can be anything(I guess).
	//
	// Module name will also write all files in templates
	// from the `modules/<zephyrModule>` path for each provided module.
	//
	// https://docs.zephyrproject.org/latest/develop/modules.html
	ZephyrModules() []string
}

Extender provides a way to extend source code by writing new files, add code to main.c and extend CMakeLists.txt

Each unique extender will be executed only once. Uniqueness of extender is determined either by package & type name, or by `Name`, if extender is instance of `SimpleExtender`.

type SimpleExtender

type SimpleExtender struct {
	// Name is unique identifier of extender.
	// Used only for deduplication purpuses.
	Name              string
	IncludeHeaders    []string
	TemplateName      string
	FilesToWrite      []WriteFile
	ZephyrModuleNames []string
	Config            []appconfig.ConfigValue
	OverlayFn         func(overlay *devicetree.DeviceTree) error
}

func (SimpleExtender) AppConfig

func (e SimpleExtender) AppConfig() []appconfig.ConfigValue

func (SimpleExtender) ApplyOverlay

func (e SimpleExtender) ApplyOverlay(overlay *devicetree.DeviceTree) error

func (SimpleExtender) Includes

func (e SimpleExtender) Includes() []string

Includes implements Extender.

func (SimpleExtender) Template

func (e SimpleExtender) Template() string

Template implements Extender.

func (SimpleExtender) WriteFiles

func (e SimpleExtender) WriteFiles() []WriteFile

WriteFiles implements Extender.

func (SimpleExtender) ZephyrModules

func (e SimpleExtender) ZephyrModules() []string

type WriteFile

type WriteFile struct {
	FileName          string
	TemplateName      string
	AdditionalContext any
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL