aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Costa <miguel.costa@qt.io>2019-09-10 18:09:33 +0200
committerMiguel Costa <miguel.costa@qt.io>2019-09-18 09:18:15 +0000
commit1c46c9ac9ff946e3d0d5a17676dd02dbd73a68ac (patch)
treea00069da4a635f3d8c3cff0fccbce47fe4f37f86
parent4257475b630f08e33a85e866f38dce2334efe049 (diff)
Add revision number based on git describe
Added a revision part to the extension version number. The revision number is based on the output of git describe, i.e. the number of commits from the last tag of a designated version (MAJOR.MINOR.PATCH). The new format for revised versions will now be: MAJOR.MINOR.PATCH.REVISION Non-revised versions (last tag is at HEAD) will not include REVISION. The motivation for this change is the fact that the version support in the Visual Studio Marketplace does not allow reverting to older version numbers. In case of a revert or hot fix, the new revision number will now make it possible to push revised extensions to the marketplace without the need to change the designated version. Change-Id: Ic55c3bcdfad47d386e324ad36492159d77a59b2f Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r--src/config/12.0/source.extension.vsixmanifest_TT2
-rw-r--r--src/config/14.0/source.extension.vsixmanifest_TT2
-rw-r--r--src/config/15.0/source.extension.vsixmanifest_TT2
-rw-r--r--src/config/16.0/source.extension.vsixmanifest_TT2
-rw-r--r--src/qtvstools/QtMenus.vsct_TT2
-rw-r--r--src/qtvstools/Version.cs2
-rw-r--r--src/version.tt36
7 files changed, 39 insertions, 9 deletions
diff --git a/src/config/12.0/source.extension.vsixmanifest_TT b/src/config/12.0/source.extension.vsixmanifest_TT
index 3d0b2d58..2494ed82 100644
--- a/src/config/12.0/source.extension.vsixmanifest_TT
+++ b/src/config/12.0/source.extension.vsixmanifest_TT
@@ -39,7 +39,7 @@
<!-- BEGIN Generated Text <#=XML_COMMENT_END#>
<Identity
Id="QtVsTools.15021976-cd02-4fd0-89bd-e36f85abe16a"
- Version="<#=QT_VS_TOOLS_VERSION#>"
+ Version="<#=QT_VS_TOOLS_VERSION_MANIFEST#>"
Language="en-US"
Publisher="The Qt Company Ltd." />
<#=XML_COMMENT_BEGIN#> END Generated Text -->
diff --git a/src/config/14.0/source.extension.vsixmanifest_TT b/src/config/14.0/source.extension.vsixmanifest_TT
index a2baa0fe..c65874b0 100644
--- a/src/config/14.0/source.extension.vsixmanifest_TT
+++ b/src/config/14.0/source.extension.vsixmanifest_TT
@@ -39,7 +39,7 @@
<!-- BEGIN Generated Text <#=XML_COMMENT_END#>
<Identity
Id="QtVsTools.30112013-cd02-4fd0-89bd-e36f85abe16a"
- Version="<#=QT_VS_TOOLS_VERSION#>"
+ Version="<#=QT_VS_TOOLS_VERSION_MANIFEST#>"
Language="en-US"
Publisher="The Qt Company Ltd." />
<#=XML_COMMENT_BEGIN#> END Generated Text -->
diff --git a/src/config/15.0/source.extension.vsixmanifest_TT b/src/config/15.0/source.extension.vsixmanifest_TT
index 69d1d4a6..57ccee17 100644
--- a/src/config/15.0/source.extension.vsixmanifest_TT
+++ b/src/config/15.0/source.extension.vsixmanifest_TT
@@ -39,7 +39,7 @@
<!-- BEGIN Generated Text <#=XML_COMMENT_END#>
<Identity
Id="QtVsTools.13121978-cd02-4fd0-89bd-e36f85abe16a"
- Version="<#=QT_VS_TOOLS_VERSION#>"
+ Version="<#=QT_VS_TOOLS_VERSION_MANIFEST#>"
Language="en-US"
Publisher="The Qt Company Ltd." />
<#=XML_COMMENT_BEGIN#> END Generated Text -->
diff --git a/src/config/16.0/source.extension.vsixmanifest_TT b/src/config/16.0/source.extension.vsixmanifest_TT
index ff451689..6cf91028 100644
--- a/src/config/16.0/source.extension.vsixmanifest_TT
+++ b/src/config/16.0/source.extension.vsixmanifest_TT
@@ -39,7 +39,7 @@
<!-- BEGIN Generated Text <#=XML_COMMENT_END#>
<Identity
Id="QtVsTools.bf3c71c0-ab41-4427-ada9-9b3813d89ff5"
- Version="<#=QT_VS_TOOLS_VERSION#>"
+ Version="<#=QT_VS_TOOLS_VERSION_MANIFEST#>"
Language="en-US"
Publisher="The Qt Company Ltd." />
<#=XML_COMMENT_BEGIN#> END Generated Text -->
diff --git a/src/qtvstools/QtMenus.vsct_TT b/src/qtvstools/QtMenus.vsct_TT
index 309a44fb..c2c105dc 100644
--- a/src/qtvstools/QtMenus.vsct_TT
+++ b/src/qtvstools/QtMenus.vsct_TT
@@ -190,7 +190,7 @@
<Strings>
<!-- BEGIN Generated Text <#=XML_COMMENT_END#>
<ButtonText
- >Qt Visual Studio Tools version <#=QT_VS_TOOLS_VERSION#>: Initializing...</ButtonText>
+>Qt Visual Studio Tools version <#=QT_VS_TOOLS_VERSION_MANIFEST#>: Initializing...</ButtonText>
<#=XML_COMMENT_BEGIN#> END Generated Text -->
</Strings>
</Button>
diff --git a/src/qtvstools/Version.cs b/src/qtvstools/Version.cs
index 2b1385c2..a2b4aace 100644
--- a/src/qtvstools/Version.cs
+++ b/src/qtvstools/Version.cs
@@ -35,6 +35,6 @@ namespace QtVsTools
{
internal static class Version
{
- public const string PRODUCT_VERSION = "<#=QT_VS_TOOLS_VERSION#>";
+ public const string PRODUCT_VERSION = "<#=QT_VS_TOOLS_VERSION_MANIFEST#>";
}
}
diff --git a/src/version.tt b/src/version.tt
index ebb2da84..c6498ce8 100644
--- a/src/version.tt
+++ b/src/version.tt
@@ -4,6 +4,8 @@
<#@ assembly name="System.Xml.Linq" #>
<#@ assembly name="System.Linq" #>
<#@ assembly name="System.Data.Linq" #>
+<#@ import namespace="System.Diagnostics" #>
+<#@ import namespace="System.IO" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Xml" #>
<#@ import namespace="System.Xml.Linq" #>
@@ -35,12 +37,40 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+ Func<string> GetRevisionData = new Func<string>(() =>
+ {
+ var proc = System.Diagnostics.Process.Start(new ProcessStartInfo
+ {
+ FileName = "git",
+ Arguments = "describe --tags",
+ WorkingDirectory = Directory.GetParent(SolutionDir).FullName,
+ CreateNoWindow = true, UseShellExecute = false,
+ RedirectStandardOutput = true, RedirectStandardError = true,
+ });
+ return proc.WaitForExit(3000) && proc.ExitCode == 0 ? proc.StandardOutput.ReadLine() : "";
+ });
+ string REVISION_TAG = GetRevisionData();
+ int REVISION_NUMBER = Convert.ToInt32(REVISION_TAG.Split('-').Skip(1).FirstOrDefault());
+
+/***************************************************************************/
+
string QT_VS_TOOLS_VERSION = (string)XDocument.Load(SolutionDir + @"\version.targets")
.Descendants()
.Where(x => x.Name.LocalName == "QtVSToolsVersion")
.FirstOrDefault();
+
/***************************************************************************/
- string QT_VS_TOOLS_VERSION_TAG = QT_VS_TOOLS_VERSION.Replace(".", "");
- string QT_VS_TOOLS_VERSION_ASSEMBLY = QT_VS_TOOLS_VERSION + ".0";
- string QT_VS_TOOLS_VERSION_ASSEMBLY_FILE = QT_VS_TOOLS_VERSION + ".0";
+
+ string QT_VS_TOOLS_VERSION_TAG
+ = QT_VS_TOOLS_VERSION.Replace(".", "");
+
+ string QT_VS_TOOLS_VERSION_ASSEMBLY
+ = string.Format("{0}.{1}", QT_VS_TOOLS_VERSION, REVISION_NUMBER);
+
+ string QT_VS_TOOLS_VERSION_ASSEMBLY_FILE
+ = string.Format("{0}.{1}", QT_VS_TOOLS_VERSION, REVISION_NUMBER);
+
+ string QT_VS_TOOLS_VERSION_MANIFEST
+ = REVISION_NUMBER > 0 ? QT_VS_TOOLS_VERSION_ASSEMBLY : QT_VS_TOOLS_VERSION;
#> \ No newline at end of file