Skip to content
Snippets Groups Projects
Commit 6ca281fb authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Add a switch to produce a generic template of BuildDetails.

parent e310d268
No related branches found
No related tags found
No related merge requests found
[CmdletBinding()]
[CmdletBinding(DefaultParameterSetName="build")]
Param(
[Parameter(Mandatory=$True)][string] $SolutionDir,
[Parameter(Mandatory=$True)][string] $ConfigurationName
[Parameter(Mandatory=$True, ParameterSetName="build")]
[Parameter(Mandatory=$True, ParameterSetName="gentemplate")]
[string] $SolutionDir
,
[Parameter(Mandatory=$True, ParameterSetName="build")]
[ValidateSet("Debug", "Release")]
[string] $ConfigurationName
,
[Parameter(ParameterSetName="gentemplate")]
[switch] $GenericTemplate
)
$CsTemplate = @"
......@@ -35,8 +43,13 @@ function Write-BuildDetails {
[String]$Date
)
$CommitName = "$($Desc[0]).$($Desc[1])-$($Desc[2])-$($Desc[3])"
$Commit = $Desc[3].Substring(1)
if ($Desc[3].Equals("nogit")) {
$CommitName = "?commit?"
$Commit = "?sha1"
} else {
$CommitName = "$($Desc[0]).$($Desc[1])-$($Desc[2])-$($Desc[3])"
$Commit = $Desc[3].Substring(1)
}
Write-Output "$($Target.Substring($Target.LastIndexOf('\')+1)) -> $($Target)"
$Code = $CsTemplate -f `
$CommitName, `
......@@ -74,6 +87,14 @@ $BuildDate = "$($SolutionDir)\Resources\BuildDate.txt"
$BuildConfig = "$($SolutionDir)\Resources\BuildConfiguration.txt"
$BuildDetailsCS = "$($SolutionDir)\ATxCommon\BuildDetails.cs"
if ($GenericTemplate) {
$VerbosePreference = "Continue"
$DescItems = "1", "0", "0", "nogit"
Write-BuildDetails $BuildDetailsCS $DescItems "?branch?" "?build time?"
Set-Location $OldLocation
Exit
}
try {
$CommitName = & git describe --tags --long --match "[0-9].[0-9]"
if (-Not $?) { throw }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment