Skip to content

Commit 58e23bf

Browse files
authored
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
1 parent 575dc38 commit 58e23bf

6 files changed

Lines changed: 31 additions & 14 deletions

File tree

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ EXTRA_LIB_DEPS=$(INCDIR)/api.h $(PATCHED_SDK)
5353
########## Nothing below this line should be edited by typical users ###########
5454
-include ./common.mk
5555

56-
.PHONY: $(INCDIR)/api.h patch_sdk_headers clean
57-
$(INCDIR)/api.h: version.py
56+
.PHONY: $(INCDIR)/pros/version.h patch_sdk_headers clean
57+
$(INCDIR)/pros/version.h: version.py
5858
$(VV)python version.py
5959

6060
patch_sdk_headers: patch_headers.py
6161
@echo "Patching SDK headers"
6262
$(VV)python patch_headers.py
6363

6464
# Override clean, necessary to remove patched sdk on clean
65-
clean:
65+
clean::
6666
@echo "Cleaning patched SDK"
6767
@rm -f $(PATCHED_SDK)
6868
@rm -rf $(EXTRA_INCDIR)

common.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ quick: $(DEFAULT_BIN)
188188

189189
all: clean $(DEFAULT_BIN)
190190

191-
clean:
191+
clean::
192192
@echo Cleaning project
193193
-$Drm -rf $(BINDIR)
194194
-$Drm -rf $(DEPDIR)
@@ -262,7 +262,7 @@ $(foreach asmext,$(ASMEXTS),$(eval $(call asm_rule,$(asmext))))
262262

263263
define c_rule
264264
$(BINDIR)/%.$1.o: $(SRCDIR)/%.$1
265-
$(BINDIR)/%.$1.o: $(SRCDIR)/%.$1 $(DEPDIR)/$(basename $1).d
265+
$(BINDIR)/%.$1.o: $(SRCDIR)/%.$1 $(DEPDIR)/$(basename %).d
266266
$(VV)mkdir -p $$(dir $$@)
267267
$(MAKEDEPFOLDER)
268268
$$(call test_output_2,Compiled $$< ,$(CC) -c $(INCLUDE) -iquote"$(INCDIR)/$$(dir $$*)" $(CFLAGS) $(EXTRA_CFLAGS) $(DEPFLAGS) -o $$@ $$<,$(OK_STRING))

include/api.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,6 @@
3939
#include <unistd.h>
4040
#endif /* __cplusplus */
4141

42-
#define PROS_VERSION_MAJOR 4
43-
#define PROS_VERSION_MINOR 1
44-
45-
#define PROS_VERSION_PATCH 0
46-
#define PROS_VERSION_STRING "4.1.0"
47-
48-
4942
#include "pros/adi.h"
5043
#include "pros/colors.h"
5144
#include "pros/device.h"

include/pros/version.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* \file version.h
3+
*
4+
* PROS Version Information
5+
*
6+
* Contains PROS kernel version information
7+
*
8+
*
9+
* \copyright Copyright (c) 2017-2023, Purdue University ACM SIGBots.
10+
* All rights reserved.
11+
*
12+
* This Source Code Form is subject to the terms of the Mozilla Public
13+
* License, v. 2.0. If a copy of the MPL was not distributed with this
14+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
15+
*/
16+
17+
#pragma once
18+
19+
#define PROS_VERSION_MAJOR 4
20+
#define PROS_VERSION_MINOR 1
21+
22+
#define PROS_VERSION_PATCH 0
23+
#define PROS_VERSION_STRING "4.1.0"

src/system/dev/ser_daemon.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <errno.h>
1919

2020
#include "kapi.h"
21+
#include "pros/version.h"
2122
#include "system/dev/banners.h"
2223
#include "system/hot.h"
2324
#include "system/optimizers.h"

version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
assert semver.count('.') >= 2
2929
major, minor, patch = semver.split('.', 2)
3030
patch = patch.split('-', 1)[0]
31-
with io.open('include/api.h', 'r', encoding='ascii') as file:
31+
with io.open('include/pros/version.h', 'r', encoding='ascii') as file:
3232
data = file.readlines()
3333
for i, line in enumerate(data):
3434
if '#define PROS_VERSION_MAJOR' in line:
@@ -39,7 +39,7 @@
3939
data[i] = u'#define PROS_VERSION_PATCH {}\n'.format(patch)
4040
if '#define PROS_VERSION_STRING ' in line:
4141
data[i] = u'#define PROS_VERSION_STRING "{}"\n'.format(semver)
42-
with io.open('include/api.h', 'w', newline='\n', encoding='ascii') as file:
42+
with io.open('include/pros/version.h', 'w', newline='\n', encoding='ascii') as file:
4343
file.writelines(data)
4444

4545
except subprocess.CalledProcessError as e:

0 commit comments

Comments
 (0)