github.com/paketo-buildpacks/packit@v1.3.2-0.20211206231111-86b75c657449/build_metadata.go (about)

     1  package packit
     2  
     3  // BuildMetadata represents the build metadata details persisted in the
     4  // build.toml file according to the buildpack lifecycle specification:
     5  // https://github.com/buildpacks/spec/blob/main/buildpack.md#buildtoml-toml.
     6  type BuildMetadata struct {
     7  	// BOM is the Bill-of-Material entries containing information about the
     8  	// dependencies provided to the build environment.
     9  	BOM []BOMEntry `toml:"bom"`
    10  
    11  	// SBOM is a type that implements SBOMFormatter and declares the formats that
    12  	// bill-of-materials should be output for the build SBoM.
    13  	SBOM SBOMFormatter `toml:"-"`
    14  
    15  	// Unmet is a list of unmet entries from the build process that it was unable
    16  	// to provide.
    17  	Unmet []UnmetEntry `toml:"unmet"`
    18  }
    19  
    20  func (b BuildMetadata) isEmpty() bool {
    21  	var sbom []SBOMFormat
    22  	if b.SBOM != nil {
    23  		sbom = b.SBOM.Formats()
    24  	}
    25  
    26  	return len(sbom)+len(b.BOM)+len(b.Unmet) == 0
    27  }