Odin

Developer reference: this page includes exported implementation details. BUILD authors should prefer the User API reference.

odinConfigSchema

const odinConfigSchema

Declarative workspace configuration schema for Odin. collections is a dynamic map[string]string from Odin collection names to workspace-relative paths. For example: export const odinConfig = { collections: { lib: "library" }, }; Package-local Odin collections use the collections option on odinPackage/odinTestPackage instead and may include target handles or { name, path } entries. buildGenerate enables imp goal generate-build for unowned .odin files (off by default).

declared_path()

declared_path(handle, path = ".")

Undocumented.

odin_package_handle()

odin_package_handle(handle)

Undocumented.

own_sources

const own_sources

Undocumented.

sources

const sources

Return a FileSet of the package's own sources plus all transitive odin-package dep sources.

ParameterTypeDescription
handleobjectLabel handle returned by odinPackage().

Returns: Promise<object> FileSet descriptor.

resources

const resources

Return a FileSet of all resource-package dep files reachable from an Odin package. (resource-package deps, real workspace files) and/or {kind:"digest"} objects (cmake-lib deps, whose build output is never materialized) — to be spread directly into a run()'s own inputs array.

ParameterTypeDescription
handleobjectLabel handle returned by odinPackage().

Returns: Promise<Array> A list of run()-inputs entries — FileSets

collection_flags

const collection_flags

Return the -collection:name=path flags configured for an Odin package.

ParameterTypeDescription
handleobjectLabel handle returned by odinPackage().

Returns: Promise<string[]>

collection_dirs

const collection_dirs

Undocumented.

OdinPackageAnalysis (implementation class)

class OdinPackageAnalysis

Implementation class. BUILD files should use odinPackageAnalysis().

Undocumented.

imports

const imports

Undocumented.

odinPackageAnalysis

const odinPackageAnalysis

Undocumented.

odinPackageHandles()

odinPackageHandles()

Every odinPackage() label declared in the workspace so far, as action-handle wrappers sorted by address. For consumers (e.g. rules/workflows/vs.js) that used to enumerate workspaceTargets("odin-package").

Returns: Array<object>

package_index

const package_index

Undocumented.

inferred_deps

const inferred_deps

Undocumented.

effective_deps

const effective_deps

Undocumented.

tool

const tool

Acquire the Odin toolchain and return a tool spec for sandbox use.

ParameterTypeDescription
handleobjectTarget handle returned by odinToolchain().

Returns: Promise<object> Tool spec.

default_output_path()

default_output_path(handle)

Undocumented.

odin_output_path()

odin_output_path(out, analysis)

Undocumented.

odinBuild

const odinBuild

Build an Odin package. binary/library's workspace-relative path.

ParameterTypeDescription
handleobjectLabel handle returned by odinPackage().

Returns: Promise<object> Run result, plus outputPath: the built

odinTest

const odinTest

Undocumented.

odinRun

const odinRun

Build and execute an Odin package's binary directly against the real workspace (not sandboxed) — the package must have a main entrypoint. Unlike the old Target/product-based "run" goal, a label's "run" handler (attached below, in odinPackage()) is dispatched directly and is not gated by rules/workflows/run/index.js's single-target pre-flight check — multi-selection rejection is therefore not enforced for label-based run dispatch, matching the precedent set by rules/python/source.js's own runGoal() handler.

ParameterTypeDescription
handleobjectLabel handle returned by odinPackage().

Returns: Promise<object> Run template.

odinLint

const odinLint

Lint an Odin package via odin check -vet (type-checks the package and flags unused declarations/imports, variable shadowing, and using statement misuse — no build output is produced). Mirrors cargoClippy / ruffCheck: reports a structured { ok, output, fixSupported, fixApplied, outputDigest } instead of throwing, so imp lint can run every selected target to completion and print a summary at the end. odin check has no autofix mode, so fix is accepted (for a uniform call signature across every lint handler) but always a no-op here.

ParameterTypeDescription
handleobjectLabel handle returned by odinPackage().
[opts]{fix?: boolean}

Returns: Promise<{ok: boolean, output: string, fixSupported: boolean, fixApplied: boolean, outputDigest: string|null}>

odinDistPackage

const odinDistPackage

Undocumented.

gen_input_sources

const gen_input_sources

Undocumented.

odinGenRun

const odinGenRun

Undocumented.

odinGen

const odinGen

Declare an Odin source generation label. The generator command is run with the output path appended as the last argument. Generated files must be excluded from any odinPackage glob that covers the same directory — use the exclude option of odinPackage to enforce single ownership.

ParameterTypeDescription
optsobject
[opts.srcs=[]]string[]Glob patterns for input files (for incremental tracking).
opts.outstringOutput file path, relative to the declaring BUILD.js directory.
opts.cmdstring[]Command to run; output path is appended as the final argument.
[opts.deps=[]]ArrayAdditional dependencies.

Returns: object Exported label handle.

odinPackage

const odinPackage

Declare an Odin package target. Sources are discovered lazily at build time via own_sources() / sources().

ParameterTypeDescription
optsobject
[opts.srcs=[]]string[]Glob patterns matched against paths relative to opts.path.
[opts.exclude=[]]string[]Glob patterns to exclude from matches.
[opts.path="."]stringWorkspace-relative package path.
[opts.collections=[]]object[]object
[opts.toolchain]objectstring
[opts.output]stringWorkspace-relative executable output path.
[opts.deps=[]]ArrayOdin package and resource package dependencies.

Returns: object Exported label handle.

odinTestPackage

const odinTestPackage

Declare an Odin test package target. Test packages participate in the test goal and run odin test. Unlike odinPackage, they include test files by default.

ParameterTypeDescription
optsobject
[opts.srcs=[]]string[]Glob patterns matched against paths relative to opts.path.
[opts.exclude=[]]string[]Glob patterns to exclude from matches.
[opts.path="."]stringWorkspace-relative package path.
[opts.collections=[]]object[]object
[opts.toolchain]objectstring
[opts.deps=[]]ArrayOdin package and resource package dependencies.

Returns: object Exported label handle.

odin_test_package

const odin_test_package

Undocumented.

generateBuild

const generateBuild

Undocumented.