44 lines
1.5 KiB
Diff
44 lines
1.5 KiB
Diff
|
diff --git a/site_scons/site_tools/fbt_assets.py b/site_scons/site_tools/fbt_assets.py
|
||
|
index f91fcfed..e83d8fa7 100644
|
||
|
--- a/site_scons/site_tools/fbt_assets.py
|
||
|
+++ b/site_scons/site_tools/fbt_assets.py
|
||
|
@@ -67,28 +67,17 @@ def _invoke_git(args, source_dir):
|
||
|
|
||
|
|
||
|
def proto_ver_generator(target, source, env):
|
||
|
+ changelog_content = source[0].get_text_contents()
|
||
|
+ for ln in changelog_content.split('\n'):
|
||
|
+ ln = ln.strip()
|
||
|
+ if ln.startswith('## ['):
|
||
|
+ version = ln[len('## ['):-1]
|
||
|
+ break
|
||
|
+ else:
|
||
|
+ print("couldn't parse version from changelog " + str(source[0]))
|
||
|
+ Exit()
|
||
|
target_file = target[0]
|
||
|
- src_dir = source[0].dir.abspath
|
||
|
- try:
|
||
|
- git_fetch = _invoke_git(
|
||
|
- ["fetch", "--tags"],
|
||
|
- source_dir=src_dir,
|
||
|
- )
|
||
|
- except (subprocess.CalledProcessError, EnvironmentError) as e:
|
||
|
- # Not great, not terrible
|
||
|
- print("Git: fetch failed")
|
||
|
-
|
||
|
- try:
|
||
|
- git_describe = _invoke_git(
|
||
|
- ["describe", "--tags", "--abbrev=0"],
|
||
|
- source_dir=src_dir,
|
||
|
- )
|
||
|
- except (subprocess.CalledProcessError, EnvironmentError) as e:
|
||
|
- print("Git: describe failed")
|
||
|
- Exit("git error")
|
||
|
-
|
||
|
- # print("describe=", git_describe)
|
||
|
- git_major, git_minor = git_describe.split(".")
|
||
|
+ git_major, git_minor = version.split(".")
|
||
|
version_file_data = (
|
||
|
"#pragma once",
|
||
|
f"#define PROTOBUF_MAJOR_VERSION {git_major}",
|