From bcd955fd2fd5aea172af6c0fb4e3dd43ac7afa67 Mon Sep 17 00:00:00 2001 From: Archit Gupta Date: Mon, 2 Dec 2024 14:16:37 -0800 Subject: [PATCH] Add version number --- CMakeLists.txt | 4 ++++ fleet-provisioning/bin/fleet-provisioning.c | 4 ++++ ggconfigd/bin/ggconfigd.c | 4 ++++ ggdeploymentd/bin/ggdeploymentd.c | 4 ++++ gghealthd/bin/gghealthd.c | 4 ++++ ggipcd/bin/ggipcd.c | 4 ++++ ggl-cli/bin/ggl-cli.c | 4 ++++ ggl-config-init/bin/ggl-config-init.c | 4 ++++ ggl-lib/include/ggl/version.h | 14 ++++++++++++++ ggpubsubd/bin/ggpubsubd.c | 4 ++++ iotcored/bin/iotcored.c | 4 ++++ recipe-runner/bin/recipe-runner.c | 4 ++++ recipe-runner/src/runner.c | 3 ++- version | 1 + 14 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 ggl-lib/include/ggl/version.h create mode 100644 version diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e1a5e26d..6e5a6a687 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -184,6 +184,10 @@ if(GGL_IPC_AUTH_DISABLE) add_compile_definitions(GGL_IPC_AUTH_DISABLE) endif() +file(READ version GGL_VERSION) +string(STRIP "${GGL_VERSION}" GGL_VERSION) +add_compile_definitions("GGL_VERSION=\"${GGL_VERSION}\"") + add_link_options($<$>:-pie>) add_link_options( diff --git a/fleet-provisioning/bin/fleet-provisioning.c b/fleet-provisioning/bin/fleet-provisioning.c index edfa11ad5..98358b020 100644 --- a/fleet-provisioning/bin/fleet-provisioning.c +++ b/fleet-provisioning/bin/fleet-provisioning.c @@ -6,8 +6,12 @@ #include #include #include +#include #include +__attribute__((visibility("default"))) const char *argp_program_version + = GGL_VERSION; + static char doc[] = "fleet provisioner -- Executable to automatically " "provision the device to AWS IOT core"; static const char COMPONENT_NAME[] = "fleet-provisioning"; diff --git a/ggconfigd/bin/ggconfigd.c b/ggconfigd/bin/ggconfigd.c index c7362ce98..d4effac3d 100644 --- a/ggconfigd/bin/ggconfigd.c +++ b/ggconfigd/bin/ggconfigd.c @@ -6,8 +6,12 @@ #include #include #include +#include #include +__attribute__((visibility("default"))) const char *argp_program_version + = GGL_VERSION; + static char doc[] = "ggconfigd -- Greengrass Nucleus Lite configuration daemon"; static struct argp_option opts[] = { diff --git a/ggdeploymentd/bin/ggdeploymentd.c b/ggdeploymentd/bin/ggdeploymentd.c index 68f6c3f46..e16e8fbed 100644 --- a/ggdeploymentd/bin/ggdeploymentd.c +++ b/ggdeploymentd/bin/ggdeploymentd.c @@ -7,10 +7,14 @@ #include #include #include +#include #include #include #include +__attribute__((visibility("default"))) const char *argp_program_version + = GGL_VERSION; + static char doc[] = "ggdeploymentd -- Greengrass Nucleus Lite deployment daemon"; diff --git a/gghealthd/bin/gghealthd.c b/gghealthd/bin/gghealthd.c index 6a6530b44..8da0f4033 100644 --- a/gghealthd/bin/gghealthd.c +++ b/gghealthd/bin/gghealthd.c @@ -4,6 +4,10 @@ #include "bus_server.h" #include +#include + +__attribute__((visibility("default"))) const char *argp_program_version + = GGL_VERSION; int main(void) { GglError ret = run_gghealthd(); diff --git a/ggipcd/bin/ggipcd.c b/ggipcd/bin/ggipcd.c index 8b3ed325e..384af049c 100644 --- a/ggipcd/bin/ggipcd.c +++ b/ggipcd/bin/ggipcd.c @@ -5,6 +5,10 @@ #include "ggipcd.h" #include #include +#include + +__attribute__((visibility("default"))) const char *argp_program_version + = GGL_VERSION; static char doc[] = "ggipcd -- Greengrass IPC server for Nucleus Lite"; diff --git a/ggl-cli/bin/ggl-cli.c b/ggl-cli/bin/ggl-cli.c index 5904e0e6f..d09244fc5 100644 --- a/ggl-cli/bin/ggl-cli.c +++ b/ggl-cli/bin/ggl-cli.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -19,6 +20,9 @@ #include #include +__attribute__((visibility("default"))) const char *argp_program_version + = GGL_VERSION; + char *command = NULL; char *recipe_dir = NULL; char *artifacts_dir = NULL; diff --git a/ggl-config-init/bin/ggl-config-init.c b/ggl-config-init/bin/ggl-config-init.c index 3af401444..6d15d16f7 100644 --- a/ggl-config-init/bin/ggl-config-init.c +++ b/ggl-config-init/bin/ggl-config-init.c @@ -10,10 +10,14 @@ #include #include #include +#include #include #include #include +__attribute__((visibility("default"))) const char *argp_program_version + = GGL_VERSION; + static char *config_path = NULL; static char doc[] diff --git a/ggl-lib/include/ggl/version.h b/ggl-lib/include/ggl/version.h new file mode 100644 index 000000000..73552522c --- /dev/null +++ b/ggl-lib/include/ggl/version.h @@ -0,0 +1,14 @@ +// aws-greengrass-lite - AWS IoT Greengrass runtime for constrained devices +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +#ifndef GGL_VERSION_H +#define GGL_VERSION_H + +//! Greengrass Lite version number + +#ifndef GGL_VERSION +#define GGL_VERSION "0.0.0" +#endif + +#endif diff --git a/ggpubsubd/bin/ggpubsubd.c b/ggpubsubd/bin/ggpubsubd.c index b6704c4c2..156763fe9 100644 --- a/ggpubsubd/bin/ggpubsubd.c +++ b/ggpubsubd/bin/ggpubsubd.c @@ -5,8 +5,12 @@ #include "ggpubsubd.h" #include #include +#include #include +__attribute__((visibility("default"))) const char *argp_program_version + = GGL_VERSION; + static char doc[] = "ggpubsubd -- Greengrass Publish/Subscribe daemon"; static struct argp_option opts[] = { diff --git a/iotcored/bin/iotcored.c b/iotcored/bin/iotcored.c index 9f3ad4174..13c56cc10 100644 --- a/iotcored/bin/iotcored.c +++ b/iotcored/bin/iotcored.c @@ -5,6 +5,10 @@ #include "iotcored.h" #include #include +#include + +__attribute__((visibility("default"))) const char *argp_program_version + = GGL_VERSION; static char doc[] = "iotcored -- MQTT spooler for AWS IoT Core"; diff --git a/recipe-runner/bin/recipe-runner.c b/recipe-runner/bin/recipe-runner.c index 5119c3297..c99b88d69 100644 --- a/recipe-runner/bin/recipe-runner.c +++ b/recipe-runner/bin/recipe-runner.c @@ -5,8 +5,12 @@ #include "recipe-runner.h" #include #include +#include #include +__attribute__((visibility("default"))) const char *argp_program_version + = GGL_VERSION; + static char doc[] = "recipe-runner -- Launch a Greengrass recipe file"; static struct argp_option opts[] = { diff --git a/recipe-runner/src/runner.c b/recipe-runner/src/runner.c index fda02a792..f0f61e6f0 100644 --- a/recipe-runner/src/runner.c +++ b/recipe-runner/src/runner.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -419,7 +420,7 @@ GglError runner(const RecipeRunnerArgs *args) { } } - sys_ret = setenv("GGC_VERSION", "0.0.1", true); + sys_ret = setenv("GGC_VERSION", GGL_VERSION, true); if (sys_ret != 0) { GGL_LOGE("setenv failed: %d.", errno); } diff --git a/version b/version new file mode 100644 index 000000000..6e8bf73aa --- /dev/null +++ b/version @@ -0,0 +1 @@ +0.1.0