FS-11513: [Build-System] Fix Windows versioning.

This commit is contained in:
Andrey Volk 2019-07-16 22:23:38 +04:00
parent abec4deaa1
commit 89c2dc04a0
3 changed files with 19 additions and 6 deletions

View File

@ -5,5 +5,6 @@ FOR /f "delims=" %%i in ('FIND /N "AC_INIT" ..\..\configure.ac') DO SET version_
FOR /f "tokens=2 delims=," %%a in ("%version_contained_string%") DO SET dirty_version=%%a FOR /f "tokens=2 delims=," %%a in ("%version_contained_string%") DO SET dirty_version=%%a
SET almost_clean_version=%dirty_version:[=% SET almost_clean_version=%dirty_version:[=%
SET version_with_spaces=%almost_clean_version:]=% SET version_with_spaces=%almost_clean_version:]=%
SET full_version=%version_with_spaces: =% SET version_with_dash=%version_with_spaces: =%
FOR /f "tokens=1 delims=-" %%a in ("%version_with_dash%") DO SET full_version=%%a
echo %full_version% echo %full_version%

View File

@ -926,7 +926,10 @@
<Exec Command="$(SolutionDir)w32\Setup\FullVersion.cmd" ConsoleToMSBuild="true"> <Exec Command="$(SolutionDir)w32\Setup\FullVersion.cmd" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="FullVersion" /> <Output TaskParameter="ConsoleOutput" PropertyName="FullVersion" />
</Exec> </Exec>
<CreateProperty Condition="'$(GitCommits)' != '0'" Value="-snapshot-$(GitCommit)-$([System.DateTime]::Now.ToString(yyyyMMddHHmmss))"> <CreateProperty Condition="'$(Configuration)' == 'Debug'" Value="-debug">
<Output TaskParameter="Value" PropertyName="DebugConfiguration" />
</CreateProperty>
<CreateProperty Condition="'$(GitCommits)' != '0'" Value="$(GitCommits)-$(GitCommit)-$([System.DateTime]::Now.ToString(yyyyMMddHHmmss))">
<Output TaskParameter="Value" PropertyName="SnapshotName" /> <Output TaskParameter="Value" PropertyName="SnapshotName" />
</CreateProperty> </CreateProperty>
<CreateProperty Condition="'$(GitCommits)' != '0'" Value=".$(GitCommits)"> <CreateProperty Condition="'$(GitCommits)' != '0'" Value=".$(GitCommits)">
@ -941,7 +944,10 @@
<CreateProperty Condition="'$(Platform)'=='x64'" Value="x64"> <CreateProperty Condition="'$(Platform)'=='x64'" Value="x64">
<Output TaskParameter="Value" PropertyName="UserFriendlyPlatform" /> <Output TaskParameter="Value" PropertyName="UserFriendlyPlatform" />
</CreateProperty> </CreateProperty>
<CreateProperty Condition="$(FullVersion) != ''" Value="$(SolutionDir)$(UserFriendlyPlatform)\$(OutputName)-$(FullVersion)$(Revision)$(SnapshotName)-$(UserFriendlyPlatform)-$(Configuration).msi"> <CreateProperty Condition="$(FullVersion) != '' AND '$(GitCommits)' != '0'" Value="$(SolutionDir)$(UserFriendlyPlatform)\$(OutputName)-$(FullVersion)-Dev-$(SnapshotName)-$(UserFriendlyPlatform)$(DebugConfiguration).msi">
<Output TaskParameter="Value" PropertyName="DestinationFileName" />
</CreateProperty>
<CreateProperty Condition="$(FullVersion) != '' AND '$(GitCommits)' == '0'" Value="$(SolutionDir)$(UserFriendlyPlatform)\$(OutputName)-$(FullVersion)-Release-$(UserFriendlyPlatform)$(DebugConfiguration).msi">
<Output TaskParameter="Value" PropertyName="DestinationFileName" /> <Output TaskParameter="Value" PropertyName="DestinationFileName" />
</CreateProperty> </CreateProperty>
<CreateProperty Value="$(VCToolsRedistVersion)"> <CreateProperty Value="$(VCToolsRedistVersion)">
@ -969,6 +975,7 @@
<Message Importance="High" Text="VSInstallDir: $(VSInstallDir)" /> <Message Importance="High" Text="VSInstallDir: $(VSInstallDir)" />
<Message Importance="High" Text="SoundsDir: $(SoundsDir)" /> <Message Importance="High" Text="SoundsDir: $(SoundsDir)" />
<Message Importance="High" Text="DefineConstants: $(DefineConstants)" /> <Message Importance="High" Text="DefineConstants: $(DefineConstants)" />
<Message Importance="High" Text="DestinationFileName: $(DestinationFileName)" />
</Target> </Target>
<!-- <!--
To modify your build process, add your task inside one of the targets below. To modify your build process, add your task inside one of the targets below.

View File

@ -36,7 +36,7 @@ using Microsoft.Build.Framework;
"Parsing FreeSWITCH version."); "Parsing FreeSWITCH version.");
string ConfigureAC = File.ReadAllText(@"$(BaseDir)configure.ac"); string ConfigureAC = File.ReadAllText(@"$(BaseDir)configure.ac");
string pattern = @"AC_SUBST\((SWITCH_VERSION_[A-Z_]+),.*\[(.?)\]\)"; string pattern = @"AC_SUBST\((SWITCH_VERSION_[A-Z_]+),.*\[(.*)\]\)";
Dictionary<string, string> v = new Dictionary<string, string>(); Dictionary<string, string> v = new Dictionary<string, string>();
@ -44,9 +44,14 @@ using Microsoft.Build.Framework;
v.Add("SWITCH_VERSION_YEAR", year); v.Add("SWITCH_VERSION_YEAR", year);
foreach (Match m in Regex.Matches(ConfigureAC, pattern)) { foreach (Match m in Regex.Matches(ConfigureAC, pattern)) {
v.Add(m.Groups[1].Value.Trim(), m.Groups[2].Value.Trim()); string value = m.Groups[2].Value.Trim();
if (value.Contains("-")) {
string[] tokens = value.Split('-');
value = tokens[0];
}
v.Add(m.Groups[1].Value.Trim(), value.Trim());
Log.LogMessage(MessageImportance.High, Log.LogMessage(MessageImportance.High,
m.Groups[1].Value + " = '" + m.Groups[2].Value + "'"); m.Groups[1].Value + " = '" + value.Trim() + "'");
} }
//--------------------------------------------------------- //---------------------------------------------------------