From ca246e03ccfb69ac27316bc23afcd2de63ac5250 Mon Sep 17 00:00:00 2001 From: James Balamuta Date: Sun, 6 Sep 2020 16:00:52 -0500 Subject: [PATCH 1/8] Incorporate release date with ensmallen version --- HISTORY.md | 2 ++ include/ensmallen_bits/ens_version.hpp | 13 +++++++++++-- scripts/ensmallen-release.sh | 8 ++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index e6a04fb3c..31ed43d04 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,6 +1,8 @@ ### ensmallen ?.??.?: "???" ###### ????-??-?? + * Add release date to version information. ([#226](https://github.com/mlpack/ensmallen/pull/226)) + ### ensmallen 2.14.2: "No Direction Home" ###### 2020-08-31 * Fix implementation of fonesca fleming problem function f1 and f2 diff --git a/include/ensmallen_bits/ens_version.hpp b/include/ensmallen_bits/ens_version.hpp index de5c65e43..814352891 100644 --- a/include/ensmallen_bits/ens_version.hpp +++ b/include/ensmallen_bits/ens_version.hpp @@ -21,7 +21,11 @@ // (i.e. the version name will be "RC1", "RC2", etc.). Otherwise the version // name will typically be a seemingly arbitrary set of words that does not // contain the capitalized string "RC". -#define ENS_VERSION_NAME "No Direction Home" +#define ENS_VERSION_NAME "No Direction Home" +// Incorporate the date the version was released +#define ENS_VERSION_YEAR 2020 +#define ENS_VERSION_MONTH 09 +#define ENS_VERSION_DAY 05 namespace ens { @@ -31,13 +35,18 @@ struct version static const unsigned int minor = ENS_VERSION_MINOR; static const unsigned int patch = ENS_VERSION_PATCH; + static const unsigned int release_year = ENS_VERSION_YEAR; + static const unsigned int release_month = ENS_VERSION_MONTH; + static const unsigned int release_day = ENS_VERSION_DAY; + static inline std::string as_string() { const char* nickname = ENS_VERSION_NAME; std::stringstream ss; ss << version::major << '.' << version::minor << '.' << version::patch - << " (" << nickname << ')'; + << ' (' << nickname << ')\n' << + 'Released on ' << release_year << '-' << release_month << '-' << release_day; return ss.str(); } diff --git a/scripts/ensmallen-release.sh b/scripts/ensmallen-release.sh index d92d2ffe9..d3638ee73 100755 --- a/scripts/ensmallen-release.sh +++ b/scripts/ensmallen-release.sh @@ -124,6 +124,14 @@ new_line="ensmallen $MAJOR.$MINOR.$PATCH: \"$version_name\""; sed -i "s/### ensmallen ?.??.?: \"???\"/### $new_line/" HISTORY.md; sed -i "s/###### ????-??-??/###### $year-$month-$day/" HISTORY.md; +# Update date in ens_version.hpp +sed -i 's/ENS_VERSION_YEAR[ ]*[0-9]*$/ENS_VERSION_YEAR '$year'/' \ + include/ensmallen_bits/ens_version.hpp; +sed -i 's/ENS_VERSION_MONTH[ ]*[0-9]*$/ENS_VERSION_MONTH '$month'/' \ + include/ensmallen_bits/ens_version.hpp; +sed -i 's/ENS_VERSION_DAY[ ]*[0-9]*$/ENS_VERSION_DAY '$day'/' \ + include/ensmallen_bits/ens_version.hpp; + # Now, we'll do all this on a new release branch. git checkout -b release-$MAJOR.$MINOR.$PATCH; From 1406965410174e5bf97e10efad548cf8390f2902 Mon Sep 17 00:00:00 2001 From: James Balamuta Date: Sun, 6 Sep 2020 16:21:46 -0500 Subject: [PATCH 2/8] Switch to strings instead of ints to preserve prefixed 0. --- include/ensmallen_bits/ens_version.hpp | 16 ++++++++-------- scripts/ensmallen-release.sh | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/ensmallen_bits/ens_version.hpp b/include/ensmallen_bits/ens_version.hpp index 814352891..00bf4d70c 100644 --- a/include/ensmallen_bits/ens_version.hpp +++ b/include/ensmallen_bits/ens_version.hpp @@ -23,9 +23,9 @@ // contain the capitalized string "RC". #define ENS_VERSION_NAME "No Direction Home" // Incorporate the date the version was released -#define ENS_VERSION_YEAR 2020 -#define ENS_VERSION_MONTH 09 -#define ENS_VERSION_DAY 05 +#define ENS_VERSION_YEAR "2020" +#define ENS_VERSION_MONTH "09" +#define ENS_VERSION_DAY "05" namespace ens { @@ -35,9 +35,9 @@ struct version static const unsigned int minor = ENS_VERSION_MINOR; static const unsigned int patch = ENS_VERSION_PATCH; - static const unsigned int release_year = ENS_VERSION_YEAR; - static const unsigned int release_month = ENS_VERSION_MONTH; - static const unsigned int release_day = ENS_VERSION_DAY; + static const std::string release_year = ENS_VERSION_YEAR; + static const std::string release_month = ENS_VERSION_MONTH; + static const std::string release_day = ENS_VERSION_DAY; static inline std::string as_string() { @@ -45,8 +45,8 @@ struct version std::stringstream ss; ss << version::major << '.' << version::minor << '.' << version::patch - << ' (' << nickname << ')\n' << - 'Released on ' << release_year << '-' << release_month << '-' << release_day; + << " (" << nickname << ')\n' + << "Released on " << release_year << '-' << release_month << '-' << release_day; return ss.str(); } diff --git a/scripts/ensmallen-release.sh b/scripts/ensmallen-release.sh index d3638ee73..12b518b16 100755 --- a/scripts/ensmallen-release.sh +++ b/scripts/ensmallen-release.sh @@ -125,11 +125,11 @@ sed -i "s/### ensmallen ?.??.?: \"???\"/### $new_line/" HISTORY.md; sed -i "s/###### ????-??-??/###### $year-$month-$day/" HISTORY.md; # Update date in ens_version.hpp -sed -i 's/ENS_VERSION_YEAR[ ]*[0-9]*$/ENS_VERSION_YEAR '$year'/' \ +sed -i 's/ENS_VERSION_YEAR[ ]*\".*\"$/ENS_VERSION_YEAR \"'"$year"'\"/' \ include/ensmallen_bits/ens_version.hpp; -sed -i 's/ENS_VERSION_MONTH[ ]*[0-9]*$/ENS_VERSION_MONTH '$month'/' \ +sed -i 's/ENS_VERSION_MONTH[ ]*\".*\"$/ENS_VERSION_MONTH \"'"$month"'\"/' \ include/ensmallen_bits/ens_version.hpp; -sed -i 's/ENS_VERSION_DAY[ ]*[0-9]*$/ENS_VERSION_DAY '$day'/' \ +sed -i 's/ENS_VERSION_DAY[ ]*\".*\"$/ENS_VERSION_DAY \"'"$day"'\"/' \ include/ensmallen_bits/ens_version.hpp; # Now, we'll do all this on a new release branch. From 7a81d2c403f6276300a7cc752c72a80412ba29b6 Mon Sep 17 00:00:00 2001 From: James Balamuta Date: Sun, 6 Sep 2020 19:13:54 -0500 Subject: [PATCH 3/8] More simplification on chare usage. --- include/ensmallen_bits/ens_version.hpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/include/ensmallen_bits/ens_version.hpp b/include/ensmallen_bits/ens_version.hpp index 00bf4d70c..d58f42013 100644 --- a/include/ensmallen_bits/ens_version.hpp +++ b/include/ensmallen_bits/ens_version.hpp @@ -35,18 +35,17 @@ struct version static const unsigned int minor = ENS_VERSION_MINOR; static const unsigned int patch = ENS_VERSION_PATCH; - static const std::string release_year = ENS_VERSION_YEAR; - static const std::string release_month = ENS_VERSION_MONTH; - static const std::string release_day = ENS_VERSION_DAY; - static inline std::string as_string() { const char* nickname = ENS_VERSION_NAME; + const char* year = ENS_VERSION_YEAR; + const char* month = ENS_VERSION_MONTH; + const char* day = ENS_VERSION_DAY; std::stringstream ss; ss << version::major << '.' << version::minor << '.' << version::patch << " (" << nickname << ')\n' - << "Released on " << release_year << '-' << release_month << '-' << release_day; + << "Released on " << year << '-' << month << '-' << day; return ss.str(); } From e2b7f96320e2c725683db048267fc11b3b577a16 Mon Sep 17 00:00:00 2001 From: James Balamuta Date: Sun, 6 Sep 2020 20:10:20 -0500 Subject: [PATCH 4/8] 'x' single char, "xyz" multi-char --- include/ensmallen_bits/ens_version.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ensmallen_bits/ens_version.hpp b/include/ensmallen_bits/ens_version.hpp index d58f42013..210de8617 100644 --- a/include/ensmallen_bits/ens_version.hpp +++ b/include/ensmallen_bits/ens_version.hpp @@ -44,7 +44,7 @@ struct version std::stringstream ss; ss << version::major << '.' << version::minor << '.' << version::patch - << " (" << nickname << ')\n' + << " (" << nickname << ")\n" << "Released on " << year << '-' << month << '-' << day; return ss.str(); From 1c95091ce8f2f9eef73e929368def954235c9a9f Mon Sep 17 00:00:00 2001 From: James Balamuta Date: Tue, 27 Oct 2020 17:19:35 -0500 Subject: [PATCH 5/8] Split into two functions --- include/ensmallen_bits/ens_version.hpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/include/ensmallen_bits/ens_version.hpp b/include/ensmallen_bits/ens_version.hpp index 210de8617..7b026fe79 100644 --- a/include/ensmallen_bits/ens_version.hpp +++ b/include/ensmallen_bits/ens_version.hpp @@ -38,17 +38,26 @@ struct version static inline std::string as_string() { const char* nickname = ENS_VERSION_NAME; + + std::stringstream ss; + ss << version::major << '.' << version::minor << '.' << version::patch + << " (" << nickname << ")"; + + return ss.str(); + } + + static inline std::string date() + { const char* year = ENS_VERSION_YEAR; const char* month = ENS_VERSION_MONTH; const char* day = ENS_VERSION_DAY; std::stringstream ss; - ss << version::major << '.' << version::minor << '.' << version::patch - << " (" << nickname << ")\n" - << "Released on " << year << '-' << month << '-' << day; + ss << year << '-' << month << '-' << day; return ss.str(); } }; + } // namespace ens From f61d8bb562280b0c5651716808fa2fd16ea05ed1 Mon Sep 17 00:00:00 2001 From: James J Balamuta Date: Wed, 28 Oct 2020 18:00:19 -0500 Subject: [PATCH 6/8] Update include/ensmallen_bits/ens_version.hpp Co-authored-by: Ryan Curtin --- include/ensmallen_bits/ens_version.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/include/ensmallen_bits/ens_version.hpp b/include/ensmallen_bits/ens_version.hpp index 7b026fe79..a8db21823 100644 --- a/include/ensmallen_bits/ens_version.hpp +++ b/include/ensmallen_bits/ens_version.hpp @@ -59,5 +59,4 @@ struct version } }; - } // namespace ens From 0d41e88701c2cfa0c86eb6ccbd53f9daac25c442 Mon Sep 17 00:00:00 2001 From: James J Balamuta Date: Thu, 29 Oct 2020 19:53:51 -0500 Subject: [PATCH 7/8] Update include/ensmallen_bits/ens_version.hpp Co-authored-by: Marcus Edel --- include/ensmallen_bits/ens_version.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ensmallen_bits/ens_version.hpp b/include/ensmallen_bits/ens_version.hpp index a8db21823..de89b2b04 100644 --- a/include/ensmallen_bits/ens_version.hpp +++ b/include/ensmallen_bits/ens_version.hpp @@ -22,7 +22,7 @@ // name will typically be a seemingly arbitrary set of words that does not // contain the capitalized string "RC". #define ENS_VERSION_NAME "No Direction Home" -// Incorporate the date the version was released +// Incorporate the date the version was released. #define ENS_VERSION_YEAR "2020" #define ENS_VERSION_MONTH "09" #define ENS_VERSION_DAY "05" From a17f8f4763df347b8094ef87b05926832a2c7807 Mon Sep 17 00:00:00 2001 From: James Balamuta Date: Thu, 29 Oct 2020 19:54:33 -0500 Subject: [PATCH 8/8] Switch to directly using the macro definitions --- include/ensmallen_bits/ens_version.hpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/include/ensmallen_bits/ens_version.hpp b/include/ensmallen_bits/ens_version.hpp index de89b2b04..b139f4cf0 100644 --- a/include/ensmallen_bits/ens_version.hpp +++ b/include/ensmallen_bits/ens_version.hpp @@ -41,19 +41,15 @@ struct version std::stringstream ss; ss << version::major << '.' << version::minor << '.' << version::patch - << " (" << nickname << ")"; + << " (" << nickname << ')'; return ss.str(); } static inline std::string date() { - const char* year = ENS_VERSION_YEAR; - const char* month = ENS_VERSION_MONTH; - const char* day = ENS_VERSION_DAY; - std::stringstream ss; - ss << year << '-' << month << '-' << day; + ss << ENS_VERSION_YEAR << '-' << ENS_VERSION_MONTH << '-' << ENS_VERSION_DAY; return ss.str(); }