collectShaderBundleDependencies function

List<Uri> collectShaderBundleDependencies(
  1. Uri manifestUri,
  2. Object decodedManifest, {
  3. required Uri packageRoot,
})

Collects the build-system dependencies declared by a shader bundle manifest.

Returns the manifest URI itself plus the resolved URI of every shader source file referenced by a top-level entry's file key. Entry file paths are interpreted relative to packageRoot, matching how impellerc resolves them (it runs with the package root as its working directory). Resolving them against the manifest's directory instead would produce paths that do not exist when the manifest lives in a subdirectory.

Exposed so users authoring custom build hooks (and tests) can inspect the same dependency set buildShaderBundleJson declares.

Implementation

List<Uri> collectShaderBundleDependencies(
  Uri manifestUri,
  Object decodedManifest, {
  required Uri packageRoot,
}) {
  final result = <Uri>[manifestUri];
  if (decodedManifest is! Map) {
    return result;
  }
  for (final value in decodedManifest.values) {
    if (value is! Map) continue;
    final file = value['file'];
    if (file is! String) continue;
    result.add(packageRoot.resolve(file));
  }
  return result;
}