Skip to content

Commit

Permalink
Adds document generation script
Browse files Browse the repository at this point in the history
  • Loading branch information
Figueroa committed Mar 1, 2024
1 parent 091a45c commit 6cf7ceb
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 27 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ osal_lcov/
outputOnFailure.txt
cfe_ut_results.txt
cfe_lcov_summary.txt
cfe_lcov
cfe_lcov
*doc_logs/
4 changes: 2 additions & 2 deletions runCFSscript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
104 changes: 104 additions & 0 deletions scripts/dox.sh
Original file line number Diff line number Diff line change
@@ -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
24 changes: 0 additions & 24 deletions scripts/gen_cfe-usersguide.sh

This file was deleted.

2 changes: 2 additions & 0 deletions scripts/lcov.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

#apps
#assumes these are all in the cFS/apps directory
#and that they're all in lowercase
Expand Down

0 comments on commit 6cf7ceb

Please sign in to comment.