buildDslResourcesPayloadJson function

Map<String, dynamic> buildDslResourcesPayloadJson(
  1. FFProject project, {
  2. String? libraryName,
  3. String? libraryComponentName,
  4. String? matchQuery,
  5. Map<String, FFProject> libraryProjects = const {},
})

Dispatches to one of the resource payload builders used by the CLI and MCP.

Implementation

Map<String, dynamic> buildDslResourcesPayloadJson(
  FFProject project, {
  String? libraryName,
  String? libraryComponentName,
  String? matchQuery,
  Map<String, FFProject> libraryProjects = const {},
}) {
  if (libraryComponentName != null && matchQuery != null) {
    throw ArgumentError(
      '--library-component and --match are mutually exclusive.',
    );
  }
  return libraryComponentName != null
      ? buildDslLibraryComponentResolutionJson(
        project,
        componentName: libraryComponentName,
        libraryName: libraryName,
        libraryProjects: libraryProjects,
      )
      : matchQuery != null
      ? buildDslClosestResourceMatchJson(
        project,
        query: matchQuery,
        libraryProjects: libraryProjects,
      )
      : buildDslResourceInventoryJson(
        project,
        libraryProjects: libraryProjects,
      );
}