Skip to content

Commit

Permalink
Add Rustdoc for target fields in contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
Malax committed Feb 12, 2024
1 parent 1f9d849 commit dfdd601
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
29 changes: 29 additions & 0 deletions libcnb/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,39 @@ pub struct BuildContext<B: Buildpack + ?Sized> {
pub layers_dir: PathBuf,
pub app_dir: PathBuf,
pub buildpack_dir: PathBuf,
/// The name of the target operating system.
///
/// The value should conform to [Go's `$GOOS`](https://golang.org/doc/install/source#environment), for example
/// `linux` or `windows`.
///
/// CNB `lifecycle` sources this value from the build OCI image's [`os` property](https://github.com/opencontainers/image-spec/blob/main/config.md#properties).
pub target_os: String,
/// The name of the target CPU architecture.
///
/// The value should conform to [Go's $GOARCH](https://golang.org/doc/install/source#environment), for example
/// `amd64` or `arm64`.
///
/// CNB `lifecycle` sources this value from the build OCI image's [`architecture` property](https://github.com/opencontainers/image-spec/blob/main/config.md#properties).
/// ``
pub target_arch: String,
/// The variant of the specified CPU architecture.
///
/// The value should conform to [OCI image spec platform variants](https://github.com/opencontainers/image-spec/blob/main/image-index.md#platform-variants), for example
/// `v7` or `v8`.
///
/// CNB `lifecycle` sources this value from the build OCI image's [`variant` property](https://github.com/opencontainers/image-spec/blob/main/config.md#properties).
pub target_arch_variant: Option<String>,
/// The name of the operating system distribution. Should be empty for windows.
///
/// For example: `ubuntu` or `arch`.
///
/// CNB `lifecycle` sources this value from the build OCI image's `io.buildpacks.distro.name` label.
pub target_distro_name: Option<String>,
/// The version of the operating system distribution.
///
/// For example: `18.02` or `2024.02.01`.
///
/// CNB `lifecycle` sources this value from the build OCI image's `io.buildpacks.distro.version` label.
pub target_distro_version: Option<String>,
pub platform: B::Platform,
pub buildpack_plan: BuildpackPlan,
Expand Down
29 changes: 29 additions & 0 deletions libcnb/src/detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,39 @@ use std::path::PathBuf;
pub struct DetectContext<B: Buildpack + ?Sized> {
pub app_dir: PathBuf,
pub buildpack_dir: PathBuf,
/// The name of the target operating system.
///
/// The value should conform to [Go's `$GOOS`](https://golang.org/doc/install/source#environment), for example
/// `linux` or `windows`.
///
/// CNB `lifecycle` sources this value from the build OCI image's [`os` property](https://github.com/opencontainers/image-spec/blob/main/config.md#properties).
pub target_os: String,
/// The name of the target CPU architecture.
///
/// The value should conform to [Go's $GOARCH](https://golang.org/doc/install/source#environment), for example
/// `amd64` or `arm64`.
///
/// CNB `lifecycle` sources this value from the build OCI image's [`architecture` property](https://github.com/opencontainers/image-spec/blob/main/config.md#properties).
/// ``
pub target_arch: String,
/// The variant of the specified CPU architecture.
///
/// The value should conform to [OCI image spec platform variants](https://github.com/opencontainers/image-spec/blob/main/image-index.md#platform-variants), for example
/// `v7` or `v8`.
///
/// CNB `lifecycle` sources this value from the build OCI image's [`variant` property](https://github.com/opencontainers/image-spec/blob/main/config.md#properties).
pub target_arch_variant: Option<String>,
/// The name of the operating system distribution. Should be empty for windows.
///
/// For example: `ubuntu` or `arch`.
///
/// CNB `lifecycle` sources this value from the build OCI image's `io.buildpacks.distro.name` label.
pub target_distro_name: Option<String>,
/// The version of the operating system distribution.
///
/// For example: `18.02` or `2024.02.01`.
///
/// CNB `lifecycle` sources this value from the build OCI image's `io.buildpacks.distro.version` label.
pub target_distro_version: Option<String>,
pub platform: B::Platform,
pub buildpack_descriptor: ComponentBuildpackDescriptor<B::Metadata>,
Expand Down

0 comments on commit dfdd601

Please sign in to comment.