Skip to content

Commit

Permalink
Fix #94, updating sample_lib to use new versioning system.
Browse files Browse the repository at this point in the history
  • Loading branch information
dzbaker committed Dec 26, 2023
1 parent 2dc2845 commit a56e2cf
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
9 changes: 8 additions & 1 deletion fsw/src/sample_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "sample_lib_version.h"
#include "sample_lib_internal.h"

#include "cfe_config.h"

/* for "strncpy()" */
#include <string.h>

Expand All @@ -43,6 +45,8 @@ char SAMPLE_LIB_Buffer[SAMPLE_LIB_BUFFER_SIZE];
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32 SAMPLE_LIB_Init(void)
{
char VersionString[SAMPLE_LIB_CFG_MAX_VERSION_STR_LEN];

/*
* Call a C library function, like strcpy(), and test its result.
*
Expand All @@ -61,7 +65,10 @@ int32 SAMPLE_LIB_Init(void)
/* ensure termination */
SAMPLE_LIB_Buffer[sizeof(SAMPLE_LIB_Buffer) - 1] = 0;

OS_printf("SAMPLE Lib Initialized.%s\n", SAMPLE_LIB_VERSION_STRING);
CFE_Config_GetVersionString(VersionString, SAMPLE_LIB_CFG_MAX_VERSION_STR_LEN, "Sample Lib",
SAMPLE_LIB_BUILD_TYPE, SAMPLE_LIB_VERSION, SAMPLE_LIB_BUILD_CODENAME, SAMPLE_LIB_LAST_OFFICIAL);

OS_printf("SAMPLE Lib Initialized.%s\n", VersionString);

return CFE_SUCCESS;
}
Expand Down
27 changes: 17 additions & 10 deletions fsw/src/sample_lib_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@

/* Development Build Macro Definitions */

#define SAMPLE_LIB_BUILD_NUMBER 32 /*!< Development Build: Number of commits since baseline */
#define SAMPLE_LIB_BUILD_BASELINE \
"v1.3.0-rc4" /*!< Development Build: git tag that is the base for the current development */
#define SAMPLE_LIB_BUILD_NUMBER 32 /*!< Development Build: Number of commits since baseline */
#define SAMPLE_LIB_BUILD_BASELINE "equuleus-rc1" /*!< Development Build: git tag that is the base for the current development */
#define SAMPLE_LIB_BUILD_DEV_CYCLE "equuleus-rc2" /**< @brief Development: Release name for current development cycle */
#define SAMPLE_LIB_BUILD_TYPE "Development Build" /**< @brief: Development: Type of build (Development Build or Release) */
#define SAMPLE_LIB_BUILD_CODENAME "Equuleus" /**< @brief: Development: Code name for the current build */

/*
* Version Macros, see \ref cfsversions for definitions.
Expand All @@ -37,6 +39,11 @@
#define SAMPLE_LIB_MINOR_VERSION 1 /*!< @brief Minor version number */
#define SAMPLE_LIB_REVISION 99 /*!< @brief Revision version number. Value of 99 indicates a development version.*/

/**
* @brief Last official release.
*/
#define SAMPLE_LIB_LAST_OFFICIAL "v1.1.0"

/*!
* @brief Mission revision.
*
Expand All @@ -51,7 +58,7 @@
* Values 1-254 are reserved for mission use to denote patches/customizations as needed. NOTE: Reserving 0 and 0xFF for
* cFS open-source development use (pending resolution of nasa/cFS#440)
*/
#define SAMPLE_LIB_MISSION_REV 0xFF
#define SAMPLE_LIB_MISSION_REV 0x00

#define SAMPLE_LIB_STR_HELPER(x) #x /*!< @brief Helper function to concatenate strings from integer macros */
#define SAMPLE_LIB_STR(x) \
Expand All @@ -63,13 +70,13 @@
*/
#define SAMPLE_LIB_VERSION SAMPLE_LIB_BUILD_BASELINE "+dev" SAMPLE_LIB_STR(SAMPLE_LIB_BUILD_NUMBER)

/*! @brief Development Build Version String.
* @details Reports the current development build's baseline, number, and name. Also includes a note about the latest
* official version. @n See @ref cfsversions for format differences between development and release versions.
/**
* @brief Max Version String length.
*
* Maximum length that a sample_lib version string can be.
*
*/
#define SAMPLE_LIB_VERSION_STRING \
" Sample Lib DEVELOPMENT BUILD " SAMPLE_LIB_VERSION \
", Last Official Release: v1.1.0" /* For full support please use this version */
#define SAMPLE_LIB_CFG_MAX_VERSION_STR_LEN 256

#endif /* SAMPLE_LIB_VERSION_H */

Expand Down

0 comments on commit a56e2cf

Please sign in to comment.