aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnermolaev <snermolaev@yandex-team.com>2024-02-09 09:21:08 +0300
committersnermolaev <snermolaev@yandex-team.com>2024-02-09 09:36:51 +0300
commit9b498b3ccd9256f4ece0f7413f96f62b8f6d7924 (patch)
tree35825257c5001a8f9ed9e1a4a6ba9f1f5641b020
parentc090dc604ba74c72f2a403ecab77276e504ef3c5 (diff)
downloadydb-9b498b3ccd9256f4ece0f7413f96f62b8f6d7924.tar.gz
fix namespace for DOCS_SRCS
-rw-r--r--build/conf/docs.conf19
-rw-r--r--build/scripts/copy_docs_files_to_dir.py39
2 files changed, 33 insertions, 25 deletions
diff --git a/build/conf/docs.conf b/build/conf/docs.conf
index 8fe8ed3486..b0199a808c 100644
--- a/build/conf/docs.conf
+++ b/build/conf/docs.conf
@@ -28,7 +28,8 @@ ${env:"_JAVA_OPTIONS='-Dsun.awt.fontconfig=contrib/java/openjdk-fontconfig/fontc
${env:"LANG=en_US.UTF-8"} \
${env:"LC_ALL=C.UTF-8"}
-_DOCS_SRCS_VALUE=
+_DOCS_IMPLICIT_SRCS_VALUE=
+_DOCS_SOURCES_VALUE=
_DOCS_VARS_FLAG=
_DOCS_YFM_OUTPUT_FORMAT=
@@ -65,18 +66,19 @@ module _DOCS_BARE_UNIT: _BARE_UNIT {
# tag:docs tag:internal
_DOCS_DIR_INTERNAL_NAMESPACE=
+_DOCS_SKIP_NAMESPACE=
# tag:internal tag:docs
_DOCS_LIBRARY_CMDLINE=\
-$YMAKE_PYTHON3 ${input:"build/scripts/copy_docs_files_to_dir.py"} ${input;hide:"build/scripts/process_command_files.py"} $_DOCS_SRCS_VALUE $_DOCS_DIR_VALUE $_DOCS_BIN_DIR_VALUE --dest-dir $BINDIR/__s --source-root $ARCADIA_ROOT --build-root $ARCADIA_BUILD_ROOT ${input;context=TEXT:INCLUDE_SRCS} \
+$YMAKE_PYTHON3 ${input:"build/scripts/copy_docs_files_to_dir.py"} ${input;hide:"build/scripts/process_command_files.py"} $_DOCS_IMPLICIT_SRCS_VALUE $_DOCS_DIR_VALUE $_DOCS_BIN_DIR_VALUE --dest-dir $BINDIR/__s --source-root $ARCADIA_ROOT --build-root $ARCADIA_BUILD_ROOT --srcs ${input;context=TEXT:SOURCES} --include-srcs ${input;context=TEXT:INCLUDE_SOURCES} $_DOCS_SKIP_NAMESPACE \
&& $YMAKE_PYTHON3 ${input:"build/scripts/tar_sources.py"} --output $TARGET --input $BINDIR/__s $_DOCS_KV
# tag:internal tag:docs
-macro _DOCS_LIBRARY_CMD_IMPL(INCLUDE_SRCS[], EXTRA_INPUTS[]) {
+macro _DOCS_LIBRARY_CMD_IMPL(SOURCES[], INCLUDE_SOURCES[], EXTRA_INPUTS[]) {
.CMD=$_DOCS_LIBRARY_CMDLINE
}
-_DOCS_LIBRARY_CMD=$_DOCS_LIBRARY_CMD_IMPL(INCLUDE_SRCS $_DOCS_INCLUDE_SOURCES_VALUE)
+_DOCS_LIBRARY_CMD=$_DOCS_LIBRARY_CMD_IMPL(SOURCES $_DOCS_SOURCES_VALUE INCLUDE_SOURCES $_DOCS_INCLUDE_SOURCES_VALUE)
# tag:docs
module DOCS_LIBRARY: _DOCS_BARE_UNIT {
@@ -99,7 +101,7 @@ macro _DOCS_SRCS(SRCDIR=".", EXCLUDE[], INCLUDE...) {
SET(_VAR_DOCS_SRCS_SALT __SRCDIR__ $SRCDIR __EXCLUDE__ $EXCLUDE __INCLUDE__ $INCLUDE)
SET(_DOCS_SRCS_GLOB uniq_docs_${hash:_VAR_DOCS_SRCS_SALT})
_GLOB(${_DOCS_SRCS_GLOB} ${pre=${SRCDIR}/:INCLUDE} EXCLUDE ${EXCLUDE})
- SET_APPEND(_DOCS_INCLUDE_SOURCES_VALUE ${input:$_DOCS_SRCS_GLOB})
+ SET_APPEND(_DOCS_SOURCES_VALUE ${input:$_DOCS_SRCS_GLOB})
SET(_YFM_DOCS_DIR_DEFAULT_VALUE __dummy_dir__)
}
@@ -196,6 +198,7 @@ multimodule DOCS {
SET(MODULE_SUFFIX .docslib.fake)
SET(_DOCS_DIR_INTERNAL_NAMESPACE .)
+ SET(_DOCS_SKIP_NAMESPACE --skip-namespace ${MODDIR}/)
REALPRJNAME=__docs_internal
}
@@ -221,7 +224,7 @@ _DOCS_MKDOCS_BOOK_CMDLINE_SUFFIX=${pre=--dep ;ext=preprocessed.tar.gz:PEERS}
_DOCS_MKDOCS_LIB_CMDLINE_SUFFIX=--preprocess-md-only
_DOCS_MKDOCS_CMDLINE=\
-${cwd:ARCADIA_ROOT} $_DOCS_FS_TOOLS copy_all_files $_MKDOCS_DOCS_DIR_VALUE $BINDIR/__s $_DOCS_SRCS_VALUE \
+${cwd:ARCADIA_ROOT} $_DOCS_FS_TOOLS copy_all_files $_MKDOCS_DOCS_DIR_VALUE $BINDIR/__s $_DOCS_IMPLICIT_SRCS_VALUE \
&& $YMAKE_PYTHON3 ${input:"build/scripts/copy_files_to_dir.py"} ${input;hide:"build/scripts/process_command_files.py"} --dest-dir $BINDIR/__s --skip-prefix $ARCADIA_ROOT --skip-prefix $ARCADIA_BUILD_ROOT ${input;context=TEXT:INCLUDE_SRCS} \
&& ${cwd:BINDIR} $YMAKE_PYTHON3 ${input:"build/scripts/mkdocs_builder_wrapper.py"} $ARCADIA_BUILD_ROOT ${tool:"tools/mkdocs_builder"} --docs-dir $BINDIR/__s --output-tar $TARGET --config ${input:CONFIG} $_DOCS_VARS_FLAG $_DOCS_MKDOCS_CMDLINE_SUFFIX $_DOCS_EXTRA_TOOLS ${hide;input:EXTRA_INPUTS} $_DOCS_ENV $_DOCS_KV
@@ -253,7 +256,7 @@ module _MKDOCS_BASE_UNIT: _DOCS_BARE_UNIT {
### specified macros in the ya.make file
macro _MKDOCS_EPILOGUE() {
_LATE_GLOB(_DOCS_SRCS_GLOB ${pre=${ARCADIA_ROOT}/;suf=/**/*:_MKDOCS_DOCS_DIR_VALUE})
- SET(_DOCS_SRCS_VALUE \${input;hide:_DOCS_SRCS_GLOB})
+ SET(_DOCS_IMPLICIT_SRCS_VALUE \${input;hide:_DOCS_SRCS_GLOB})
}
# tag:docs
@@ -346,7 +349,7 @@ macro _YFM_DOCS_DIR(DIR) {
SET(_VAR_DOCS_DIR_SALT __MODDIR__ $MODDIR __DIR__ $DIR)
SET(_DOCS_DIR_GLOB uniq_docs_dir_${hash:_VAR_DOCS_DIR_SALT})
_LATE_GLOB(${_DOCS_DIR_GLOB} ${ARCADIA_ROOT}/$DIR/**/*)
- SET_APPEND(_DOCS_SRCS_VALUE \${input;hide:$_DOCS_DIR_GLOB})
+ SET_APPEND(_DOCS_IMPLICIT_SRCS_VALUE \${input;hide:$_DOCS_DIR_GLOB})
# We set the value of var _YFM_DOCS_DIR_DEFAULT_VALUE to some non-existing dir. This value
# will be used in _DOCS_LIBRARY_EPILOGUE calls. In case when this macro _YFM_DOCS_DIR is
diff --git a/build/scripts/copy_docs_files_to_dir.py b/build/scripts/copy_docs_files_to_dir.py
index 3af3ee8992..8ac23b0700 100644
--- a/build/scripts/copy_docs_files_to_dir.py
+++ b/build/scripts/copy_docs_files_to_dir.py
@@ -14,9 +14,11 @@ def parse_args():
parser.add_argument('--dest-dir', required=True)
parser.add_argument('--docs-dir', action='append', nargs=2, dest='docs_dirs', default=None)
parser.add_argument('--existing', choices=('skip', 'overwrite'), default='overwrite')
+ parser.add_argument('--include-srcs', nargs='*', default=[])
+ parser.add_argument('--skip-namespace', default=None)
parser.add_argument('--source-root', required=True)
parser.add_argument('--src-dir', action='append', nargs='*', dest='src_dirs', default=None)
- parser.add_argument('files', nargs='*')
+ parser.add_argument('--srcs', nargs='*', default=[])
return parser.parse_args(pcf.get_args(sys.argv[1:]))
@@ -144,22 +146,25 @@ def main():
file_dst = os.path.join(dst, file_src[len(bin_dir) :])
copy_file(file_src, file_dst, overwrite=is_overwrite_existing, orig_path=None)
- for src in args.files:
- file_src = os.path.normpath(src)
- assert os.path.isfile(file_src), 'File [{}] does not exist...'.format(file_src)
- rel_path = file_src
- orig_path = None
- if file_src.startswith(source_root):
- rel_path = file_src[len(source_root) :]
- orig_path = rel_path
- elif file_src.startswith(build_root):
- rel_path = file_src[len(build_root) :]
- else:
- raise Exception('Unexpected file path [{}].'.format(file_src))
- assert not os.path.isabs(rel_path)
- file_dst = os.path.join(args.dest_dir, rel_path)
- if file_dst != file_src:
- copy_file(file_src, file_dst, is_overwrite_existing, orig_path)
+ for skip_namespace, files in [(args.skip_namespace, args.srcs), (None, args.include_srcs)]:
+ for src in files:
+ file_src = os.path.normpath(src)
+ assert os.path.isfile(file_src), 'File [{}] does not exist...'.format(file_src)
+ rel_path = file_src
+ orig_path = None
+ if file_src.startswith(source_root):
+ rel_path = file_src[len(source_root) :]
+ if skip_namespace and rel_path.startswith(skip_namespace):
+ rel_path = rel_path[len(skip_namespace):]
+ orig_path = rel_path
+ elif file_src.startswith(build_root):
+ rel_path = file_src[len(build_root) :]
+ else:
+ raise Exception('Unexpected file path [{}].'.format(file_src))
+ assert not os.path.isabs(rel_path)
+ file_dst = os.path.join(args.dest_dir, rel_path)
+ if file_dst != file_src:
+ copy_file(file_src, file_dst, is_overwrite_existing, orig_path)
if __name__ == '__main__':