Skip to content

Commit

Permalink
Include change warning bit to support BuildVersion widget bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
tmatijevich committed May 4, 2022
1 parent 9d7c788 commit d399794
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions BuildVersion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,11 @@ $Sha1 = TruncateString $Sha1 80
#####################

$UncommittedChanges = git -C $args[0] diff --shortstat 2> $Null
if($UncommittedChanges.Length -eq 0) {$UncommittedChanges = "None"}
$ChangeWarning = 1
if($UncommittedChanges.Length -eq 0) {
$UncommittedChanges = "None"
$ChangeWarning = 0
}
elseif($OptionErrorOnUncommittedChanges) {
Write-Warning "BuildVersion: Uncommitted changes detected. Please commit"
exit 1
Expand Down Expand Up @@ -288,7 +292,7 @@ $BuildDate = Get-Date -Format "yyyy-MM-dd-HH:mm:ss"
################
# Initialization
################
$GitInit = "(URL:='$Url',Branch:='$Branch',Tag:='$Tag',AdditionalCommits:=$AdditionalCommits,Version:='$Version',Sha1:='$Sha1',Describe:='$Describe',UncommittedChanges:='$UncommittedChanges',CommitDate:=DT#$CommitDate,CommitAuthorName:='$CommitAuthorName',CommitAuthorEmail:='$CommitAuthorEmail')"
$GitInit = "(URL:='$Url',Branch:='$Branch',Tag:='$Tag',AdditionalCommits:=$AdditionalCommits,Version:='$Version',Sha1:='$Sha1',Describe:='$Describe',UncommittedChanges:='$UncommittedChanges',ChangeWarning:=$ChangeWarning,CommitDate:=DT#$CommitDate,CommitAuthorName:='$CommitAuthorName',CommitAuthorEmail:='$CommitAuthorEmail')"
$ProjectInit = "(ASVersion:='$ASVersion',UserName:='$UserName',ProjectName:='$ProjectName',Configuration:='$Configuration',BuildMode:='$BuildMode',BuildDate:=DT#$BuildDate)"
$BuildVersionInit = "(Git:=$GitInit,Project:=$ProjectInit)"

Expand Down
3 changes: 2 additions & 1 deletion BuildVersion.typ
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ TYPE
Branch : STRING[80]; (*Current branch checked out by local repository*)
Tag : STRING[80]; (*Latest tag on current branch*)
AdditionalCommits : UINT; (*Additional commits since latest tag*)
Version : STRING[80]; (*<tag>-<addn_commits>*)
Version : STRING[80]; (*<tag>-<add_commits>*)
Sha1 : STRING[80]; (*Full hash value from the latest commit*)
Describe : STRING[80]; (*<tag>-<addn_commits>-g<short_sha1>*)
UncommittedChanges : STRING[80]; (*Example: 5 files changed, 14 insertions(+), 11 deletions(-)*)
ChangeWarning : BOOL := TRUE; (*Uncommitted changes have been detected (true if git or repository is missing)*)
CommitDate : DATE_AND_TIME; (*Local timestamp of the latest commit*)
CommitAuthorName : STRING[80]; (*Name of author of latest commit*)
CommitAuthorEmail : STRING[80]; (*Email of author of latest commit*)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Upon successful installation, users will see BuildVersion messages in the output
- *Experimental*
- Set the active configuration's version if the tag matches a `<major>.<minor>.<patch>` number format.
- mappView Widgets
- *Coming soon*
- [BuildVersion Widget Library](https://github.com/br-na-pm/BuildVersionWidget#readme)

## Errors

Expand Down

0 comments on commit d399794

Please sign in to comment.