pub struct VersionOracle {
pub public_release: bool,
pub build_metadata: Vec<String>,
pub extra_prerelease_identifiers: Vec<String>,
pub building_ref: Option<String>,
pub tags: Option<Vec<String>>,
pub version: Version,
pub git_commit_id: Option<String>,
pub git_commit_id_short: Option<String>,
pub version_height: u32,
/* private fields */
}Expand description
The complete set of version values calculated for a project.
Values that depend on public-release state or caller-supplied identifiers are exposed as
methods because public_release, build_metadata,
and extra_prerelease_identifiers remain mutable.
Fields§
§public_release: boolWhether the calculated version is a public release.
build_metadata: Vec<String>Additional build metadata identifiers.
extra_prerelease_identifiers: Vec<String>Additional prerelease identifiers.
building_ref: Option<String>The ref (branch or tag) being built.
Canonical tag refs that point at the selected commit.
version: VersionThe encoded numeric version.
git_commit_id: Option<String>The full selected commit ID, optionally suffixed by -dirty.
git_commit_id_short: Option<String>The abbreviated selected commit ID, optionally suffixed by -dirty.
version_height: u32The calculated version height.
Implementations§
Source§impl VersionOracle
impl VersionOracle
Sourcepub fn new(
context: &GitContext,
cloud_build: Option<&dyn CloudBuild>,
) -> Result<Self>
pub fn new( context: &GitContext, cloud_build: Option<&dyn CloudBuild>, ) -> Result<Self>
Calculates version information from a Git context and optional cloud provider.
Sourcepub fn new_with_height_offset(
context: &GitContext,
cloud_build: Option<&dyn CloudBuild>,
override_version_height_offset: Option<i32>,
) -> Result<Self>
pub fn new_with_height_offset( context: &GitContext, cloud_build: Option<&dyn CloudBuild>, override_version_height_offset: Option<i32>, ) -> Result<Self>
Calculates version information with an explicit version-height offset override.
Sourcepub fn version_options(&self) -> Option<&VersionOptions>
pub fn version_options(&self) -> Option<&VersionOptions>
Gets the options selected by the oracle.
Sourcepub fn committed_version(&self) -> Option<&VersionOptions>
pub fn committed_version(&self) -> Option<&VersionOptions>
Gets the committed options.
Sourcepub fn working_version(&self) -> Option<&VersionOptions>
pub fn working_version(&self) -> Option<&VersionOptions>
Gets the working-copy options.
Sourcepub fn version_file_found(&self) -> bool
pub fn version_file_found(&self) -> bool
Gets whether a version file was found.
Sourcepub fn version_height_offset(&self) -> i32
pub fn version_height_offset(&self) -> i32
Gets the effective height offset.
Sourcepub fn version_height_with_offset(&self) -> i64
pub fn version_height_with_offset(&self) -> i64
Gets the height including its effective offset.
Sourcepub fn assembly_version(&self) -> Version
pub fn assembly_version(&self) -> Version
Gets the assembly version.
Sourcepub const fn assembly_file_version(&self) -> Version
pub const fn assembly_file_version(&self) -> Version
Gets the assembly file version.
Sourcepub fn assembly_informational_version(&self) -> String
pub fn assembly_informational_version(&self) -> String
Gets the assembly informational version.
Sourcepub fn prerelease_version(&self) -> String
pub fn prerelease_version(&self) -> String
Gets the prerelease fragment, including a leading hyphen.
Sourcepub fn prerelease_version_no_leading_hyphen(&self) -> String
pub fn prerelease_version_no_leading_hyphen(&self) -> String
Gets the prerelease fragment without leading hyphens.
Sourcepub fn simple_version(&self) -> Version
pub fn simple_version(&self) -> Version
Gets the numeric version without its revision component.
Sourcepub fn build_number(&self) -> u32
pub fn build_number(&self) -> u32
Gets the third numeric component, treating an unspecified value as zero.
Sourcepub fn version_revision(&self) -> i64
pub fn version_revision(&self) -> i64
Gets the fourth numeric component using -1 when unspecified.
Sourcepub const fn major_minor_version(&self) -> Version
pub const fn major_minor_version(&self) -> Version
Gets the major/minor numeric version.
Sourcepub const fn git_commit_date(&self) -> Option<DateTime<FixedOffset>>
pub const fn git_commit_date(&self) -> Option<DateTime<FixedOffset>>
Gets the selected commit’s committer date.
Gets the selected commit’s author date.
Sourcepub fn build_metadata_with_commit_id(&self) -> Vec<String>
pub fn build_metadata_with_commit_id(&self) -> Vec<String>
Gets build metadata with the selected commit ID first.
Sourcepub fn build_metadata_fragment(&self) -> String
pub fn build_metadata_fragment(&self) -> String
Gets the +-prefixed build metadata fragment used by calculated versions.
Sourcepub fn nuget_package_version(&self) -> String
pub fn nuget_package_version(&self) -> String
Gets the NuGet package version.
Sourcepub fn chocolatey_package_version(&self) -> String
pub fn chocolatey_package_version(&self) -> String
Gets the Chocolatey package version.
Sourcepub fn npm_package_version(&self) -> String
pub fn npm_package_version(&self) -> String
Gets the NPM package version.
Sourcepub fn sem_ver1_numeric_identifier_padding(&self) -> u32
pub fn sem_ver1_numeric_identifier_padding(&self) -> u32
Gets the SemVer 1 numeric-identifier padding.
Sourcepub fn cloud_build_number(&self) -> String
pub fn cloud_build_number(&self) -> String
Gets the cloud build number.
Sourcepub fn cloud_build_number_enabled(&self) -> bool
pub fn cloud_build_number_enabled(&self) -> bool
Gets whether setting the cloud build number is enabled.
Sourcepub fn cloud_build_all_vars_enabled(&self) -> bool
pub fn cloud_build_all_vars_enabled(&self) -> bool
Gets whether all NBGV_ variables should be set.
Sourcepub fn cloud_build_version_vars_enabled(&self) -> bool
pub fn cloud_build_version_vars_enabled(&self) -> bool
Gets whether common version variables should be set.
Sourcepub fn cloud_build_version_vars(&self) -> BTreeMap<String, String>
pub fn cloud_build_version_vars(&self) -> BTreeMap<String, String>
Gets the common cloud-build variables.
Sourcepub fn cloud_build_all_vars(&self) -> BTreeMap<String, String>
pub fn cloud_build_all_vars(&self) -> BTreeMap<String, String>
Gets every cloud-build variable exposed by the managed oracle.