reincarnate = SWITCH_TRUE;
reincarnate_reexec = SWITCH_TRUE;
}
-
- else if (!strcmp(local_argv[x], "-version")) {
- fprintf(stdout, "FreeSWITCH version: %s (%s)\n", switch_version_full(), switch_version_revision_human());
- exit(EXIT_SUCCESS);
- }
#endif
#ifdef HAVE_SETRLIMIT
else if (!strcmp(local_argv[x], "-core")) {
#endif
}
#endif
+ else if (!strcmp(local_argv[x], "-version")) {
+ fprintf(stdout, "FreeSWITCH version: %s (%s)\n", switch_version_full(), switch_version_revision_human());
+ exit(EXIT_SUCCESS);
+ }
+
else if (!strcmp(local_argv[x], "-hp") || !strcmp(local_argv[x], "-rp")) {
priority = 2;
}
<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" InitialTargets="GitVersion" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <GitSkipCache>true</GitSkipCache>
+ </PropertyGroup>
<ImportGroup Label="PropertySheets">
<Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/>
+ <Import Project="Setup\GitInfo\GitInfo.targets" />
</ImportGroup>
<PropertyGroup>
<UsingTask TaskName="SwitchVersionTask"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
+ <ParameterGroup>
+ <commits Required="true" />
+ <revision Required="true" />
+ </ParameterGroup>
<Task>
<Reference Include="Microsoft.Build" />
<Reference Include="Microsoft.Build.Framework" />
public class SwitchVersionTask : Microsoft.Build.Utilities.Task
{
+ [Required]
+ public string revision { get; set; }
+ public string commits { get; set; }
+
private string basedir;
private string TemplatePath;
private string DestinationPath;
{
basedir = Path.GetFullPath(@"$(BaseDir)");
+ int commit_count = 0;
+ Int32.TryParse(commits, out commit_count);
+
Log.LogMessage(MessageImportance.High,
"Parsing FreeSWITCH version.");
string[] tokens = value.Split('-');
value = tokens[0];
}
- v.Add(m.Groups[1].Value.Trim(), value.Trim());
- Log.LogMessage(MessageImportance.High,
- m.Groups[1].Value + " = '" + value.Trim() + "'");
+ var name = m.Groups[1].Value.Trim();
+ value = value.Trim();
+
+ if (name.StartsWith("SWITCH_VERSION_REVISION")) {
+ if (string.IsNullOrWhiteSpace(value)) {
+ value = revision;
+ }
+
+ if (name != "SWITCH_VERSION_REVISION_HUMAN") {
+ value = "~" + value;
+
+ if (commit_count > 0) {
+ value = "-dev-"+ commits + value;
+ } else {
+ value = "-release" + value;
+ }
+ }
+ }
+ v.Add(name, value);
+ Log.LogMessage(MessageImportance.High, name + " = '" + value + "'");
}
//---------------------------------------------------------
</UsingTask>
<Target Name="SwitchVersionTarget" BeforeTargets="CustomBuild;Build">
- <SwitchVersionTask>
+ <SwitchVersionTask commits="$(GitCommits)" revision="$(GitCommit)">
</SwitchVersionTask>
</Target>