summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Lorenz <jlorenz@de.adit-jv.com>2018-02-12 17:45:56 +0100
committerJens Lorenz <jlorenz@de.adit-jv.com>2018-02-13 11:05:45 +0100
commit5b8411277e44e92eea3b8e9469af003415c02a6f (patch)
tree1ef22847112e596d79de199ce5de1c500c86f8cd
parenta4e8cdcef0ebf57b23ea6676a54c39e256e906eb (diff)
downloadaudiomanager-5b8411277e44e92eea3b8e9469af003415c02a6f.tar.gz
CMake: Implement VCS agnostic versioning
Versioning should not strictly depend on Version Control System (e.g. git). Best approach is to have a dedicated VERSION file exposing with format <Major>.<Minor>.<Revision>. Target is that maintainer will manually release the version once patches/fixes are merged e.g. to a stabilization branch. In order to have an OEM specific meta information exposed with the version information EXTRAVERSIONINFO can be specified by CMAKE flag. Signed-off-by: Guerra Mattia <mguerra@de.adit-jv.com>
-rwxr-xr-xAudioManagerDaemon/src/main.cpp28
-rwxr-xr-xCMakeLists.txt4
-rw-r--r--VERSION1
-rw-r--r--cmake/MacroVersionFromGit.cmake55
-rw-r--r--cmake/config.cmake.in1
-rw-r--r--docx/02_y_versioning.dox2
6 files changed, 30 insertions, 61 deletions
diff --git a/AudioManagerDaemon/src/main.cpp b/AudioManagerDaemon/src/main.cpp
index 8271db4..171d6ef 100755
--- a/AudioManagerDaemon/src/main.cpp
+++ b/AudioManagerDaemon/src/main.cpp
@@ -162,7 +162,7 @@ void daemonize()
void printCmdInformation()
{
printf("\n\n\nCurrent settings:\n\n");
- printf("\tAudioManagerDaemon Version:\t\t%s\n", DAEMONVERSION);
+ printf("\tAudioManagerDaemon Version:\t\t%s\n", DAEMONVERSION EXTRAVERSIONINFO);
printf("\tControllerPlugin: \t\t\t%s\n", controllerPlugin.getValue().c_str());
printf("\tDirectories of CommandPlugins: \t\t\n");
std::vector<std::string>::const_iterator dirIter = listCommandPluginDirs.begin();
@@ -219,19 +219,19 @@ void mainProgram(int argc, char *argv[])
//initialize the commandline parser, and add all neccessary commands
try
{
- TCLAP::CmdLine* cmd(CAmCommandLineSingleton::instanciateOnce("The team of the AudioManager wishes you a nice day!",' ',DAEMONVERSION,true));
- cmd->add(controllerPlugin);
- cmd->add(additionalCommandPluginDirs);
- cmd->add(commandPluginDir);
- cmd->add(additionalRoutingPluginDirs);
- cmd->add(routingPluginDir);
- cmd->add(currentSettings);
- cmd->add(daemonizeAM);
- cmd->add(dltEnable);
- cmd->add(dltLogFilename);
- cmd->add(dltOutput);
+ TCLAP::CmdLine* cmd(CAmCommandLineSingleton::instanciateOnce("The team of the AudioManager wishes you a nice day!",' ', DAEMONVERSION EXTRAVERSIONINFO,true));
+ cmd->add(controllerPlugin);
+ cmd->add(additionalCommandPluginDirs);
+ cmd->add(commandPluginDir);
+ cmd->add(additionalRoutingPluginDirs);
+ cmd->add(routingPluginDir);
+ cmd->add(currentSettings);
+ cmd->add(daemonizeAM);
+ cmd->add(dltEnable);
+ cmd->add(dltLogFilename);
+ cmd->add(dltOutput);
#ifdef WITH_DBUS_WRAPPER
- cmd->add(dbusWrapperTypeBool);
+ cmd->add(dbusWrapperTypeBool);
#endif
}
catch (TCLAP::ArgException &e) // catch any exceptions
@@ -330,7 +330,7 @@ void mainProgram(int argc, char *argv[])
{ std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl; }
logInfo("The Audiomanager is started");
- logInfo("The version of the Audiomanager", DAEMONVERSION);
+ logInfo("The version of the Audiomanager", DAEMONVERSION EXTRAVERSIONINFO);
#ifdef WITH_CAPI_WRAPPER
//We instantiate a singleton with the current socket handler, which loads the common-api runtime.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 38d1a68..7e3bddb 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,6 +24,10 @@ include ( MacroInterfaceVersions )
project(AudioManager LANGUAGES C CXX VERSION ${DAEMONVERSION})
+IF (NOT EXTRAVERSIONINFO)
+ ADD_DEFINITIONS(-DEXTRAVERSIONINFO="")
+ENDIF (NOT EXTRAVERSIONINFO)
+
include ( CMakeDependentOption )
include ( CMakePackageConfigHelpers )
include ( GNUInstallDirs )
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..9e707b9
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+7.6.6 \ No newline at end of file
diff --git a/cmake/MacroVersionFromGit.cmake b/cmake/MacroVersionFromGit.cmake
index 94931c6..fca7bdc 100644
--- a/cmake/MacroVersionFromGit.cmake
+++ b/cmake/MacroVersionFromGit.cmake
@@ -1,50 +1,11 @@
-# get the current git version
-execute_process(COMMAND git tag
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- OUTPUT_VARIABLE TAG_LIST
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-IF (TAG_LIST AND NOT VERSION)
- STRING (REPLACE "\n" ";" TAG_LIST ${TAG_LIST})
-
- set (VERSION_LIST)
-
- foreach (element ${TAG_LIST})
- STRING (REGEX MATCH "^[0-9]+\\.." SINGLE_VERSION ${element})
- LIST (APPEND VERSION_LIST ${SINGLE_VERSION})
- endforeach (element)
-
- LIST (REVERSE VERSION_LIST)
-
- LIST (GET VERSION_LIST 0 VERSION_MISSING_MINOR)
-
- execute_process(COMMAND git --no-pager log --pretty=oneline HEAD...${VERSION_MISSING_MINOR}
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- OUTPUT_VARIABLE COMMIT_LIST
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-
- IF (COMMIT_LIST)
- STRING (REPLACE "\n" ";" COMMIT_LIST ${COMMIT_LIST})
-
- LIST (LENGTH COMMIT_LIST MINOR_VERSION)
-
- SET (DAEMONVERSION "${VERSION_MISSING_MINOR}.${MINOR_VERSION}")
- ENDIF (COMMIT_LIST)
-ENDIF (TAGLIST AND NOT VERSION)
-
-if (NOT DAEMONVERSION)
- #Can be changed via passing -DVERSION="XXX" to cmake
- if(NOT DEFINED VERSION)
- set( DAEMONVERSION "homebrew-${CMAKE_SOURCE_DIR}" )
- else (NOT DEFINED VERSION)
- set( DAEMONVERSION "${VERSION}" )
- endif(NOT DEFINED VERSION)
-else (NOT DAEMONVERSION)
- STRING(REGEX REPLACE "(-)[^-]+$" "" DAEMONVERSION ${DAEMONVERSION})
- STRING(REGEX REPLACE "-" "." DAEMONVERSION ${DAEMONVERSION})
-endif(NOT DAEMONVERSION)
-
-message(STATUS "Build Version ${DAEMONVERSION}")
+#Can be changed via passing -DVERSION="XXX" to cmake
+if (NOT DEFINED VERSION)
+ FILE(READ "VERSION" DAEMONVERSION)
+else (NOT DEFINED VERSION)
+ set (DAEMONVERSION "${VERSION}")
+endif (NOT DEFINED VERSION)
+
+message(STATUS "Build Version ${DAEMONVERSION}${EXTRAVERSIONINFO}")
execute_process(COMMAND git log --pretty=short WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/CHANGELOG)
diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in
index 1501393..2d2d3df 100644
--- a/cmake/config.cmake.in
+++ b/cmake/config.cmake.in
@@ -2,6 +2,7 @@
#define _CONFIG_H
#cmakedefine DAEMONVERSION "@DAEMONVERSION@"
+#cmakedefine EXTRAVERSIONINFO "@EXTRAVERSIONINFO@"
#cmakedefine WITH_CAPI_WRAPPER
#cmakedefine WITH_DBUS_WRAPPER
diff --git a/docx/02_y_versioning.dox b/docx/02_y_versioning.dox
index 864a04e..c30e6bd 100644
--- a/docx/02_y_versioning.dox
+++ b/docx/02_y_versioning.dox
@@ -17,6 +17,8 @@
/*!
\page ver Versioning
+\section mec_ver Versioning Mechanism
+Versioning should not strictly depend on Version Control System (e.g. git) information. Best approach is to have a dedicated resource exposing the Version of the project. This is achieved via the \c VERSION file in the main folder of the AudioManager, which content is read by CMake and used in the whole component. Optionally, the flag \c EXTRAVERSIONINFO can be used to append additional information to the version. \c VERSION is reporting with the format <\c Major>.<\c Minor>.<\c Revision>. Maintainer of the component should take care of keeping the information aligned with release cycle. \c Revision should be maintained once patches/fixes are merged to a stabilization branch.
\section new_ver New versioning scheme
Due to the unclearness in the versioning scheme, the versioning scheme changed with release 7.0.
Beginning with the 7.0 version, the versioning changed to the semantic versioning described here: <a href="http://semver.org/">http://semver.org/</a>.