From 46c0a69e4d55c6e6ef678cfedac43dd25c021081 Mon Sep 17 00:00:00 2001 From: Alan McGovern Date: Thu, 5 Sep 2019 17:03:22 +0100 Subject: [PATCH] [build] Prepare for a 1.0 stable release. Sure why not! --- beta.txt | 0 src/MonoTorrent/MonoTorrent.csproj | 2 +- src/MonoTorrent/MonoTorrent/VersionInfo.cs | 31 ++++++++++++++++++---- version.txt | 2 +- 4 files changed, 28 insertions(+), 7 deletions(-) delete mode 100644 beta.txt diff --git a/beta.txt b/beta.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/MonoTorrent/MonoTorrent.csproj b/src/MonoTorrent/MonoTorrent.csproj index dfc273547..125a07f37 100644 --- a/src/MonoTorrent/MonoTorrent.csproj +++ b/src/MonoTorrent/MonoTorrent.csproj @@ -5,7 +5,7 @@ 7.2 $(NoWarn);1591;1572;1573;1570;1584 netstandard2.0 - 0.99.0.0 + 1.0.0.0 true diff --git a/src/MonoTorrent/MonoTorrent/VersionInfo.cs b/src/MonoTorrent/MonoTorrent/VersionInfo.cs index 309ba032d..a85ff1e2a 100644 --- a/src/MonoTorrent/MonoTorrent/VersionInfo.cs +++ b/src/MonoTorrent/MonoTorrent/VersionInfo.cs @@ -47,7 +47,7 @@ public static class VersionInfo /// internal static readonly string ClientVersion; - internal static readonly string DhtClientVersion = $"{ClientIdentifier}06"; + internal static readonly string DhtClientVersion; /// /// The full version of this library. @@ -56,18 +56,39 @@ public static class VersionInfo static VersionInfo () { - Version = System.Version.Parse(typeof(VersionInfo).Assembly.GetCustomAttribute().Version); + Version = new Version ( + int.Parse (ThisAssembly.Git.SemVer.Major), + int.Parse (ThisAssembly.Git.SemVer.Minor), + int.Parse (ThisAssembly.Git.SemVer.Patch) + ); + + // The scheme for generating the peerid includes the version number using the scheme: + // ABCC, where A is the major, B is the minor and CC is the build version. + if (Version.Major > 9) + throw new ArgumentException ("The major version should be between 0 and 9 (inclusive)"); + if (Version.Minor > 9) + throw new ArgumentException ("The minor version should be between 0 and 9 (inclusive)"); + if (Version.Build > 99) + throw new ArgumentException ("The build version should be between 0 and 99 (inclusive)"); // 'MO' for MonoTorrent then four digit version number - string version = string.Format ("{0}{1}{2}{3}", Math.Max (Version.Major, 0), + string version = string.Format ("{0}{1}{2:00}", Math.Max (Version.Major, 0), Math.Max (Version.Minor, 0), - Math.Max (Version.Build, 0), - Math.Max (Version.Revision, 0)); + Math.Max (Version.Build, 0)); if (version.Length > 4) version = version.Substring (0, 4); else version = version.PadRight (4, '0'); ClientVersion = $"{ClientIdentifier}{version}"; + + // The DHT spec calls for a 2 char version identifier... urgh. I'm just going to + // generate a 4 character version identifier anyway as, hopefully, anyone using + // this field treats it like the opaque identifier it is supposed to be. + // + // If this causes issues then we should just trim the first 2 digits from this + // and accept that it's not a unique identifier anymore. If we keep the last + // two then we're more likely to be able to disambiguate. + DhtClientVersion = $"{ClientIdentifier}{version}"; } } } diff --git a/version.txt b/version.txt index fe9209eda..afaf360d3 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.99.0 \ No newline at end of file +1.0.0 \ No newline at end of file