xref

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package xref scans a Unity project for inbound PPtr references to a set of fileIDs inside a target asset. It is per-mutation (no caching — a cached index could go stale and mask a dangling reference) and conservative: a file whose references cannot be fully accounted for is reported as "indeterminate" so a consumer can treat uncertainty as a block reason.

The API takes a fileID SET (a single reparent target is the size-1 case) so the same scanner backs the delete/--cascade subtree case later (S5). reparent uses only the inbound list + indeterminate list as visibility; delete will use them as block reasons.

It uses unity-ctx's own parser (which parses both inline `{fileID, guid}` and block-style multi-line PPtrs) rather than the kernel's single-line ExtractRefs, which silently drops block-style references. As a completeness backstop, any file whose raw bytes mention the target GUID more times than structured PPtr references were recovered is flagged indeterminate — so an unparseable reference form can never be silently reported as "no refs".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InboundHit

type InboundHit struct {
	Path    string
	FileIDs []int64
}

InboundHit is one other file that references the target asset's fileIDs.

type Request

type Request struct {
	ProjectPath string
	TargetPath  string  // the asset being edited (excluded from its own scan)
	FileIDs     []int64 // target local fileIDs to find inbound references to
}

type Result

type Result struct {
	TargetGUID string
	// Inbound: files (other than the target) holding a PPtr {fileID in set, guid:
	// target} — a cross-file reference into the edited object set.
	Inbound []InboundHit
	// Indeterminate: files whose references could not be fully accounted for
	// (parse failure, or a target-GUID mention not recovered as a structured
	// PPtr). Conservative signal: their inbound refs are unknown.
	Indeterminate []string
}

func ScanInbound

func ScanInbound(req Request) (Result, error)

ScanInbound walks the project's Assets/ and enumerates inbound PPtr references to (target GUID, fileID set), excluding the target file itself (in-file links are the graph-check's job). It never writes.

Jump to

Keyboard shortcuts

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