diff --git a/HOOT_VERSION_GEN b/HOOT_VERSION_GEN index 610ad818ba..a4977d51f8 100755 --- a/HOOT_VERSION_GEN +++ b/HOOT_VERSION_GEN @@ -19,6 +19,7 @@ if test -f version then VN=$(cat version) || VN="$DEF_VER" elif test "$HAS_GIT" = "true" && + VD=$(git show -s --format=%ci | awk '{print $1;}') && VN=$(git describe --match "v[0-9]*" --abbrev=7 --tags HEAD 2>/dev/null | sed -e s/-/_/g) && case "$VN" in *$LF*) (exit 1) ;; @@ -34,7 +35,7 @@ else VN="$DEF_VER" fi -# VN is the full version number. E.g. 0.1.0 if it is a tag. 0.1.0-2-deadbeef +# VN is the full version number. E.g. 0.1.0 if it is a tag. 0.1.0-2-deadbeef # if it is not a tagged version VN=$(expr "$VN" : v*'\(.*\)') @@ -54,10 +55,13 @@ fi # If the version has changed, then rewrite the version header file. test "$VN" = "$VC" || { echo "HOOT_VERSION = $VN" >$HVF + echo "HOOT_DATE = $VD" >>$HVF + echo "HOOT_BUILT_BY = $(whoami)" >>$HVF cat hoot-core/src/main/cpp/hoot/core/info/VersionDefines.h.in | \ sed -e "s/@HOOT_VERSION@/$VN/g" | \ sed -e "s/@HOOT_REVISION@/$HOOT_REVISION/g" | \ + sed -e "s/@HOOT_DATE@/$VD/g" | \ sed -e "s/@HOOT_BUILT_BY@/$(whoami)/g" > \ hoot-core/src/main/cpp/hoot/core/info/VersionDefines.h } diff --git a/Makefile.hoot b/Makefile.hoot index 54f1ffb373..273afd2a6b 100644 --- a/Makefile.hoot +++ b/Makefile.hoot @@ -399,9 +399,7 @@ else echo "UI tests must specify both --with-services and --with-uitests." endif -FORCE: vagrant - -HOOT_VERSION_FILE: FORCE +HOOT_VERSION_FILE: $(SHELL_PATH) ./HOOT_VERSION_GEN; -include HOOT_VERSION_FILE @@ -540,7 +538,3 @@ eclipse: ifeq ($(BUILD_SERVICES),services) scripts/maven/mvn-build $(MVN_QUIET) eclipse endif - -vagrant: - # Check the Vagrant.marker file data to see if provisioning needs to run - if [ -f Vagrant.marker ]; then if [ Vagrant.marker -ot VagrantProvision.sh ]; then echo; echo; echo "New dependencies have been added to Vagrant!"; echo "Please exit the vm and run 'vagrant provision' or"; echo "run 'touch Vagrant.marker' and re-run 'make' to continue."; echo; echo; false; fi fi diff --git a/hoot-core/src/main/cpp/hoot/core/cmd/VersionCmd.cpp b/hoot-core/src/main/cpp/hoot/core/cmd/VersionCmd.cpp index 4c7dd09f40..bf2b3c3c9c 100644 --- a/hoot-core/src/main/cpp/hoot/core/cmd/VersionCmd.cpp +++ b/hoot-core/src/main/cpp/hoot/core/cmd/VersionCmd.cpp @@ -22,7 +22,7 @@ * This will properly maintain the copyright information. Maxar * copyrights will be updated automatically. * - * @copyright Copyright (C) 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 Maxar (http://www.maxar.com/) + * @copyright Copyright (C) 2015-2023 Maxar (http://www.maxar.com/) */ // Boost @@ -106,7 +106,7 @@ class VersionCmd : public BaseCommand if (!args.empty()) throw HootException(QString("%1 takes no parameters.").arg(getName())); - cout << Version::getFullVersion() << " Built By: " << Version::getBuiltBy() << endl; + cout << Version::getFullVersion() << " " << Version::getDate() << " built by " << Version::getBuiltBy() << endl; LOG_DEBUG("GEOS Version:\t" << geosversion()); LOG_DEBUG("GDAL Version:\t" << GDALVersionInfo("RELEASE_NAME")); LOG_DEBUG("GLPK Version:\t" << glp_version()); diff --git a/hoot-core/src/main/cpp/hoot/core/info/Version.cpp b/hoot-core/src/main/cpp/hoot/core/info/Version.cpp index 1950daa2a1..b7ded7e349 100644 --- a/hoot-core/src/main/cpp/hoot/core/info/Version.cpp +++ b/hoot-core/src/main/cpp/hoot/core/info/Version.cpp @@ -22,7 +22,7 @@ * This will properly maintain the copyright information. Maxar * copyrights will be updated automatically. * - * @copyright Copyright (C) 2015, 2017, 2018, 2021 Maxar (http://www.maxar.com/) + * @copyright Copyright (C) 2015-2023 Maxar (http://www.maxar.com/) */ #include "Version.h" @@ -53,4 +53,9 @@ const char* Version::getVersion() return HOOT_VERSION; } +const char* Version::getDate() +{ + return HOOT_DATE; +} + } diff --git a/hoot-core/src/main/cpp/hoot/core/info/Version.h b/hoot-core/src/main/cpp/hoot/core/info/Version.h index 544213dcd1..8275a9b758 100644 --- a/hoot-core/src/main/cpp/hoot/core/info/Version.h +++ b/hoot-core/src/main/cpp/hoot/core/info/Version.h @@ -22,7 +22,7 @@ * This will properly maintain the copyright information. Maxar * copyrights will be updated automatically. * - * @copyright Copyright (C) 2015, 2017, 2018, 2019, 2021 Maxar (http://www.maxar.com/) + * @copyright Copyright (C) 2015-2023 Maxar (http://www.maxar.com/) */ #ifndef VERSION_H @@ -42,6 +42,8 @@ class Version static const char* getRevision(); static const char* getVersion(); + + static const char* getDate(); }; } diff --git a/hoot-core/src/main/cpp/hoot/core/info/VersionDefines.h.in b/hoot-core/src/main/cpp/hoot/core/info/VersionDefines.h.in index bc564692e2..55efac97c1 100644 --- a/hoot-core/src/main/cpp/hoot/core/info/VersionDefines.h.in +++ b/hoot-core/src/main/cpp/hoot/core/info/VersionDefines.h.in @@ -32,6 +32,9 @@ #ifndef HOOT_FULL_VERSION # define HOOT_FULL_VERSION "Hootenanny @HOOT_VERSION@" #endif +#ifndef HOOT_DATE +# define HOOT_DATE "@HOOT_DATE@" +#endif #ifndef HOOT_BUILT_BY # define HOOT_BUILT_BY "@HOOT_BUILT_BY@" #endif diff --git a/hoot-services/src/main/java/hoot/services/controllers/info/AboutResource.java b/hoot-services/src/main/java/hoot/services/controllers/info/AboutResource.java index 54cedf4b06..7975f2fd08 100644 --- a/hoot-services/src/main/java/hoot/services/controllers/info/AboutResource.java +++ b/hoot-services/src/main/java/hoot/services/controllers/info/AboutResource.java @@ -22,7 +22,7 @@ * This will properly maintain the copyright information. Maxar * copyrights will be updated automatically. * - * @copyright Copyright (C) 2015, 2016, 2017, 2021 Maxar (http://www.maxar.com/) + * @copyright Copyright (C) 2015-2023 Maxar (http://www.maxar.com/) */ package hoot.services.controllers.info; @@ -72,6 +72,7 @@ public VersionInfo getServicesVersionInfo() { versionInfo = new VersionInfo(); versionInfo.setName(buildInfo.getProperty("name")); versionInfo.setVersion(buildInfo.getProperty("version")); + versionInfo.setDate(buildInfo.getProperty("date")); versionInfo.setBuiltBy(buildInfo.getProperty("user")); } catch (Exception e) { @@ -100,9 +101,10 @@ public VersionInfo getCoreVersionInfo() { String versionStr = this.getCoreInfo(false); String[] versionInfoParts = versionStr.split(" "); versionInfo = new VersionInfo(); - versionInfo.setName("Hootenanny Core"); + versionInfo.setName("Core"); versionInfo.setVersion(versionInfoParts[1]); - versionInfo.setBuiltBy(versionInfoParts[4]); + versionInfo.setDate(versionInfoParts[2]); + versionInfo.setBuiltBy(versionInfoParts[5]); } catch (Exception e) { String msg = "Error retrieving core version info! Cause: " + e.getMessage(); @@ -161,6 +163,7 @@ private static Properties getBuildInfo() { buildInfo = new Properties(); buildInfo.setProperty("name", "unknown"); buildInfo.setProperty("version", "unknown"); + buildInfo.setProperty("date", "unknown"); buildInfo.setProperty("user", "unknown"); } @@ -174,7 +177,7 @@ private static String parseCoreVersionOutOf(String text, boolean withDetails) { String[] lines = text.split("\\r?\\n"); for (int i = 0; i < lines.length; i++) { String line = lines[i].trim(); - if (line.startsWith("Hootenanny") && line.contains("Built By:")) { + if (line.startsWith("Hootenanny") && line.contains("built by")) { coreVersion = line; if (withDetails) { if ((i + 1) < lines.length) { diff --git a/hoot-services/src/main/java/hoot/services/controllers/info/VersionInfo.java b/hoot-services/src/main/java/hoot/services/controllers/info/VersionInfo.java index d0cf749161..a80d398e0b 100644 --- a/hoot-services/src/main/java/hoot/services/controllers/info/VersionInfo.java +++ b/hoot-services/src/main/java/hoot/services/controllers/info/VersionInfo.java @@ -22,7 +22,7 @@ * This will properly maintain the copyright information. Maxar * copyrights will be updated automatically. * - * @copyright Copyright (C) 2016, 2017, 2021 Maxar (http://www.maxar.com/) + * @copyright Copyright (C) 2016-2023 Maxar (http://www.maxar.com/) */ package hoot.services.controllers.info; @@ -33,6 +33,7 @@ public class VersionInfo { private String name; private String version; + private String date; private String builtBy; public VersionInfo() { @@ -54,6 +55,14 @@ public void setVersion(String version) { this.version = version; } + public String getDate() { + return date; + } + + public void setDate(String date) { + this.date = date; + } + public String getBuiltBy() { return builtBy; } @@ -66,6 +75,7 @@ public void setBuiltBy(String builtBy) { public String toString() { return "Name: " + name + System.lineSeparator() + "Version: " + version + System.lineSeparator() + + "Date: " + date + System.lineSeparator() + "Built By: " + builtBy; } } diff --git a/hoot-services/src/test/java/hoot/services/controllers/info/AboutResourceTest.java b/hoot-services/src/test/java/hoot/services/controllers/info/AboutResourceTest.java index 9657caa4a2..e7b0c406f3 100644 --- a/hoot-services/src/test/java/hoot/services/controllers/info/AboutResourceTest.java +++ b/hoot-services/src/test/java/hoot/services/controllers/info/AboutResourceTest.java @@ -22,7 +22,7 @@ * This will properly maintain the copyright information. Maxar * copyrights will be updated automatically. * - * @copyright Copyright (C) 2015, 2016, 2017, 2021 Maxar (http://www.maxar.com/) + * @copyright Copyright (C) 2015-2023 Maxar (http://www.maxar.com/) */ package hoot.services.controllers.info; @@ -132,20 +132,20 @@ public void testCoreVersionParser() throws Exception { privateMethod.setAccessible(true); String returnValue = (String) privateMethod.invoke(aboutResource, - "Hootenanny 0.2.23_1036_ga13f8a9_dirty Built By: vagrant", false); - assertEquals("Hootenanny 0.2.23_1036_ga13f8a9_dirty Built By: vagrant", returnValue); + "Hootenanny 0.2.23_1036_ga13f8a9_dirty built by vagrant", false); + assertEquals("Hootenanny 0.2.23_1036_ga13f8a9_dirty built by vagrant", returnValue); returnValue = (String) privateMethod.invoke(aboutResource, "This is just a line" + System.lineSeparator() + - "Hootenanny 0.2.23_1036_ga13f8a9_dirty Built By: vagrant", true); - assertEquals("Hootenanny 0.2.23_1036_ga13f8a9_dirty Built By: vagrant", returnValue); + "Hootenanny 0.2.23_1036_ga13f8a9_dirty built by vagrant", true); + assertEquals("Hootenanny 0.2.23_1036_ga13f8a9_dirty built by vagrant", returnValue); returnValue = (String) privateMethod.invoke(aboutResource, "14:27:08.974 WARN ...rc/main/cpp/hoot/core/Hoot.cpp( 135) " + System.lineSeparator() + " " + "Cannot load library HootHadoop: (libhdfs.so.0: cannot open shared object file: No such file or directory)" + System.lineSeparator() + - "Hootenanny 0.2.23_1036_ga13f8a9_dirty Built By: vagrant", + "Hootenanny 0.2.23_1036_ga13f8a9_dirty built by vagrant", true); - assertEquals("Hootenanny 0.2.23_1036_ga13f8a9_dirty Built By: vagrant", returnValue); + assertEquals("Hootenanny 0.2.23_1036_ga13f8a9_dirty built by vagrant", returnValue); returnValue = (String) privateMethod.invoke(aboutResource, "14:27:08.974 WARN ...rc/main/cpp/hoot/core/Hoot.cpp( 135) " + System.lineSeparator() + " " diff --git a/scripts/GenerateBuildInfoFiles.sh b/scripts/GenerateBuildInfoFiles.sh index 608cdbadd1..7679fe3ec7 100755 --- a/scripts/GenerateBuildInfoFiles.sh +++ b/scripts/GenerateBuildInfoFiles.sh @@ -3,8 +3,11 @@ HOOT_VERSION=`cat ../HOOT_VERSION_FILE | grep "HOOT_VERSION" | awk '{print $3;}'` #echo "HOOT_VERSION: " $HOOT_VERSION #echo "USER: " $USER +HOOT_VERSION_DATE=`cat ../HOOT_VERSION_FILE | grep "HOOT_DATE" | awk '{print $3;}'` +HOOT_BUILT_BY=`cat ../HOOT_VERSION_FILE | grep "HOOT_BUILT_BY" | awk '{print $3;}'` SERVICES_BUILD_INFO_FILE=./src/main/resources/build.info -echo "name=Hootenanny Web Services" > $SERVICES_BUILD_INFO_FILE +echo "name=Services" > $SERVICES_BUILD_INFO_FILE echo "version="$HOOT_VERSION >> $SERVICES_BUILD_INFO_FILE -echo "user="$USER >> $SERVICES_BUILD_INFO_FILE +echo "date="$HOOT_VERSION_DATE >> $SERVICES_BUILD_INFO_FILE +echo "user="$HOOT_BUILT_BY >> $SERVICES_BUILD_INFO_FILE