// Copyright 2021 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto3";

package chromiumos.build.api;

option go_package = "go.chromium.org/chromiumos/config/go/build/api";

import "chromiumos/build/api/portage.proto";

// Defines config used to generate Chrome OS system image builds.
message SystemImage {
  ImageId id = 1;              // universally unique ID representing the build
  BuildMetadata metadata = 2;  // metadata about the system image

  message ImageId {
    string value = 1;
  }

  // Defines build target config required to generate a Chrome OS system image.
  // See:
  // https://chromium.googlesource.com/chromiumos/docs/+/HEAD/developer_guide.md#Build-a-disk-image-for-your-board
  message BuildTarget {
    Portage.BuildTarget portage_build_target = 1;
  }

  message BuildMetadata {
    // Information passed to portage as part of the build.
    BuildTarget build_target = 1;
    PackageSummary package_summary = 2;
    repeated Portage.Package packages = 3;

    // Provides a summary of common key packages used in the build.
    message PackageSummary {
      Arc arc = 1;
      AshChrome chrome = 2;
      Chipset chipset = 3;
      Kernel kernel = 4;
      Toolchain toolchain = 5;
    }

    // package-specific meta data for VIPs (very important packages).  Wrapped
    // in their own message to let us extend them in the future.

    message Arc {
      string version = 1;
      string branch = 2;
    }

    message AshChrome {
      string version = 1;
    }

    message Chipset {
      // Name of the chipset overlay used (e.g. src/overlays/chipset-[VALUE]
      // Chipsets are SoC family based, so this allows overlays and kernels
      // to be correlated on a per-soc-family basis.
      string overlay = 1;
    }

    message Kernel {
      string version = 1;
    }

    message Toolchain {
      string version = 1;
    }
  }

  // Used to serialize build metadata reports to proto[json|text|binary]
  message BuildMetadataList {
    repeated BuildMetadata values = 1;
  }
}
