PtcRunner.Kernel.Materialize (PtcRunner v0.15.0)

Copy Markdown View Source

Shared candidate-gate and source-export implementation for ptc materialize.

Candidate mode hashes authored bytes, publishes {candidate.clj, descriptor.json}, and re-acquires the application through that descriptor. Source-export mode writes the installed effective component bytes to one owner-only file without creating a descriptor. The two modes are mutually exclusive because a descriptor hashes the exact candidate beside it.

Summary

Functions

Runs one materialize invocation against an application manifest path.

Types

opts()

@type opts() :: keyword()

published()

report()

result()

@type result() ::
  {:ok, {:source_out, binary()}}
  | {:ok, {:candidate, report(), published()}}
  | {:refused, report()}
  | {:error, term()}

target()

@type target() :: %{required(binary()) => binary()}

Functions

run(application, opts)

@spec run(binary(), opts()) :: result()

Runs one materialize invocation against an application manifest path.

Project command callers pass the non-secret installed limits decoded from the project's host document when present; direct callers and hostless projects use installed defaults. Neither source-export nor candidate acquisition resolves credentials or starts a provider.

:source_out writes interned installed effective bytes for one selected component to a new owner-only file (mode 0600). :out plus :source or :from_result publishes a gated {candidate.clj, descriptor.json} directory. The modes are exclusive because a descriptor hashes the exact candidate published beside it.

Candidate mode keeps the existing 1_048_576-byte replacement bound. --source-out writes interned acquired package bytes for the selected occurrence without compiling a bundle or assembling an environment. Those installed bytes can already exceed the candidate bound; submitting them as a replacement is refused with the existing too-large diagnostic.