DpkContext class final

Everything a command needs: the parsed invocation, the loaded project, output, and process running.

Constructors

DpkContext({required Invocation invocation, required Console console, required ProcessRunner processRunner, required String workingDirectory, required Map<String, String> environment, Project? project, List<String>? dpkCommand})

Properties

console → Console
final
dpkCommand → List<String>?
The command line that starts this dpk. When set, scripts get a dpk launcher for it first on PATH, so dpk in a script is this dpk.
final
environment → Map<String, String>
The environment dpk was started with.
final
hashCode → int
The hash code for this object.
no setterinherited
hookStack → HookStack
Hooks and depends_on dependencies that already ran in this tree of dpk processes. Nested dpk processes inherit it.
no setter
invocation → Invocation
final
processRunner → ProcessRunner
final
project → Project?
The project, or null for commands that work without one.
final
pubFlags → List<String>
Global dart pub flags that follow from dpk's own options.
no setter
requireProject → Project
The project. Only call this from commands that need one; dpk loads the project before running them.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
targetDirectory → String
The directory a command acts on: the current package in a project, otherwise the -C directory or the working directory.
no setter
workingDirectory → String
The directory dpk was started in.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
planFor(Script script, {List<String> filters = const [], int? concurrency, bool? failFast, bool? dependencyOrder}) → RunPlan
The packages script runs in, from its config and the run options.
runDart(List<String> arguments, {String? workingDirectory, bool useProjectCache = true, Map<String, String> environment = const {}}) → Future<int>
Runs dart with arguments in workingDirectory, with output going to the user. In project mode, pub uses the project cache unless useProjectCache is false.
runScript(Script script, {required HookStack stack, List<String> arguments = const [], RunPlan? plan}) → Future<int>
Runs script without its hooks or dependencies, in the packages of plan, or of its own config when plan is null.
runScriptTarget(Script script, {List<String> arguments = const [], List<String> filters = const [], int? concurrency, bool? failFast, bool? dependencyOrder}) → Future<int>
Runs script like dpk run does: its depends_on scripts first, then the script between its hooks.
scriptEnvironment(Map<String, String> variables) → Map<String, String>
The environment for a script's processes: variables with PATH starting at the dpk launcher when dpkCommand is set.
toString() → String
A string representation of this object.
inherited
withHooks(String target, Future<int> action(HookStack stack), {String? hooksFrom, HookOrder order = HookOrder.standard}) → Future<int>
Runs action for target between its hooks. Outside a project, runs action without hooks.

Operators

operator ==(Object other) → bool
The equality operator.
inherited