fingerprint method

  1. @override
Future<NativeStepFingerprint> fingerprint(
  1. NativeStepContext context
)
override

Compute a fingerprint for this step based on its inputs.

Used for build caching to determine if a step needs to be re-executed.

Implementation

@override
Future<NativeStepFingerprint> fingerprint(NativeStepContext context) async {
  final buffer = StringBuffer();
  buffer.write(id);
  buffer.write(
    expandRecipeValue(sourceDirectory, context.buildContext, context.source),
  );
  buffer.write(
    buildDirectory == null
        ? null
        : expandRecipeValue(
            buildDirectory!,
            context.buildContext,
            context.source,
          ),
  );
  buffer.write(
    defines.map(
      (key, value) => MapEntry(
        key,
        expandRecipeValue(value, context.buildContext, context.source),
      ),
    ),
  );
  buffer.write(generator);
  buffer.write(
    toolchainFile == null
        ? null
        : expandRecipeValue(
            toolchainFile!,
            context.buildContext,
            context.source,
          ),
  );

  // Include source file hashes for invalidation
  buffer.write(_sourceFilesHash(context.source.directory));

  return NativeStepFingerprint(
    id: id,
    hash: fingerprintHash(buffer.toString()),
  );
}