computeCacheKey function

String computeCacheKey(
  1. NativeProject project,
  2. NativeTarget target
)

Compute a project-scoped cache key for a target.

Uses SHA-256 over the resolved project definition and target identity so distinct projects/configurations do not share a cache directory.

Implementation

String computeCacheKey(NativeProject project, NativeTarget target) {
  final buffer = StringBuffer()
    ..write(project.toJson())
    ..write('|')
    ..write(target.label);
  return sha256
      .convert(buffer.toString().codeUnits)
      .toString()
      .substring(0, 16);
}