mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-02-27 19:57:07 +05:00
feat: added commit hash
This commit is contained in:
@@ -96,7 +96,8 @@ custom_component_remove = espressif/esp_hosted
|
||||
espressif/esp-zboss-lib
|
||||
espressif/esp-zigbee-lib
|
||||
chmorgan/esp-libhelix-mp3
|
||||
extra_scripts = post:tools/esp32.py
|
||||
extra_scripts = pre:tools/add_build_commit.py
|
||||
post:tools/esp32.py
|
||||
post:tools/build.py
|
||||
build_type = ${env.build_type}
|
||||
build_flags = ${env.build_flags}
|
||||
|
||||
@@ -552,6 +552,7 @@ protected:
|
||||
|
||||
auto docBuild = doc[FPSTR(S_BUILD)].to<JsonObject>();
|
||||
docBuild[FPSTR(S_VERSION)] = BUILD_VERSION;
|
||||
docBuild[FPSTR(S_COMMIT)] = BUILD_COMMIT;
|
||||
docBuild[FPSTR(S_DATE)] = __DATE__ " " __TIME__;
|
||||
docBuild[FPSTR(S_ENV)] = BUILD_ENV;
|
||||
docBuild[FPSTR(S_CORE)] = ESP.getCoreVersion();
|
||||
@@ -592,6 +593,7 @@ protected:
|
||||
|
||||
auto docBuild = doc[FPSTR(S_BUILD)].to<JsonObject>();
|
||||
docBuild[FPSTR(S_VERSION)] = BUILD_VERSION;
|
||||
docBuild[FPSTR(S_COMMIT)] = BUILD_COMMIT;
|
||||
docBuild[FPSTR(S_DATE)] = __DATE__ " " __TIME__;
|
||||
docBuild[FPSTR(S_ENV)] = BUILD_ENV;
|
||||
docBuild[FPSTR(S_CORE)] = ESP.getCoreVersion();
|
||||
|
||||
@@ -30,6 +30,10 @@
|
||||
#define BUILD_VERSION "0.0.0"
|
||||
#endif
|
||||
|
||||
#ifndef BUILD_COMMIT
|
||||
#define BUILD_COMMIT "undefined"
|
||||
#endif
|
||||
|
||||
#ifndef BUILD_ENV
|
||||
#define BUILD_ENV "undefined"
|
||||
#endif
|
||||
|
||||
@@ -56,6 +56,7 @@ const char S_CHANNEL[] PROGMEM = "channel";
|
||||
const char S_CH2_ALWAYS_ENABLED[] PROGMEM = "ch2AlwaysEnabled";
|
||||
const char S_CHIP[] PROGMEM = "chip";
|
||||
const char S_CODE[] PROGMEM = "code";
|
||||
const char S_COMMIT[] PROGMEM = "commit";
|
||||
const char S_CONNECTED[] PROGMEM = "connected";
|
||||
const char S_CONTINUES[] PROGMEM = "continues";
|
||||
const char S_COOLING[] PROGMEM = "cooling";
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
"build": {
|
||||
"title": "Build",
|
||||
"version": "固件版本",
|
||||
"commit": "Commit",
|
||||
"date": "日期",
|
||||
"core": "内核版本",
|
||||
"sdk": "SDK"
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
"build": {
|
||||
"title": "Build",
|
||||
"version": "Version",
|
||||
"commit": "Commit",
|
||||
"date": "Date",
|
||||
"core": "Core",
|
||||
"sdk": "SDK"
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
"build": {
|
||||
"title": "Build",
|
||||
"version": "Versione",
|
||||
"commit": "Commit",
|
||||
"date": "Data",
|
||||
"core": "Core",
|
||||
"sdk": "SDK"
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
"build": {
|
||||
"title": "Build",
|
||||
"version": "Versie",
|
||||
"commit": "Commit",
|
||||
"date": "Datum",
|
||||
"core": "Core",
|
||||
"sdk": "SDK"
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
"build": {
|
||||
"title": "Билд",
|
||||
"version": "Версия",
|
||||
"commit": "Коммит",
|
||||
"date": "Дата",
|
||||
"core": "Ядро",
|
||||
"sdk": "SDK"
|
||||
|
||||
@@ -104,6 +104,7 @@
|
||||
<th scope="row" data-i18n>index.system.build.title</th>
|
||||
<td>
|
||||
Env: <b id="build-env"></b><br />
|
||||
<span data-i18n>index.system.build.commit</span>: <b id="build-commit"></b><br />
|
||||
<span data-i18n>index.system.build.date</span>: <b id="build-date"></b><br />
|
||||
<span data-i18n>index.system.build.core</span>: <b id="build-core"></b><br />
|
||||
<span data-i18n>index.system.build.sdk</span>: <b id="build-sdk"></b>
|
||||
@@ -206,6 +207,7 @@
|
||||
setBusy('#main-busy', '#main-table', false);
|
||||
|
||||
setValue('#build-version', result.build.version);
|
||||
setValue('#build-commit', result.build.commit);
|
||||
setValue('#build-date', result.build.date);
|
||||
setValue('#build-env', result.build.env);
|
||||
setValue('#build-core', result.build.core);
|
||||
|
||||
16
tools/add_build_commit.py
Normal file
16
tools/add_build_commit.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import subprocess
|
||||
Import("env")
|
||||
|
||||
try:
|
||||
commit_hash = "undefined"
|
||||
result = subprocess.check_output(
|
||||
["git", "rev-parse", "--short", "HEAD"]
|
||||
)
|
||||
commit_hash = result.decode("utf-8").strip()
|
||||
env.Append(
|
||||
CPPDEFINES=[
|
||||
("BUILD_COMMIT", '\\"{}\\"'.format(commit_hash))
|
||||
]
|
||||
)
|
||||
except Exception as error:
|
||||
print("Failed to get commit hash: {}".format(error))
|
||||
Reference in New Issue
Block a user