- calculate full version tag in build script and set AssemblyTitle

- display AssemblyTitle in Vocaluxe gui
- code names are stored in .build/versionNames.json
- pre and post build scripts for windows (one place for all commands)
- adjusted and moved the linux build scripts
This commit is contained in:
lukeIam committed 2016-12-28 23:01:34 +01:00
1 parent 0eb28b1bc9
commit 152be5d8ad
9 files changed
+112 -64

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
#!/bin/sh
PROJECT=$1
cd $PROJECT
sed -i -r -e 's/AssemblyInformationalVersion\(".*?"\)/AssemblyInformationalVersion("GITVERSION")/' $PROJECT/Properties/AssemblyInfo.cs
sed -i -r -e 's/AssemblyVersion\(".*?"\)/AssemblyVersion("SHORTVERSION")/' $PROJECT/Properties/AssemblyInfo.cs
sed -i -r -e 's/AssemblyFileVersion\(".*?"\)/AssemblyFileVersion("SHORTVERSION")/' $PROJECT/Properties/AssemblyInfo.cs
sed -i -r -e 's/AssemblyTitle\(".*?"\)/AssemblyTitle("FULLVERSION")/' $PROJECT/Properties/AssemblyInfo.cs
sed -i -e 's/var matchingServerVersion = "";/var matchingServerVersion = "'$(git describe --long)'";/' $PROJECT/../Output/Website/js/main.js
+29
View File
@@ -0,0 +1,29 @@
#!/bin/sh
PROJECT=$1
cd $PROJECT
arch=$2
version=$(git describe --long)
shortVersion=${version%%-*}
shortVersionClean=$(echo $shortVersion | sed -e 's/alpha/0/' -e 's/beta/1/' -e 's/rc/2/' -e 's/[[:alpha:]]//g')
case ${shortVersion##*.} in
alpha*)
releaseType='Alpha'
;;
beta*)
releaseType='Beta'
;;
rc*)
releaseType='RC'
;;
*)
releaseType='Release'
;;
esac
versionName=$(grep -oP "\"${shortVersionClean%.*}.\" *: *\"\K([^\"]+)(?=\")" ../.build/versionNames.json)
fullVersionName="Vocaluxe $([ "$versionName" == "" ] && echo "" || echo "'$versionName' ")$shortVersion ($arch) $([ "$releaseType" == "Release" ] && echo "" || echo "$releaseType ")($version)"
sed -i -e s/GITVERSION/$(git describe --long)/ $PROJECT/Properties/AssemblyInfo.cs
sed -i -e s/SHORTVERSION/"$shortVersionClean"/ $PROJECT/Properties/AssemblyInfo.cs
sed -i -e s/FULLVERSION/"$fullVersionName"/ $PROJECT/Properties/AssemblyInfo.cs
+5
View File
@@ -0,0 +1,5 @@
{
"0.0.": "Unversioned Build",
"0.3.": "Shining Heaven",
"0.4.": "Blue Sunrise"
}
+23
View File
@@ -0,0 +1,23 @@
param(
[Parameter(Mandatory=$true)]
[String]$ProjectDir
)
if($Env:GIT_VERSION_TAG)
{
$version = $Env:GIT_VERSION_TAG;
}
else
{
$version = git describe --long;
}
(Get-Content -Encoding UTF8 "$($ProjectDir)..\Output\Website\js\main.js") `
| Foreach-Object {$_ -replace '(?<=var *matchingServerVersion * = *\")\w*(?=\" *;)', "$version"} `
| Set-Content -Encoding UTF8 "$($ProjectDir)..\Output\Website\js\main.js"
(Get-Content -Encoding UTF8 "$($ProjectDir)Properties\AssemblyInfo.cs") `
| Foreach-Object {$_ -replace '(?<=AssemblyInformationalVersion\(\").*(?=\")', 'GITVERSION'} `
| Foreach-Object {$_ -replace '(?<=(AssemblyVersion|AssemblyFileVersion)\(\").*(?=\")', 'SHORTVERSION'} `
| Foreach-Object {$_ -replace '(?<=AssemblyTitle\(\").*(?=\")', 'FULLVERSION'} `
| Set-Content -Encoding UTF8 "$($ProjectDir)Properties\AssemblyInfo.cs"
+40
View File
@@ -0,0 +1,40 @@
param(
[Parameter(Mandatory=$true)]
[String]$ProjectDir,
[Parameter(Mandatory=$true)]
[String]$Arch
)
if($Env:GIT_VERSION_TAG)
{
$version = $Env:GIT_VERSION_TAG;
}
else
{
$version = git describe --long;
}
$shortVersion = $version.Split('-')[0];
[System.Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions")
$versionName = (New-Object System.Web.Script.Serialization.JavaScriptSerializer).Deserialize((Get-Content "$($ProjectDir)..\.build\versionNames.json"), `
[System.Collections.Hashtable])[([regex]"[0-9]+\.[0-9]+\.").Match($shortVersion).Value]
$releaseType = switch -wildcard ($shortVersion.Split('.')[2])
{
"alpha*" {"Alpha"}
"beta*" {"Beta"}
"rc*" {"RC"}
default {"Release"}
};
$fullVersionName = "Vocaluxe $(if($versionName) {"'"+$versionName+"' "} else {''})$shortVersion ($Arch) $(if($releaseType -ne "Release") {'$releaseType '} else {''})($version)"
(Get-Content -Encoding UTF8 "$($ProjectDir)Properties\AssemblyInfo.cs") `
| Foreach-Object {$_ `
-replace '(?<=AssemblyInformationalVersion\(").*(?=")', $version `
-replace '(?<=(AssemblyVersion|AssemblyFileVersion)\(").*(?=")', `
($version.Split('-')[0].replace('alpha','0').replace('beta','1').replace('rc','2') -replace "[a-zA-Z]+","")`
-replace '(?<=AssemblyTitle\(").*(?=")', $fullVersionName `
-replace '(?<=AssemblyCopyright\(".*)[0-9]+(?=")', (Get-Date).Year} `
| Set-Content -Encoding UTF8 "$($ProjectDir)Properties\AssemblyInfo.cs"