Skip to content

Commit

Permalink
Updating content readme.txt for issue #152
Browse files Browse the repository at this point in the history
  • Loading branch information
Jehoel authored and kzu committed May 9, 2021
1 parent 4613184 commit 84702e0
Showing 1 changed file with 73 additions and 49 deletions.
122 changes: 73 additions & 49 deletions src/GitInfo/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,58 +65,82 @@ The available constants from code are:

Available MSBuild customizations:

$(GitThisAssembly): set to 'false' to prevent assembly
metadata and constants generation.

$(GitThisAssemblyMetadata): set to 'false' to prevent assembly
metadata generation only. Defaults
to 'false'.

$(ThisAssemblyNamespace): allows overriding the namespace
for the ThisAssembly class.
Defaults to the global namespace.

$(GitRemote): name of remote to get repository url for.
Defaults to 'origin'.

$(GitDefaultBranch): determines the base branch used to
calculate commits on top of current branch.
Defaults to 'master'.

$(GitVersionFile): determines the name of a file in the Git
repository root used to provide the base
version info.
Defaults to 'GitInfo.txt'.

$(GitInfoReportImportance): allows rendering all the retrieved
git information with the specified
message importance ('high',
'normal' or 'low').
Defaults to 'low'.

$(GitIgnoreBranchVersion) and $(GitIgnoreTagVersion): determines
whether the branch and tags (if any)
will be used to find a base version.
Defaults to empty value (no ignoring).
$(GitThisAssembly):
* Enables or Disables `class ThisAssembly` for this project's output assembly.
* e.g. `<GitThisAssembly>true</GitThisAssembly>`
* Set to 'true' to generate class ThisAssembly containing const strings.
* Set to 'false' to not generate anything for this project.
* Defaults to 'false' (i.e. GitInfo is opt-in).

$(GitThisAssemblyMetadata):
* Enables or Disables `[assembly: AssemblyMetadata("GitInfo...")]` for this project's output assembly.
* Set to 'true' to generate `[assembly: AssemblyMetadata("GitInfo...")]` assembly attributes at compile-time.
* Set to 'false' to not generate any `[assembly: AssemblyMetadata("GitInfo...")]` assembly attributes - instead only `class ThisAssembly` will be generated.
* Defaults to 'false' (i.e. `[assembly: AssemblyMetadata("GitInfo...")]` assembly attributes are not generated by default, even when $(GitThisAssembly) is enabled).
* Note that the $(GitThisAssembly) property must also be set to 'true' for this property to take effect.
* For example, copy this snippet into your csproj:
```
<PropertyGroup Label="GitInfo Properties">
<GitThisAssembly>true</GitThisAssembly>
<GitThisAssemblyMetadata>true</GitThisAssemblyMetadata>
</PropertyGroup>
```

$(ThisAssemblyNamespace):
* Overrides the C# namespace that the generated `class ThisAssembly` exists in.
* By default the C# project's default namespace is used. This is in the C# MSBuild `<RootNamespace></RootNamespace>` property, which in-turn defaults to the project's name as displayed in Solution Explorer.

$(GitRemote):
* Specifies the name of the Git Remote to get the repository URL for, the repository URL is then exposed via the `ThisAssembly.Git.RepositoryUrl` string or the `AssemblyMetadata("GitInfo.RepositoryUrl)` attribute.
* You can get a list of your remotes by running `git remote -v` in your shell when inside your git repo.
* Defaults to 'origin'.


$(GitSkipCache): whether to cache the Git information determined
$(GitDefaultBranch):
* Specifies the base branch which is compared to your current branch (at time of build) to determine how many commits ahead the current branch is compared to base.
* Defaults to 'master'.

$(GitVersionFile):
* Specifies the name of a file in the Git repository root used to provide the base version info.
* Defaults to 'GitInfo.txt'.

$(GitInfoReportImportance):
* Specifies the minimum message importance of messages from `git info` in order to be included in the rendered messages when your project builds.
* Possible values are 'high', 'normal', and 'low'.
* Using a value of 'high' will mean only high-importance messages will be rendered.
* Using a value of 'normal' will mean high and medium -importance messages will be rendered, but not low-importance messages.
* Using a value of 'low' will cause all messages to be rendered.
* Defaults to 'low'.

$(GitIgnoreBranchVersion):
$(GitIgnoreTagVersion):
* Specifies whether the current branch and tags, respectively, will be used to find a base version.
* Defaults to '' (an empty value) which means no branches or tags will be ignored.

$(GitSkipCache):
* Specifies that GitInfo should always ignore Git information determined in a previous build.
* Cache information is stored in a file named 'GitInfo.cache'. This improves build time performance.
* This file will be saved to your intermediate build output directory (`<IntermediateOutputPath>`), by default this is `\obj\(config)\(platform)\`.
* For example `MyProjectFolder\obj\net48\GitInfo.cache`
* By defalt this is
in a previous build in a GitInfo.cache for
performance reasons.
Defaults to empty value (no ignoring).

$(GitNameRevOptions): Options passed to git name-rev when finding
a branch name for the current commit (Detached head). The default is
'--refs=refs/heads/* --no-undefined --alwas'
meaning branch names only, falling back to commit hash.
For legacy behavior where $(GitBranch) for detached head
can also be a tag name, use '--refs=refs/*'.
Refs can be included and excluded, see git name-rev docs.

$(GitTagRegex): Regular expression used with git describe to filter the tags
to consider for base version lookup.
Defaults to * (all)
$(GitNameRevOptions):
* Specifies the command-line options passed to `git name-rev` when determining the current branch name for the current commit (Detached head).
* The default is '--refs=refs/heads/* --no-undefined --alwas'
* This default means that only branch names will be used, otherwise it will fallback to using the current commit's hash.
* For legacy behavior where $(GitBranch) for detached head can also be a tag name, use '--refs=refs/*'. Refs can be included and excluded, see git name-rev docs.

$(GitTagRegex):
* Regular expression (.NET Regex syntax) used with git describe to filter the tags to consider for base version lookup.
* Defaults to '*' (i.e. match all tag names)

$(GitBaseVersionRegex): Regular expression used to match and validate valid base versions
in branch, tag or file sources. By default, matches any string that
*ends* in a valid SemVer2 string.
Defaults to 'v?(?<MAJOR>\d+)\.(?<MINOR>\d+)\.(?<PATCH>\d+)(?:\-(?<LABEL>[\dA-Za-z\-\.]+))?$|^(?<LABEL>[\dA-Za-z\-\.]+)\-v?(?<MAJOR>\d+)\.(?<MINOR>\d+)\.(?<PATCH>\d+)$'
$(GitBaseVersionRegex):
* Regular expression used to match and validate valid base versions in branch, tag or file sources.
* Defaults to a regular-expression (see below) which matches any string that *ends* in a valid SemVer2 string.
* ```
v?(?<MAJOR>\d+)\.(?<MINOR>\d+)\.(?<PATCH>\d+)(?:\-(?<LABEL>[\dA-Za-z\-\.]+))?$|^(?<LABEL>[\dA-Za-z\-\.]+)\-v?(?<MAJOR>\d+)\.(?<MINOR>\d+)\.(?<PATCH>\d+)$
---
* For example, the above regex will match and parse a version string like "foobar-v1.2.3-baz" or "baz-v1.2.3".

0 comments on commit 84702e0

Please sign in to comment.