From 58e23bf8d10d9f368a9477eacc6e2bb0f92e3473 Mon Sep 17 00:00:00 2001 From: THERocky <101498190+Rocky14683@users.noreply.github.com> Date: Fri, 8 Nov 2024 19:22:50 -0500 Subject: [PATCH] Move version info (#709) * move version information * update scripts and makefiles * add version.h to main.h * fix bugs on windows and linux * move version.h to pros folder * update header comments --- Makefile | 6 +++--- common.mk | 4 ++-- include/api.h | 7 ------- include/pros/version.h | 23 +++++++++++++++++++++++ src/system/dev/ser_daemon.c | 1 + version.py | 4 ++-- 6 files changed, 31 insertions(+), 14 deletions(-) create mode 100644 include/pros/version.h diff --git a/Makefile b/Makefile index 2b445b42f..b4ef4146e 100644 --- a/Makefile +++ b/Makefile @@ -53,8 +53,8 @@ EXTRA_LIB_DEPS=$(INCDIR)/api.h $(PATCHED_SDK) ########## Nothing below this line should be edited by typical users ########### -include ./common.mk -.PHONY: $(INCDIR)/api.h patch_sdk_headers clean -$(INCDIR)/api.h: version.py +.PHONY: $(INCDIR)/pros/version.h patch_sdk_headers clean +$(INCDIR)/pros/version.h: version.py $(VV)python version.py patch_sdk_headers: patch_headers.py @@ -62,7 +62,7 @@ patch_sdk_headers: patch_headers.py $(VV)python patch_headers.py # Override clean, necessary to remove patched sdk on clean -clean: +clean:: @echo "Cleaning patched SDK" @rm -f $(PATCHED_SDK) @rm -rf $(EXTRA_INCDIR) diff --git a/common.mk b/common.mk index 39bd7d956..edc623b43 100644 --- a/common.mk +++ b/common.mk @@ -188,7 +188,7 @@ quick: $(DEFAULT_BIN) all: clean $(DEFAULT_BIN) -clean: +clean:: @echo Cleaning project -$Drm -rf $(BINDIR) -$Drm -rf $(DEPDIR) @@ -262,7 +262,7 @@ $(foreach asmext,$(ASMEXTS),$(eval $(call asm_rule,$(asmext)))) define c_rule $(BINDIR)/%.$1.o: $(SRCDIR)/%.$1 -$(BINDIR)/%.$1.o: $(SRCDIR)/%.$1 $(DEPDIR)/$(basename $1).d +$(BINDIR)/%.$1.o: $(SRCDIR)/%.$1 $(DEPDIR)/$(basename %).d $(VV)mkdir -p $$(dir $$@) $(MAKEDEPFOLDER) $$(call test_output_2,Compiled $$< ,$(CC) -c $(INCLUDE) -iquote"$(INCDIR)/$$(dir $$*)" $(CFLAGS) $(EXTRA_CFLAGS) $(DEPFLAGS) -o $$@ $$<,$(OK_STRING)) diff --git a/include/api.h b/include/api.h index 57c248c78..ea328e334 100644 --- a/include/api.h +++ b/include/api.h @@ -39,13 +39,6 @@ #include #endif /* __cplusplus */ -#define PROS_VERSION_MAJOR 4 -#define PROS_VERSION_MINOR 1 - -#define PROS_VERSION_PATCH 0 -#define PROS_VERSION_STRING "4.1.0" - - #include "pros/adi.h" #include "pros/colors.h" #include "pros/device.h" diff --git a/include/pros/version.h b/include/pros/version.h new file mode 100644 index 000000000..453284f67 --- /dev/null +++ b/include/pros/version.h @@ -0,0 +1,23 @@ +/** +* \file version.h +* +* PROS Version Information +* +* Contains PROS kernel version information +* +* +* \copyright Copyright (c) 2017-2023, Purdue University ACM SIGBots. +* All rights reserved. +* +* This Source Code Form is subject to the terms of the Mozilla Public +* License, v. 2.0. If a copy of the MPL was not distributed with this +* file, You can obtain one at http://mozilla.org/MPL/2.0/. +*/ + +#pragma once + +#define PROS_VERSION_MAJOR 4 +#define PROS_VERSION_MINOR 1 + +#define PROS_VERSION_PATCH 0 +#define PROS_VERSION_STRING "4.1.0" \ No newline at end of file diff --git a/src/system/dev/ser_daemon.c b/src/system/dev/ser_daemon.c index d77fdee3f..86305d958 100644 --- a/src/system/dev/ser_daemon.c +++ b/src/system/dev/ser_daemon.c @@ -18,6 +18,7 @@ #include #include "kapi.h" +#include "pros/version.h" #include "system/dev/banners.h" #include "system/hot.h" #include "system/optimizers.h" diff --git a/version.py b/version.py index e818f25ec..7a275939a 100644 --- a/version.py +++ b/version.py @@ -28,7 +28,7 @@ assert semver.count('.') >= 2 major, minor, patch = semver.split('.', 2) patch = patch.split('-', 1)[0] - with io.open('include/api.h', 'r', encoding='ascii') as file: + with io.open('include/pros/version.h', 'r', encoding='ascii') as file: data = file.readlines() for i, line in enumerate(data): if '#define PROS_VERSION_MAJOR' in line: @@ -39,7 +39,7 @@ data[i] = u'#define PROS_VERSION_PATCH {}\n'.format(patch) if '#define PROS_VERSION_STRING ' in line: data[i] = u'#define PROS_VERSION_STRING "{}"\n'.format(semver) - with io.open('include/api.h', 'w', newline='\n', encoding='ascii') as file: + with io.open('include/pros/version.h', 'w', newline='\n', encoding='ascii') as file: file.writelines(data) except subprocess.CalledProcessError as e: