docs(widgets) begin adding support for building live examples

This commit is contained in:
Themba Dube
2021-05-04 16:41:56 -04:00
parent a1cea30bff
commit aeeec60885
4 changed files with 33 additions and 0 deletions

View File

@@ -22,6 +22,8 @@ jobs:
- name: Install requirements - name: Install requirements
run: | run: |
pip install --upgrade --upgrade-strategy eager sphinx recommonmark commonmark breathe sphinx-rtd-theme sphinx-markdown-tables sphinx-sitemap pip install --upgrade --upgrade-strategy eager sphinx recommonmark commonmark breathe sphinx-rtd-theme sphinx-markdown-tables sphinx-sitemap
- name: Build examples
run: scripts/build_html_examples.sh
- name: Build docs - name: Build docs
run: docs/build.py run: docs/build.py
- name: Remove .doctrees - name: Remove .doctrees

1
.gitignore vendored
View File

@@ -10,3 +10,4 @@ docs/doxygen_html
docs/xml docs/xml
out_html out_html
__pycache__ __pycache__
/emscripten_builder

15
scripts/build_html_examples.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
set -e
CURRENT_REF="$(git rev-parse HEAD)"
rm -rf emscripten_builder
git clone https://github.com/lvgl/lv_sim_emscripten.git emscripten_builder
scripts/genexamplelist.sh > emscripten_builder/examplelist.c
cd emscripten_builder
git submodule update --init -- lvgl
cd lvgl
git checkout $CURRENT_REF
cd ..
git submodule update --init -- lv_drivers
make -j$(nproc) CHOSEN_DEMO=lv_example_noop || exit 1
cd ..
cp -a emscripten_builder/build docs/_static/built_lv_examples

15
scripts/genexamplelist.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
echo "/* Autogenerated */"
echo '#include <stddef.h>'
echo '#include "examplelist.h"'
TMPFILE=$(mktemp)
find examples -name \*.h | xargs grep -h "^void lv_example" | sed 's/(/ /g' | awk '{print $2}' > $TMPFILE
cat $TMPFILE | while read -r line; do
echo "extern void ${line}(void);"
done
echo "const struct lv_ci_example lv_ci_example_list[] = {"
cat $TMPFILE | while read -r line; do
echo " { \"$line\", $line },";
done
echo " { NULL, NULL }"
echo "};"