diff --git a/templates/git/CODEOWNERS.gsl b/templates/git/CODEOWNERS.gsl new file mode 100644 index 00000000..bad136f6 --- /dev/null +++ b/templates/git/CODEOWNERS.gsl @@ -0,0 +1,123 @@ +.template 0 +############################################################################### +# Copyright (c) 2014-2026 libbitcoin developers (see COPYING). +# +# GSL generate libbitcoin CODEOWNERS +# +# This is a code generator built using the iMatix GSL code generation +# language. See https://github.com/imatix/gsl for details. +############################################################################### + +# Note: expected context root libbitcoin-build/process directory +[gsl].ignorecase = 0 + +gsl from "../library/math.gsl" +gsl from "../library/string.gsl" +gsl from "../lib/xml.gsl" +gsl from "../lib/debug.gsl" +gsl from "../lib/filesystem.gsl" +gsl from "../lib/output.gsl" +gsl from "../lib/sh-output.gsl" + +############################################################################### +# Generation +############################################################################### +function generate_gitignore(configuration) + define my.configuration = generate_gitignore.configuration + require(my.configuration->templates, "templates", "resultpath") + + define my.resource_name = "CODEOWNERS" + define my.template = my.configuration->templates->template(.name = "$(script)") + + if !defined(my.template) + abort "Generator configuration missing." + endif + + require(my.template, "template", "outpath") + + define my.project_path_suffix = my.template.outpath + + for my.configuration.repository as _repository + require(_repository, "repository", "name") + define my.output_path = path_append(\ + my.configuration->templates.resultpath, \ + path_append(my.path_prefix, \ + path_append(_repository.name, my.project_path_suffix))) + + create_directory(my.output_path) + + define my.short_name = string.substr(_repository.name, 11, \ + string.length(_repository.name)) + + define my.filename = "$(my.resource_name)" + define my.out_file = path_append(my.output_path, my.filename) + notify(my.out_file) + output(my.out_file) + + emit_codeowners(_repository, my.configuration, my.template) + + close + endfor + +endfunction + +############################################################################### +# Functions +############################################################################### +function has_repository_name(configuration, name) + define my.configuration = has_repository_name.configuration + define my.name = has_repository_name.name + + return (count_matches_name(my.configuration, "repository", my.name) > 0) +endfunction + +############################################################################### +# Generation +############################################################################### +.endtemplate +.template 1 +. +.macro emit_codeowners(repository, configuration, meta) +. define my.repository = emit_codeowners.repository +. define my.configuration = emit_codeowners.configuration +. define my.meta = emit_codeowners.meta +. +. copyleft(my.repository.name) +. +. for my.meta.review as _review +. emit_reviewer(_review) +. endfor +. +. for my.repository.review as _review +. emit_reviewer(_review) +. endfor +. +.endmacro # emit_codeowners +. +.macro emit_reviewer(review) +. define my.review = emit_reviewer.review +. +. define my.reviewers = "" +. for my.review.reviewer as _reviewer where defined(_reviewer.value) +. if first() +. my.reviewers = _reviewer.value +. else +. my.reviewers = "$(my.reviewers) $(_reviewer.value)" +. endif +. endfor +. +. if !(my.reviewers = "") +$(my.review.pattern) $(my.reviewers) +. endif +. +.endmacro # emit_reviewer +. +.endtemplate +.template 0 +############################################################################### +# Execution +############################################################################### + +generate_gitignore(configuration) + +.endtemplate diff --git a/version4.xml b/version4.xml index 978ee6f5..4513b655 100644 --- a/version4.xml +++ b/version4.xml @@ -2965,6 +2965,15 @@ g and optimizations for size." hidden="false" display="*nix/GNU/Release/Static/S outpath="include/bitcoin" /> --> + +