metadiff

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package metadiff compares two metadata trees and produces a semantic API change report. An SDK bump rewrites hundreds of megabytes of .gometa.json — unreviewable as a raw git diff. This report makes the bump auditable (what was added, removed, or changed) and doubles as a consumer-facing changelog. A mass disappearance of one construct kind usually means a scanner regression rather than an Apple change — exactly what a reviewer needs to see before merging.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FrameworkDiff

type FrameworkDiff struct {
	Framework string `json:"framework"`

	ClassesAdded   []string `json:"classes_added,omitempty"`
	ClassesRemoved []string `json:"classes_removed,omitempty"`

	MethodsAdded   []string          `json:"methods_added,omitempty"`   // "Class.selector"
	MethodsRemoved []string          `json:"methods_removed,omitempty"` // "Class.selector"
	MethodChanges  []SignatureChange `json:"method_changes,omitempty"`

	ProtocolsAdded   []string `json:"protocols_added,omitempty"`
	ProtocolsRemoved []string `json:"protocols_removed,omitempty"`

	EnumsAdded         []string `json:"enums_added,omitempty"`
	EnumsRemoved       []string `json:"enums_removed,omitempty"`
	EnumMembersAdded   []string `json:"enum_members_added,omitempty"`   // "Enum.Member"
	EnumMembersRemoved []string `json:"enum_members_removed,omitempty"` // "Enum.Member"
	// EnumBaseTypeChanges lists enums whose underlying Go type changed —
	// an ABI-relevant change for every generated cast on that enum.
	EnumBaseTypeChanges []SignatureChange `json:"enum_base_type_changes,omitempty"`

	StructsAdded   []string `json:"structs_added,omitempty"`
	StructsRemoved []string `json:"structs_removed,omitempty"`

	FunctionsAdded   []string          `json:"functions_added,omitempty"`
	FunctionsRemoved []string          `json:"functions_removed,omitempty"`
	FunctionChanges  []SignatureChange `json:"function_changes,omitempty"`

	ExternsAdded   []string `json:"externs_added,omitempty"`
	ExternsRemoved []string `json:"externs_removed,omitempty"`

	// DeprecationChanges lists classes whose deprecated version changed
	// (typically "" → some version: newly deprecated API).
	DeprecationChanges []string `json:"deprecation_changes,omitempty"`
}

FrameworkDiff is the change set for a single framework present in both trees.

func (*FrameworkDiff) IsEmpty

func (d *FrameworkDiff) IsEmpty() bool

IsEmpty reports whether the framework saw no changes.

type Report

type Report struct {
	OldSDK string `json:"old_sdk"`
	NewSDK string `json:"new_sdk"`

	FrameworksAdded   []string         `json:"frameworks_added,omitempty"`
	FrameworksRemoved []string         `json:"frameworks_removed,omitempty"`
	Changed           []*FrameworkDiff `json:"changed,omitempty"`
}

Report is the full comparison between two metadata trees.

func Compare

func Compare(oldFrameworks, newFrameworks []*macosplatformmetadata.FrameworkMeta) *Report

Compare diffs two metadata sets, keyed by framework name. Same-name duplicates within a set (a framework shipped both top-level and inside an umbrella) collapse to the top-level entry, mirroring the loader.

func (*Report) IsEmpty

func (r *Report) IsEmpty() bool

IsEmpty reports whether the two trees are semantically identical.

func (*Report) WriteMarkdown

func (r *Report) WriteMarkdown(w io.Writer)

WriteMarkdown renders the report as reviewable markdown.

type SignatureChange

type SignatureChange struct {
	Name string `json:"name"` // "NSString.stringWithFormat:" or "CFArrayCreate"
	Old  string `json:"old"`
	New  string `json:"new"`
}

SignatureChange records one declaration whose signature changed between trees.

Jump to

Keyboard shortcuts

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