compileTeardown method

List<BuildStep> compileTeardown(
  1. BuildContext ctx
)

Compiles this target's teardown steps (ADR-0018 §2) — same contract as compile, executed by the best-effort runTeardownSteps runner after the forward pipeline ends (success or failure), never masking its result. Steps consume the forward run's PipelineState artifacts (e.g. emulator-serial, the chrome pid/profile-dir sub-handles), so a spawn step and its stop step stay a pure composition pair.

Teardown may also run in other processes (the L2 reconcile sweep, oka stop) — cross-run state rides the lease registry, not PipelineState. Default: no teardown (a target that spawns nothing long-lived needs none).

Example — the stopOnExit pattern (see EmulatorTarget), aborting the whole run's lifecycle when the user declares it:

class HarnessTarget extends Target {
  @override
  String get name => 'harness';
  @override
  String get description => 'boot emulator + browser, run tests, stop';

  @override
  List<BuildStep> compile(BuildContext ctx) => [
        BootEmulatorStep(avdName: 'oka-emulator'),
        // ... app build/test steps ...
      ];

  @override
  List<BuildStep> compileTeardown(BuildContext ctx) => [
        // Consumes `emulator-serial` from the forward run's state.
        StopEmulatorStep(),
      ];
}

The returned steps run after the forward pipeline (success OR failure) under runTeardownSteps — and again on SIGINT/SIGTERM.

Implementation

List<BuildStep> compileTeardown(BuildContext ctx) => const [];