followBuildLog static method

Future<Stream<AppBuildStepLog>> followBuildLog(
  1. Client cloudApiClient, {
  2. required String projectId,
  3. required UuidValue uploadId,
  4. required AppPlatform platform,
})

Returns the log of each step of the platform build made from the archive upload uploadId in project projectId, in run order, as each step ends. Once the build has ended, the steps that have not ended follow, and the stream closes.

Throws FailureException if the upload has no platform build in the project, or if the build cannot be fetched. The stream emits a FailureException if the build or a step log cannot be fetched, and last if the build did not succeed.

Implementation

static Future<Stream<AppBuildStepLog>> followBuildLog(
  Client cloudApiClient, {
  required String projectId,
  required UuidValue uploadId,
  required AppPlatform platform,
}) async {
  final builds = await getUploadBuilds(
    cloudApiClient,
    projectId: projectId,
    uploadId: uploadId,
  );
  final build = builds
      .where((build) => build.platform == platform)
      .firstOrNull;
  if (build == null) {
    throw FailureException(
      error:
          'The upload $uploadId has no '
          '${AppBuildStatusFormatter.platformName(platform)} build.',
    );
  }

  return _stepLogs(
    cloudApiClient,
    projectId: projectId,
    buildId: build.id,
    platform: platform,
  );
}