Skip to main content

VersionOptions

Struct VersionOptions 

Source
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: bool

Whether 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

Source

pub const DEFAULT_VERSION_PRECISION: VersionPrecision = DEFAULT_VERSION_PRECISION

The default last component controlled in an assembly version.

Source

pub const VERSION_HEIGHT_PLACEHOLDER: &'static str = VERSION_HEIGHT_PLACEHOLDER

The placeholder that identifies where version height appears in a semantic version.

Source

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.

Source

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 -.

Source

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.

Source

pub fn to_json(&self, repo_relative_base_directory: &str) -> CrateResult<String>

Serializes options with path filters relative to a repository directory.

Source

pub const fn schema_url() -> &'static str

Returns the schema URI used by Nerdbank.GitVersioning.

Source

pub fn assembly_version_or_default(&self) -> AssemblyVersionOptions

Returns the configured assembly-version options or their defaults.

Source

pub fn version_height_offset_or_default(&self) -> i32

Returns the configured version-height offset, defaulting to zero.

Source

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.

Source

pub fn version_height_position(&self) -> Option<VersionPosition>

Returns the position in a computed version where version height should appear.

Source

pub fn git_commit_id_position(&self) -> Option<VersionPosition>

Returns where commit-ID bits should appear in the numeric version, if anywhere.

Source

pub fn sem_ver1_numeric_identifier_padding_or_default(&self) -> u32

Returns the minimum SemVer 1 numeric identifier width.

Source

pub fn git_commit_id_short_fixed_length_or_default(&self) -> u32

Returns the fixed abbreviated Git commit ID length.

Source

pub fn git_commit_id_short_auto_minimum_or_default(&self) -> u32

Returns the automatic abbreviated Git commit ID minimum, defaulting to zero.

Source

pub fn git_commit_id_include_dirty_or_default(&self) -> bool

Returns whether dirty Git commit IDs are marked, defaulting to false.

Source

pub fn nuget_package_version_or_default(&self) -> NuGetPackageVersionOptions

Returns the configured NuGet package options or their defaults.

Source

pub fn cloud_build_or_default(&self) -> CloudBuildOptions

Returns the configured cloud-build options or their defaults.

Source

pub fn release_or_default(&self) -> ReleaseOptions

Returns the configured release options or their defaults.

Source

pub fn public_release_ref_spec_or_default(&self) -> &[String]

Returns the public-release ref specifications, or an empty slice when none were configured.

Source

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.

Source

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.

Source

pub fn apply_prerelease(&mut self) -> CrateResult<()>

Applies the standalone prerelease property to the semantic version.

Trait Implementations§

Source§

impl Clone for VersionOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VersionOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for VersionOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for VersionOptions

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for VersionOptions

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for VersionOptions

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.