Skip to content
Snippets Groups Projects
Commit 812df2cd25ec authored by Vincent Hatakeyama's avatar Vincent Hatakeyama
Browse files

:pencil: fix autotodo in super project modules doc

parent e9dd36c97174
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,8 @@
Shell scripts stop assuming that they are in a directory inside the superproject, but assume they are called from the superproject directory instead.
Improve documentation generation.
4.0
---
......
......@@ -42,7 +42,7 @@
for doc_dir in doc docs; do
if [[ -d "$doc_dir" ]] ; then
superproject_modules_doc=$project_home/$doc_dir/modules
mkdir $superproject_modules_doc
[[ -d $superproject_modules_doc ]] || mkdir $superproject_modules_doc
fi
done
......@@ -50,6 +50,8 @@
for module_path in $(eval echo $odoo_modules) ;
do
if [[ -d "$module_path" ]] ; then
echo ""
echo "${YELLOW}INFO${RESET} - Documentation for ${BOLD_WHITE}$module_path${RESET}"
pushd $module_path
module=$(basename $module_path)
has_doc=""
......@@ -65,10 +67,10 @@
if [[ -d $doc_dir && -e $doc_dir/Makefile ]]; then
echo "${YELLOW}INFO ${RESET} - Branch name: $branch"
has_doc=True
echo ${YELLOW}INFO ${RESET} - Makefile found in $dir/$module_path/$doc_dir
echo ${YELLOW}INFO ${RESET} - Makefile found in $module_path/$doc_dir
pushd $doc_dir
# TODO read languages value from Makefile (at least available ones)
for language in $languages ; do
make $format LANGUAGE=${language} BUILDDIR=_build
if [[ $? -eq 0 ]] ; then
dest_dir=$out_dir/$module/$language/$branch
......@@ -69,10 +71,10 @@
pushd $doc_dir
# TODO read languages value from Makefile (at least available ones)
for language in $languages ; do
make $format LANGUAGE=${language} BUILDDIR=_build
if [[ $? -eq 0 ]] ; then
dest_dir=$out_dir/$module/$language/$branch
echo ${GREEN}OK${RESET} - Documentation generation done for $dir/$module_path/$doc_dir, copy to $dest_dir
echo ${GREEN}OK${RESET} - Documentation generation done for $module_path/$doc_dir, copy to $dest_dir
mkdir -p $dest_dir
if [[ -d "_build/$format/$language" ]];
then
......@@ -84,9 +86,9 @@
cp --archive --recursive "_build/$format/." "$dest_dir"
fi
else
echo ${RED}ERROR${RESET} - Documentation generation failed for $dir/$module_path/$doc_dir
echo ${RED}ERROR${RESET} - Documentation generation failed for $module_path/$doc_dir
((module_error++))
fi
done
popd
# copy documentation in super project
......@@ -88,10 +90,17 @@
((module_error++))
fi
done
popd
# copy documentation in super project
rsync --recursive --copy-links --perms --times --group --owner --include="*.rst" $doc_dir/ "$superproject_modules_doc/$module"
rsync --recursive --copy-links --perms --times --group --owner $doc_dir/ "$superproject_modules_doc/$module"
# generate autotodo for each module (to update pathes)
if [[ -e $doc_dir/autotodo.py ]] ; then
echo "${YELLOW}INFO ${RESET} - running autotodo again from different path $superproject_modules_doc/$module for ${project_home}/${module_path}"
pushd "$superproject_modules_doc/$module"
./autotodo.py $(realpath --relative-to="." "${project_home}/${module_path}") .py TODO,FIXME,XXX
popd
fi
# TODO translation will not work when copying like that.
fi
done
if [[ -z "$has_doc" ]] ; then
......@@ -94,11 +103,11 @@
# TODO translation will not work when copying like that.
fi
done
if [[ -z "$has_doc" ]] ; then
echo ${RED}WARN${RESET} - Missing documentation for $dir/$module_path
echo ${RED}WARN${RESET} - Missing documentation for $module_path
fi
popd
fi
done
# Generate super project documentation
......@@ -99,9 +108,11 @@
fi
popd
fi
done
# Generate super project documentation
echo ""
echo "${YELLOW}INFO ${RESET} - ${WHITE_BOLD}Super project${RESET} documentation generation"
# determine branch name
if [ -n "$DRONE_BRANCH" ]; then
......@@ -120,10 +131,10 @@
if [[ -d "$doc_dir" ]] ; then
pushd $doc_dir
for language in $languages ; do
make $format LANGUAGE=${language} BUILDDIR=_build
make $format LANGUAGE=${language} BUILDDIR=_build SPHINXOPTS="-w _build/warnings.out"
if [[ $? -eq 0 ]] ; then
dest_dir=$out_dir/$project_name/$language/$branch
echo "${YELLOW}INFO ${RESET} - Documentation generation done for $doc_dir (superproject), copy to $dest_dir"
mkdir -p $dest_dir
cp --recursive --archive _build/$format/$language/. $dest_dir
else
......@@ -124,10 +135,10 @@
if [[ $? -eq 0 ]] ; then
dest_dir=$out_dir/$project_name/$language/$branch
echo "${YELLOW}INFO ${RESET} - Documentation generation done for $doc_dir (superproject), copy to $dest_dir"
mkdir -p $dest_dir
cp --recursive --archive _build/$format/$language/. $dest_dir
else
echo "${RED}ERROR${RESET} - Documentation generation failed for $doc_dir (superproject)"
echo "${RED}FATAL${RESET} - Documentation generation failed for $doc_dir (superproject)"
((error++))
fi
done
......@@ -137,4 +148,13 @@
popd
if [[ $module_error -gt 0 ]]; then
echo "${RED}ERROR${RESET} - $module_error module(s) with errors"
fi
# create a metrics file
if [[ "$CI" = "true" ]]; then
echo -e "# HELP odoo_scripts_create_documentation_module_error Number of module in error.\n# TYPE odoo_scripts_create_documentation_module_error gauge\nodoo_scripts_create_documentation_module_error ${module_error}\n" > metrics
[[ -e doc*/_build/warnings.out ]] || echo -e "# HELP odoo_scripts_create_documentation_superproject_warnings Number of warnings in superproject.\n# TYPE odoo_scripts_create_documentation_superproject_warnings gauge\nodoo_scripts_create_documentation_superproject_warnings $(grep --count WARNING doc*/_build/warnings.out)\n" >> metrics
fi
exit $error
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment