Use generate_target for timestamped changelog generator.

This commit is contained in:
John Preston 2022-01-25 14:46:38 +03:00
parent 624d83dc60
commit 6af255923a
2 changed files with 15 additions and 5 deletions

View File

@ -9,8 +9,8 @@ def parse_changelog(changelog_path):
version_re = re.compile(r'([\d.-]+)\s+(\w+)?\s*\((\d{2}.\d{2}\.\d{2})\)')
entry_re = re.compile(r'-\s(.*)')
with open(changelog_path, "r") as f:
changelog_lines = f.read().splitlines()
with open(changelog_path, "rb") as f:
changelog_lines = f.read().decode('utf-8').splitlines()
releases = []
for l in changelog_lines:

View File

@ -7,18 +7,28 @@
function(generate_appdata_changelog target_name changelog_path appdata_path)
find_package(Python3 REQUIRED)
add_custom_target(${target_name}_appdata_changelog
set(gen_dst ${CMAKE_CURRENT_BINARY_DIR}/gen)
set(gen_timestamp ${gen_dst}/${target_name}_changelog.timestamp)
set(gen_files ${appdata_path})
add_custom_command(
OUTPUT
${gen_timestamp}
BYPRODUCTS
${gen_files}
COMMAND
${Python3_EXECUTABLE}
${submodules_loc}/build/changelog2appdata.py
-c "${changelog_path}"
-a "${appdata_path}"
-n 10
COMMAND
echo 1> ${gen_timestamp}
COMMENT "Generating AppData changelog (${target_name})"
DEPENDS
${submodules_loc}/build/changelog2appdata.py
${changelog_path}
${appdata_path}
VERBATIM
)
add_dependencies(${target_name} ${target_name}_appdata_changelog)
generate_target(${target_name} changelog ${gen_timestamp} "${gen_files}" ${gen_dst})
endfunction()