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
dpklauncher for it first onPATH, sodpkin 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_ondependencies 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
nullfor commands that work without one.final -
pubFlags
→ List<
String> -
Global
dart pubflags 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
-Cdirectory 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
scriptruns 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
dartwithargumentsinworkingDirectory, with output going to the user. In project mode, pub uses the project cache unlessuseProjectCacheis false. -
runScript(
Script script, {required HookStack stack, List< String> arguments = const [], RunPlan? plan}) → Future<int> -
Runs
scriptwithout its hooks or dependencies, in the packages ofplan, or of its own config whenplanis null. -
runScriptTarget(
Script script, {List< String> arguments = const [], List<String> filters = const [], int? concurrency, bool? failFast, bool? dependencyOrder}) → Future<int> -
Runs
scriptlikedpk rundoes: itsdepends_onscripts first, then the script between its hooks. -
scriptEnvironment(
Map< String, String> variables) → Map<String, String> -
The environment for a script's processes:
variableswithPATHstarting at thedpklauncher 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
actionfortargetbetween its hooks. Outside a project, runsactionwithout hooks.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited