outputDirectory property
Uri
get
outputDirectory
The directory in which output and intermediate artifacts that are unique to the config can be placed.
This directory is unique per hook and per config. The directory is nested inside outputDirectoryShared and has a short checksum to avoid running out of path length on Winddows.
Prefer using a sub directory in outputDirectoryShared with a checksum of the fields on the config that influence your build. Reusing a precise subdirectory only dependent on what influences your build avoids cache misses for configs that differ in fields irrelevant for your build.
The contents of this directory will not be modified by anything else than the hook itself.
The invoker of the the hook will ensure concurrent invocations wait on each other.
Implementation
Uri get outputDirectory {
if (_cachedOutputDirectory != null) {
return _cachedOutputDirectory!.uri;
}
final checksum = config.computeChecksum();
final directory = Directory.fromUri(
outputDirectoryShared.resolve('$checksum/'),
);
if (!directory.existsSync()) {
directory.createSync(recursive: true);
}
_cachedOutputDirectory = directory;
return directory.uri;
}