diff options
| author | snermolaev <[email protected]> | 2025-08-15 06:18:53 +0300 |
|---|---|---|
| committer | snermolaev <[email protected]> | 2025-08-15 06:32:31 +0300 |
| commit | 910f88efeaab4e30bb7e64d76d9becb77f76ad59 (patch) | |
| tree | b76473184545c71a98dec68bc7ef19f365524a8a | |
| parent | cd0d132e8ed391a42f8374c87c085527d56db1c7 (diff) | |
DOCSBOOK is final tgarget again; additional output preprocessed.tar.gz for DOCSBOOK
commit_hash:58b2d779b2e6e3462eceeeb50fa73e93238bad43
| -rw-r--r-- | build/conf/docs.conf | 7 | ||||
| -rw-r--r-- | build/scripts/bundle_output.py | 44 | ||||
| -rw-r--r-- | build/scripts/extract_docs.py | 2 | ||||
| -rw-r--r-- | build/ymake.core.conf | 19 |
4 files changed, 68 insertions, 4 deletions
diff --git a/build/conf/docs.conf b/build/conf/docs.conf index dea640d1ac6..910016e697c 100644 --- a/build/conf/docs.conf +++ b/build/conf/docs.conf @@ -154,7 +154,8 @@ macro _DOCS_YFM_USE_PLANTUML() { ### @see: [DOCS_DIR()](#macro_DOCS_DIR), [DOCS_CONFIG()](#macro_DOCS_CONFIG), [DOCS_VARS()](#macro_DOCS_VARS). multimodule DOCS { module DOCSBOOK: _DOCS_BASE_UNIT { - .CMD=$_DOCS_YFM_CMD + .CMD=$_DOCS_YFM_CMD && ${cwd:BINDIR} $LINK_OR_COPY_CMD ${MODULE_PREFIX}_preprocessed${MODULE_SUFFIX} ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX:"preprocessed"} $_DOCS_KV + .FINAL_TARGET=yes .PEERDIR_POLICY=as_build_from .IGNORED=DOCS_DIR DOCS_INCLUDE_SOURCES DOCS_COPY_FILES PEERDIR PYTHON RUN_PROGRAM RUN_PYTHON3 RUN_LUA RUN_JAVA_PROGRAM FROM_SANDBOX SRCS COPY COPY_FILE FILES .PEERDIRSELF=DOCSLIB @@ -171,18 +172,18 @@ multimodule DOCS { module DOCSLIB: _DOCS_BASE_UNIT { .CMD=$_DOCS_YFM_CMD - .FINAL_TARGET=yes .PEERDIR_POLICY=as_build_from .IGNORED=DOCS_DIR DOCS_INCLUDE_SOURCES DOCS_COPY_FILES PEERDIR PYTHON RUN_PROGRAM RUN_PYTHON3 RUN_LUA RUN_JAVA_PROGRAM FROM_SANDBOX SRCS COPY COPY_FILE FILES .PEERDIRSELF=DOCSLIB_INTERNAL .PROXY=yes ENABLE(DOCSLIB) + DISABLE(START_TARGET) SET(MODULE_TAG DOCSLIB) SET(PEERDIR_TAGS DOCSLIB_INTERNAL DOCS_PROTO) - REALPRJNAME=preprocessed + REALPRJNAME=_preprocessed _DOCS_YFM_OUTPUT_FORMAT=$_DOCS_YFM_LIB_OUTPUT_FORMAT diff --git a/build/scripts/bundle_output.py b/build/scripts/bundle_output.py new file mode 100644 index 00000000000..8b99eaa21fe --- /dev/null +++ b/build/scripts/bundle_output.py @@ -0,0 +1,44 @@ +import argparse +import os +import shutil +import sys + + +def parse_args(): + parser = argparse.ArgumentParser() + parser.add_argument('--name', required=True) + parser.add_argument('--output', required=True) + parser.add_argument('--result', required=True) + return parser.parse_args(sys.argv[1:]) + + +def main(): + args = parse_args() + if os.path.basename(args.name) != args.name: + print("Error: --name must be a base name without directory components", file=sys.stderr, flush=True) + sys.exit(1) + result_dir = os.path.dirname(args.result) + src_path = os.path.join(result_dir, args.name) + + if not os.path.exists(src_path): + print(f"Error: Source file '{src_path}' does not exist", file=sys.stderr, flush=True) + sys.exit(1) + if not os.path.isfile(src_path): + print(f"Error: Source path '{src_path}' is not a file", file=sys.stderr, flush=True) + sys.exit(1) + if os.path.isdir(args.output): + print(f"Error: Output path '{args.output}' is a directory", file=sys.stderr, flush=True) + sys.exit(1) + output_dir = os.path.dirname(args.output) + if output_dir: + os.makedirs(output_dir, exist_ok=True) + + try: + shutil.move(src_path, args.output) + except Exception as e: + print(f"Error moving file: {str(e)}", file=sys.stderr, flush=True) + sys.exit(1) + + +if __name__ == '__main__': + main() diff --git a/build/scripts/extract_docs.py b/build/scripts/extract_docs.py index 8ab835b7205..f77c9f6b304 100644 --- a/build/scripts/extract_docs.py +++ b/build/scripts/extract_docs.py @@ -24,7 +24,7 @@ def main(): def _valid_docslib(path): base = os.path.basename(path) - return base.endswith(('.docslib', '.docslib.fake')) or base == 'preprocessed.tar.gz' + return base.endswith(('.docslib', '.docslib.fake')) or base == '_preprocessed.tar.gz' for src in [p for p in args.docs if _valid_docslib(p)]: if src == 'preprocessed.tar.gz': diff --git a/build/ymake.core.conf b/build/ymake.core.conf index 5be73fde244..2f8f0f96cb9 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -2710,6 +2710,25 @@ macro _BUNDLE_TARGET(Target, Destination, Suffix) { .SEM=target_commands-ITEM && target_commands-macro copy_file && target_commands-args ${result:Target}$Suffix ${noauto;output:Destination} && target_commands-flags src_is_depend } +### @usage: BUNDLE_OUTPUT_IMPL(File Name Output) # internal +### +### `File` - the name of main output of a module +### `Name` - the name of secondary module output to be collected +### `Output` - the resulting output name +macro BUNDLE_OUTPUT_IMPL(TARGET, NAME, OUTPUT, DUMMY...) { + .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/bundle_output.py"} --result ${result:TARGET} --name $NAME --output ${noauto;output:OUTPUT} ${hide;kv:"p BN"} ${hide;kv:"pc light-cyan"} $VCS_INFO_DISABLE_CACHE__NO_UID__ + .STRUCT_CMD=yes +} + +### @usage: BUNDLE_OUTPUT(Dir OutputName [Rename]) +### +### `Dir` - Path to module +### `OutputName` - the name of module artefact to be collected +### `Rename` - the output name of collected artefact if needed +macro BUNDLE_OUTPUT(TARGET, NAME, RENAME="") { + BUNDLE_OUTPUT_IMPL($TARGET $NAME $RENAME $NAME) +} + ### @usage: TIMEOUT(TIMEOUT) ### ### Sets a timeout on test execution |
