BuildInformation

Description

[ShutdownSurvive]
abstract class Tinman.Core.BuildInformation

Abstract base for classes that represent build information of a module.

Public / Constructors

For


public static method For → (3)

moduleName in : string

[not-empty]
See ModuleName.

version in : Vec2I

See Version.

buildDate in : Vec3I

See BuildDate.

returns → BuildInformation

The BuildInformation instance.

Creates a new instance of BuildInformation.

Load


public static method Load → (1)

path in : Path

[not-null]
Path to a module descriptor text file, in CharacterEncoding.UTF_8 encoding.

returns → BuildInformation

The loaded BuildInformation.

Load the given module descriptor file.

A module descriptor file is a text file in CharacterEncoding.UTF_8 encoding which conforms to the following Grammar:

descriptor    := module-name lb version-major lb version-minor lb build-date ;

build-date    := digit[4] '/' digit[2] '/' digit[2] ;
lb            := '\r' '\n'? | '\n' ;
module-name   := name ;
version-major := number ;
version-minor := number ;

name          := ]\n\r[+ ;
number        := digit+ ;

The following is an example for a module named MyModule with the version0.9:

MyModule
0
9
2024/01/13
IOException

If an I/O error has occurred.

ValidatingException

If the file content is malformed.

Public / Methods

Generate


public static method Generate → (5)

directory in : Path

[not-null]
The base directory of the code module.

major in : int32

The major version number or negative to keep the current one.

minor in : int32

The minor version number or negative to keep the current one.

date in : Vec3I

The build date or Vec3I.Zero to keep the current one:
Vec3I.X : year
Vec3I.Y : month
Vec3I.Z : day
If any of the date values is negative, the current date is used.

header in : string

Optional file header to use, which may contain the following placeholders (see Label):
{0} : file name

returns → BuildInformation

The generated build information.

Updates the BuildInformation implementation class of a code module and optionally the module descriptor file as well.

The given directory in is expected to contain a module descriptor file named BuildInformation.txt (see Load). The BuildInformation implementation class will be written to the file named BuildInformation_Module_Name.cs. If present, the Properties/AssemblyInfo.cs file will be updated via UpdateAssemblyInfo.

IOException

If an I/O error has occurred.

ValidatingException

If the module descriptor file is malformed.

Save


public method Save → (1)

path in : Path

[not-null]
Path to the module descriptor file.

Saves a module descriptor file.

IOException

If an I/O error has occurred.

To​String

2 overloads


public method ToString1 → (3)

includeModuleName in : bool

Include ModuleName?

includeVersion opt : bool = true

Include VersionMajor and VersionMinor?

includeBuildDate opt : bool = true

Include BuildDateString?

returns → string

human-readable string representation.

Returns a human-readable string representation of this build information.

Update


[Pure]
public method Update → (3)

major in : int32

The major version number or negative to keep the current one.

minor in : int32

The minor version number or negative to keep the current one.

date ref : Vec3I

The build date or Vec3I.Zero to keep the current one:
Vec3I.X : year
Vec3I.Y : month
Vec3I.Z : day
If any of the date values is negative, the current date is used. Before returning, this method updates this build date, according to BuildDateString of the updated build information.

returns → BuildInformation

The updated build information.

Updates the values of this BuildInformation object.

Update​Assembly​Info


public method UpdateAssemblyInfo → (3)

file in : Path

[not-null]
Path to the file.

encoding opt : CharacterEncoding = null

The encoding to use if file in does not have a BOM. If null, CharacterEncoding.UTF_8 is used.

lineEnding opt : LineEnding = LineEnding.CRLF

The line ending to use for writing the file.

Updates the given AssemblyInfo.cs file.

The AssemblyTitleAttribute and AssemblyVersionAttribute entries in the file will be updated and the AssemblyFileVersionAttribute will be removed.

IOException

If an I/O error has occurred.

Public / Attributes

Build​Date


public abstract attribute BuildDate → (get)

value : Vec3I

The build date:
Vec3I.X : year in the range [0..9999]
Vec3I.Y : month in the range [1..12]
Vec3I.Z : day in the range [1..31]

The date of the build.

Build​Date​Day


public attribute BuildDateDay → (get)

value : int32

[1..31]
The day number.

Returns the day of the build date.

Build​Date​Month


public attribute BuildDateMonth → (get)

value : int32

[1..12]
The month number.

Returns the month of the build date.

Build​Date​String


public attribute BuildDateString → (get)

value : string

[not-empty]
The build date string.

The date of the build.

The string value stores the build date in the following format:
"YYYY/MM/DD".

Build​Date​Year


public attribute BuildDateYear → (get)

value : int32

[0..9999]
The year number.

Returns the year of the build date.

Module​Name


public abstract attribute ModuleName → (get)

value : string

[not-empty]
The build module name string.

Machine-readable and human-understandable name of the code module this build information is referring to.

Version


public virtual attribute Version → (get)

value : Vec2I

The version number:
Vec2I.X : VersionMajor
Vec2I.Y : VersionMinor

The version number of the build.

Version​Major


public attribute VersionMajor → (get)

value : int32

[>=0]
The major version number.

The major version number of the build.

Each time the major version number is increased, the minor version number is reset to 0. Breaking changes and thus code migration can become necessary between major versions.

Version​Minor


public attribute VersionMinor → (get)

value : int32

[>=0]
The bugfix number of the build version.

The minor version number of the build.

The minor version number is incremented after applying improvements, bugfixes and patches which do not affect API compatibility, thus breaking changes will not occur and code migration is not necessary.

Version​String


public attribute VersionString → (get)

value : string

[not-empty]
The version number string.

The version number of the build in the form: major.minor.

Version​With​Date


public attribute VersionWithDate → (get)

value : string

[not-empty]
The version number string.

The version number of the build in the form: major.minor.year.{month*100+day}.