From c2fb3acdc96eaaa5007ed315bd6a0cf00df138e0 Mon Sep 17 00:00:00 2001 From: Figueroa Date: Fri, 1 Mar 2024 16:57:19 -0500 Subject: [PATCH] Adds document generation script --- .gitignore | 3 +- runCFSscript.sh | 4 +- scripts/dox.sh | 104 ++++++++++++++++++++++++++++++++++++++++++++++++ scripts/lcov.sh | 2 + 4 files changed, 110 insertions(+), 3 deletions(-) create mode 100755 scripts/dox.sh diff --git a/.gitignore b/.gitignore index a5ab7d5f5..d70fa0163 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,5 @@ osal_lcov/ outputOnFailure.txt cfe_ut_results.txt cfe_lcov_summary.txt -cfe_lcov \ No newline at end of file +cfe_lcov +*doc_logs/ \ No newline at end of file diff --git a/runCFSscript.sh b/runCFSscript.sh index 37a970c0c..082c62fa4 100755 --- a/runCFSscript.sh +++ b/runCFSscript.sh @@ -22,7 +22,7 @@ cat << EOF 3) lcov.sh 4) format-check.sh 5) run-clang-format.sh - 6) gen_cfe_usersguide.sh + 6) dox.sh 7) cfe_functionaltests.sh 8) cfe_lcov.sh EOF @@ -60,7 +60,7 @@ case $userNum in ./scripts/run-clang-format.sh "${userApp##*/}" ;; 6) - ./scripts/gen_cfe_usersguide.sh + ./scripts/dox.sh "${userApp##*/}" ;; 7) ./scripts/cfe_functionaltests.sh diff --git a/scripts/dox.sh b/scripts/dox.sh new file mode 100755 index 000000000..82e4559c6 --- /dev/null +++ b/scripts/dox.sh @@ -0,0 +1,104 @@ +#!/bin/bash + +applist="cf cs ds fm hk hs lc md mm sc" +app=$1 + +# generate documents with logs +if [[ " $applist " =~ " $app " ]]; then + # build app usersguide (cFS application layer) + target="${app}-usersguide" + + # clean + rm -rf ${app}_doc_logs + rm -rf sample_defs + rm -rf Makefile + + # copy Files + cp ./cfe/cmake/Makefile.sample Makefile + cp -r ./cfe/cmake/sample_defs sample_defs + + # add repo to build + app_list_line=$(cat sample_defs/targets.cmake | grep -o "list(APPEND MISSION_GLOBAL_APPLIST.*") + for i in "${app[@]}" + do + if [[ ${app_list_line} != *"$i"* ]];then + prev_app="sample_lib" + sed -i "s/$prev_app/& $i/" "sample_defs/targets.cmake"; + prev_app=$i + fi + done + + # setup build + make distclean + make prep + + # dir + mkdir ${app}_doc_logs + + # build document with logs + make -C build ${target} 2>&1 > ${app}_doc_logs/${target}_stdout.txt | tee ${app}_doc_logs/${target}_stderr.txt + mv build/docs/${target}/${target}-warnings.log ${app}_doc_logs/ + + # generate pdf + make -C ./build/docs/${target}/latex + mv build/docs/${target}/latex/refman.pdf ${app}_doc_logs/${target}.pdf + +elif [ ${app} = "osal" ]; then + # build osalapiguide + target="osal-apiguide" + + osal_doc_logs="../osal_doc_logs" + + cd osal + + # clean + rm -rf ${osal_doc_logs} + rm -rf Makefile + + # set up for build + cp Makefile.sample Makefile + make distclean + make prep + + # dir + mkdir ${osal_doc_logs} + + # build osal API guide + make ${target} 2>&1 > ${osal_doc_logs}/make_${target}_stdout.txt | tee ${osal_doc_logs}/make_${target}_stderr.txt + mv build/docs/${target}-warnings.log ${osal_doc_logs}/${target}-warnings.log + +elif [ ${app} = "cfe" ]; then + # List of targets + targets=("mission-doc" "cfe-usersguide") + + cfe_doc_logs="cfe_doc_logs" + + # clean + rm -rf ${cfe_doc_logs} + rm -rf sample_defs + rm -rf Makefile + + # copy Files + cp ./cfe/cmake/Makefile.sample Makefile + cp -r ./cfe/cmake/sample_defs sample_defs + + # set up for build + make distclean + make prep + + # dir + mkdir ${cfe_doc_logs} + + # Loop through the list of targets + for target in "${targets[@]}"; do + # build document with logs + make -C build ${target} 2>&1 > ${cfe_doc_logs}/${target}_stdout.txt | tee ${cfe_doc_logs}/${target}_stderr.txt + mv build/docs/${target}/${target}-warnings.log ${cfe_doc_logs}/ + + # generate pdf + make -C ./build/docs/${target}/latex + mv build/docs/${target}/latex/refman.pdf ${cfe_doc_logs}/${target}.pdf + done +else + echo -e "\nThe app provided doesn't match any available options. Try again!\n" +fi \ No newline at end of file diff --git a/scripts/lcov.sh b/scripts/lcov.sh index c4dc8d4d7..8d24fc774 100755 --- a/scripts/lcov.sh +++ b/scripts/lcov.sh @@ -1,3 +1,5 @@ +#!/bin/bash + #apps #assumes these are all in the cFS/apps directory #and that they're all in lowercase