This repository has been archived by the owner on May 11, 2024. It is now read-only.
forked from PazerOP/CastingEssentials
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add automatic version numbering from git tags
- Loading branch information
Showing
6 changed files
with
52 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
$filename = $args[0] | ||
|
||
$name = "CastingEssentialsRed"; | ||
$shortstat = (git diff --shortstat 2>$null) | Out-String | ||
$version = (git describe --always --tag --match "release-*" 2>$null) | Out-String | ||
$version = $version.Trim().Substring(8) | ||
|
||
$dir = Split-Path -path "$filename" | ||
if(!(Test-Path "$filename" -PathType Any)) { | ||
New-Item -path "$dir" -type directory >$null | ||
} | ||
|
||
if ($shortstat) { | ||
$version = "${version}-dirty"; | ||
} | ||
|
||
$current = ""; | ||
if(Test-Path "$filename" -PathType Leaf) { | ||
$current = Get-Content -Path "$filename" | ||
} | ||
|
||
$suffix = $args[1] | ||
if ($suffix) { | ||
$version = "${version}${suffix}" | ||
} | ||
|
||
$target = "extern const char* const PLUGIN_NAME = ""$name""; | ||
extern const char* const PLUGIN_VERSION_ID = ""$version""; | ||
extern const char* const PLUGIN_FULL_VERSION = ""$name $version"";" | ||
|
||
if ($target -ne $current) { | ||
echo $target | Out-File "$filename" | ||
} |