Skip to content

Commit

Permalink
Added build board to debug rest endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieucarbou committed Jan 6, 2025
1 parent fe21a39 commit 4245797
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
3 changes: 3 additions & 0 deletions lib/MycilaAppInfo/MycilaAppInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ extern const char* __COMPILED_BUILD_BRANCH__;
extern const char* __COMPILED_BUILD_HASH__;
extern const char* __COMPILED_BUILD_NAME__;
extern const char* __COMPILED_BUILD_TIMESTAMP__;
extern const char* __COMPILED_BUILD_BOARD__;

Mycila::AppInfoClass::AppInfoClass() : id(Mycila::System::getChipIDStr()),
name(APP_NAME),
Expand All @@ -46,13 +47,15 @@ Mycila::AppInfoClass::AppInfoClass() : id(Mycila::System::getChipIDStr()),
buildBranch(__COMPILED_BUILD_BRANCH__),
buildHash(__COMPILED_BUILD_HASH__),
buildDate(__COMPILED_BUILD_TIMESTAMP__),
buildBoard(__COMPILED_BUILD_BOARD__),
defaultHostname(Mycila::string::toLowerCase(name + "-" + id)),
defaultMqttClientId(Mycila::string::toLowerCase(name + "_" + id)),
defaultSSID(name + "-" + id),
debug(firmware.find("debug") != std::string::npos),
trial(firmware.find("trial") != std::string::npos) {}

void Mycila::AppInfoClass::toJson(const JsonObject& root) const {
root["build_board"] = buildBoard;
root["build_date"] = buildDate;
root["build_hash"] = buildHash;
root["debug"] = debug;
Expand Down
1 change: 1 addition & 0 deletions lib/MycilaAppInfo/MycilaAppInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace Mycila {
const std::string buildBranch;
const std::string buildHash;
const std::string buildDate;
const std::string buildBoard;
const std::string defaultHostname;
const std::string defaultMqttClientId;
const std::string defaultSSID;
Expand Down
14 changes: 5 additions & 9 deletions tools/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@

def do_main():
# hash
ret = subprocess.run(
["git", "rev-parse", "HEAD"], stdout=subprocess.PIPE, text=True, check=False
) # Uses any tags
ret = subprocess.run(["git", "rev-parse", "HEAD"], stdout=subprocess.PIPE, text=True, check=False) # Uses any tags
full_hash = ret.stdout.strip()
short_hash = full_hash[:7]

Expand Down Expand Up @@ -66,16 +64,14 @@ def do_main():
f'const char* __COMPILED_BUILD_HASH__ = "{short_hash}";\n'
f'const char* __COMPILED_BUILD_NAME__ = "{env["PIOENV"]}";\n'
f'const char* __COMPILED_BUILD_TIMESTAMP__ = "{datetime.now(timezone.utc).isoformat()}";\n'
f'const char* __COMPILED_BUILD_BOARD__ = "{env.get("BOARD")}";\n'
)
sys.stderr.write(
f"version.py: APP_VERSION: {version[1:] if tagPattern.match(version) else version}\n"
)
sys.stderr.write(f"version.py: APP_VERSION: {version[1:] if tagPattern.match(version) else version}\n")
sys.stderr.write(f"version.py: BUILD_BRANCH: {branch}\n")
sys.stderr.write(f"version.py: BUILD_HASH: {short_hash}\n")
sys.stderr.write(f"version.py: BUILD_NAME: {env['PIOENV']}\n")
sys.stderr.write(
f"version.py: BUILD_TIMESTAMP: {datetime.now(timezone.utc).isoformat()}\n"
)
sys.stderr.write(f"version.py: BUILD_TIMESTAMP: {datetime.now(timezone.utc).isoformat()}\n")
sys.stderr.write(f"version.py: BUILD_BOARD: {env.get('BOARD')}\n")

env.AppendUnique(PIOBUILDFILES=[constantFile])

Expand Down

0 comments on commit 4245797

Please sign in to comment.