pipeline

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateBindings

func GenerateBindings(cfg BindingsConfig) error

GenerateBindings generates all framework and library packages from the registry.

func GenerateIdiomatic

func GenerateIdiomatic(cfg IdiomaticConfig) error

GenerateIdiomatic writes the opinionated idiomatic layer to cfg.OutDir. For each targeted framework it emits one *_generated.go wrapper file per ObjC class, bundling raw alloc+init calls into Go constructors and improving async, collection, and error-handling ergonomics.

func SortByDependency

func SortByDependency(reg *Registry) []*meta.FrameworkMeta

SortByDependency returns frameworks in topological order (dependencies first).

Types

type BindingsConfig

type BindingsConfig struct {
	Registry         *Registry
	FrameworksOutDir string // e.g. ./purego-frameworks
	LibrariesOutDir  string // e.g. ./purego-libraries
	Verbose          bool

	// DiagnosticsSink, when non-nil, receives every type-degradation
	// diagnostic recorded by the per-framework type mappers (unsafe.Pointer
	// fallbacks and cycle-forced objc.ID substitutions). The CLI uses this
	// to enforce a committed diagnostics baseline.
	DiagnosticsSink *[]string
}

BindingsConfig controls the bindings generation pass.

type IdiomaticConfig

type IdiomaticConfig struct {
	// Registry is the combined metadata for all frameworks.
	Registry *Registry
	// OutDir is the root output directory. Each framework writes to OutDir/<pkgname>/.
	// Canonical value: <repo-root>/opinionated/idiomatic
	OutDir string
	// Frameworks is an optional filter; empty means all frameworks.
	Frameworks []string
	// Verbose enables diagnostic output.
	Verbose bool
}

IdiomaticConfig controls generation of the opinionated idiomatic layer.

type Registry

type Registry struct {
	Frameworks        []*meta.FrameworkMeta
	ClassNameIndex    map[string]bool
	GenericClasses    map[string]bool
	GenericParamIndex map[string][]string
	OwnerIndex        map[string]string // className → framework name
	ProtocolIndex     map[string]string // protocol name → owning framework
	EnumIndex         map[string]string // enum name → owning framework
	EnumGoTypeIndex   map[string]string // enum name → underlying Go type
	TypedefIndex      map[string]string // typedef name → target ObjC qualType
	TypedefOwnerIndex map[string]string
	StructIndex       map[string]string // struct name → owning framework
	CFTypeIndex       map[string]string // CF opaque typedef → owning framework
	ClassIndex        map[string]meta.Class
	// EmittableStructs is the set of value-struct Go names the idiomatic layer
	// emits a definition for (computed lazily once during idiomatic generation).
	EmittableStructs map[string]bool
	// UnavailableClasses is the set of ObjC class names that have IsUnavailable=true.
	// The mapper degrades references to these classes to objc.ID.
	UnavailableClasses map[string]bool
	// UnavailableEnumBaseTypes maps unavailable enum names → underlying Go type.
	// The mapper degrades references to these enums to their base integer type.
	UnavailableEnumBaseTypes map[string]string
	// BlockedImports[src][dst]=true means src must not import dst (cycle break).
	BlockedImports map[string]map[string]bool
	// ModulePrefix is the Go module path prefix for framework packages.
	// e.g. "github.com/deploymenttheory/go-bindings-macosplatform/purego-frameworks"
	ModulePrefix string
	// LibraryModulePrefix is the module path prefix for C library packages.
	LibraryModulePrefix string
}

Registry holds combined metadata from all loaded frameworks. It is the single source of truth for cross-framework type resolution.

func LoadAll

func LoadAll(paths []string, modulePrefix, libraryModulePrefix string) (*Registry, error)

LoadAll reads .gometa.json files from the given paths (files or directories) and builds a Registry. Directories are scanned one level deep; arm64 files are preferred when multiple arch variants exist.

Jump to

Keyboard shortcuts

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