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})\)') version_re = re.compile(r'([\d.-]+)\s+(\w+)?\s*\((\d{2}.\d{2}\.\d{2})\)')
entry_re = re.compile(r'-\s(.*)') entry_re = re.compile(r'-\s(.*)')
with open(changelog_path, "r") as f: with open(changelog_path, "rb") as f:
changelog_lines = f.read().splitlines() changelog_lines = f.read().decode('utf-8').splitlines()
releases = [] releases = []
for l in changelog_lines: for l in changelog_lines:

View file

@ -7,18 +7,28 @@
function(generate_appdata_changelog target_name changelog_path appdata_path) function(generate_appdata_changelog target_name changelog_path appdata_path)
find_package(Python3 REQUIRED) 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} ${Python3_EXECUTABLE}
${submodules_loc}/build/changelog2appdata.py ${submodules_loc}/build/changelog2appdata.py
-c "${changelog_path}" -c "${changelog_path}"
-a "${appdata_path}" -a "${appdata_path}"
-n 10 -n 10
COMMAND
echo 1> ${gen_timestamp}
COMMENT "Generating AppData changelog (${target_name})" COMMENT "Generating AppData changelog (${target_name})"
DEPENDS DEPENDS
${submodules_loc}/build/changelog2appdata.py ${submodules_loc}/build/changelog2appdata.py
${changelog_path} ${changelog_path}
${appdata_path} ${appdata_path}
VERBATIM
) )
add_dependencies(${target_name} ${target_name}_appdata_changelog) generate_target(${target_name} changelog ${gen_timestamp} "${gen_files}" ${gen_dst})
endfunction() endfunction()