pub struct VersionOptions {Show 17 fields
pub schema: Option<String>,
pub version: Option<SemanticVersion>,
pub assembly_version: Option<AssemblyVersionOptions>,
pub git_commit_id_prefix: Option<String>,
pub version_height_offset: Option<i32>,
pub version_height_offset_applies_to: Option<SemanticVersion>,
pub sem_ver1_numeric_identifier_padding: Option<u32>,
pub git_commit_id_short_fixed_length: Option<u32>,
pub git_commit_id_short_auto_minimum: Option<u32>,
pub git_commit_id_include_dirty: Option<bool>,
pub nuget_package_version: Option<NuGetPackageVersionOptions>,
pub public_release_ref_spec: Option<Vec<String>>,
pub cloud_build: Option<CloudBuildOptions>,
pub release: Option<ReleaseOptions>,
pub path_filters: Option<Vec<FilterPath>>,
pub inherit: bool,
pub prerelease: Option<String>,
}Expand description
Describes the versions and policies used by a build.
Optional fields deliberately retain the distinction between an omitted value and an
explicitly configured default. This is required when an inheriting version.json is merged
over an ancestor’s options.
Fields§
§schema: Option<String>The schema URI written to a version.json file.
version: Option<SemanticVersion>The version used as the basis for version calculations.
assembly_version: Option<AssemblyVersionOptions>The version used for an assembly version instead of version.
git_commit_id_prefix: Option<String>The prefix for Git commit IDs in non-public versions.
version_height_offset: Option<i32>A number added to Git height when calculating version height.
buildNumberOffset, used by older files, is accepted as an alias.
version_height_offset_applies_to: Option<SemanticVersion>The version to which versionHeightOffset applies.
sem_ver1_numeric_identifier_padding: Option<u32>The minimum number of digits used for numeric SemVer 1 identifiers.
git_commit_id_short_fixed_length: Option<u32>The fixed number of characters used for abbreviated Git commit IDs.
git_commit_id_short_auto_minimum: Option<u32>The minimum length used when Git chooses an unambiguous abbreviated commit ID.
git_commit_id_include_dirty: Option<bool>Whether dirty Git commit IDs are suffixed with -dirty.
nuget_package_version: Option<NuGetPackageVersionOptions>Options controlling generated NuGet package versions.
public_release_ref_spec: Option<Vec<String>>Regular expressions for refs that should default to public releases.
cloud_build: Option<CloudBuildOptions>Options applicable specifically to cloud builds.
release: Option<ReleaseOptions>Settings for release preparation and tagging.
path_filters: Option<Vec<FilterPath>>Pathspec-like filters used when calculating version height.
inherit: boolWhether unset values should be inherited from an ancestor version.json.
prerelease: Option<String>A prerelease tag to apply to an inherited version.
An empty string explicitly suppresses an inherited prerelease tag, while None leaves it
unchanged.
Implementations§
Source§impl VersionOptions
impl VersionOptions
Sourcepub const DEFAULT_VERSION_PRECISION: VersionPrecision = DEFAULT_VERSION_PRECISION
pub const DEFAULT_VERSION_PRECISION: VersionPrecision = DEFAULT_VERSION_PRECISION
The default last component controlled in an assembly version.
Sourcepub const VERSION_HEIGHT_PLACEHOLDER: &'static str = VERSION_HEIGHT_PLACEHOLDER
pub const VERSION_HEIGHT_PLACEHOLDER: &'static str = VERSION_HEIGHT_PLACEHOLDER
The placeholder that identifies where version height appears in a semantic version.
Sourcepub const DEFAULT_GIT_COMMIT_ID_SHORT_FIXED_LENGTH: u32 = DEFAULT_GIT_COMMIT_ID_SHORT_FIXED_LENGTH
pub const DEFAULT_GIT_COMMIT_ID_SHORT_FIXED_LENGTH: u32 = DEFAULT_GIT_COMMIT_ID_SHORT_FIXED_LENGTH
The default fixed length of an abbreviated Git commit ID.
Sourcepub fn from_version(
version: Version,
prerelease: Option<&str>,
) -> CrateResult<Self>
pub fn from_version( version: Version, prerelease: Option<&str>, ) -> CrateResult<Self>
Creates options with the specified version and optional prerelease tag.
The prerelease tag follows SemanticVersion conventions and includes its leading -.
Sourcepub fn from_json(
json: &str,
repo_relative_base_directory: &str,
) -> CrateResult<Self>
pub fn from_json( json: &str, repo_relative_base_directory: &str, ) -> CrateResult<Self>
Deserializes options while resolving relative path filters against a repository directory.
Use this instead of plain serde_json::from_str when the version.json file is below the
repository root.
Sourcepub fn to_json(&self, repo_relative_base_directory: &str) -> CrateResult<String>
pub fn to_json(&self, repo_relative_base_directory: &str) -> CrateResult<String>
Serializes options with path filters relative to a repository directory.
Sourcepub const fn schema_url() -> &'static str
pub const fn schema_url() -> &'static str
Returns the schema URI used by Nerdbank.GitVersioning.
Sourcepub fn assembly_version_or_default(&self) -> AssemblyVersionOptions
pub fn assembly_version_or_default(&self) -> AssemblyVersionOptions
Returns the configured assembly-version options or their defaults.
Sourcepub fn version_height_offset_or_default(&self) -> i32
pub fn version_height_offset_or_default(&self) -> i32
Returns the configured version-height offset, defaulting to zero.
Sourcepub fn effective_version_height_offset(&self) -> i32
pub fn effective_version_height_offset(&self) -> i32
Returns the effective version-height offset.
The configured offset becomes ineffective when the version has changed in a component
that resets height relative to versionHeightOffsetAppliesTo.
Sourcepub fn version_height_position(&self) -> Option<VersionPosition>
pub fn version_height_position(&self) -> Option<VersionPosition>
Returns the position in a computed version where version height should appear.
Sourcepub fn git_commit_id_position(&self) -> Option<VersionPosition>
pub fn git_commit_id_position(&self) -> Option<VersionPosition>
Returns where commit-ID bits should appear in the numeric version, if anywhere.
Sourcepub fn sem_ver1_numeric_identifier_padding_or_default(&self) -> u32
pub fn sem_ver1_numeric_identifier_padding_or_default(&self) -> u32
Returns the minimum SemVer 1 numeric identifier width.
Sourcepub fn git_commit_id_short_fixed_length_or_default(&self) -> u32
pub fn git_commit_id_short_fixed_length_or_default(&self) -> u32
Returns the fixed abbreviated Git commit ID length.
Sourcepub fn git_commit_id_short_auto_minimum_or_default(&self) -> u32
pub fn git_commit_id_short_auto_minimum_or_default(&self) -> u32
Returns the automatic abbreviated Git commit ID minimum, defaulting to zero.
Sourcepub fn git_commit_id_include_dirty_or_default(&self) -> bool
pub fn git_commit_id_include_dirty_or_default(&self) -> bool
Returns whether dirty Git commit IDs are marked, defaulting to false.
Sourcepub fn nuget_package_version_or_default(&self) -> NuGetPackageVersionOptions
pub fn nuget_package_version_or_default(&self) -> NuGetPackageVersionOptions
Returns the configured NuGet package options or their defaults.
Sourcepub fn cloud_build_or_default(&self) -> CloudBuildOptions
pub fn cloud_build_or_default(&self) -> CloudBuildOptions
Returns the configured cloud-build options or their defaults.
Sourcepub fn release_or_default(&self) -> ReleaseOptions
pub fn release_or_default(&self) -> ReleaseOptions
Returns the configured release options or their defaults.
Sourcepub fn public_release_ref_spec_or_default(&self) -> &[String]
pub fn public_release_ref_spec_or_default(&self) -> &[String]
Returns the public-release ref specifications, or an empty slice when none were configured.
Sourcepub fn merge_from(&mut self, overlay: &Self)
pub fn merge_from(&mut self, overlay: &Self)
Overlays explicitly configured values from an inheriting file onto these options.
This is the serde equivalent of populating an existing options object in the .NET implementation. An absent optional value leaves the inherited value unchanged.
Sourcepub fn merge_inheriting(&mut self, overlay: &Self) -> CrateResult<()>
pub fn merge_inheriting(&mut self, overlay: &Self) -> CrateResult<()>
Merges an inheriting file and converts the result into complete options.
In addition to overlaying explicitly configured values, this applies the inheriting file’s
standalone prerelease property and clears inherit.
Sourcepub fn apply_prerelease(&mut self) -> CrateResult<()>
pub fn apply_prerelease(&mut self) -> CrateResult<()>
Applies the standalone prerelease property to the semantic version.