Generate Teal declarations from luadoc

pull/3229/head
uramer 2 years ago
parent 5f1da29881
commit e938c04e30

@ -0,0 +1,36 @@
DOCS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
FILES_DIR=$(realpath $DOCS_DIR/../files)
OUTPUT_DIR=$(realpath $DOCS_DIR/$1)
DOCUMENTOR_PATH=~/.luarocks/bin/openmwluadocumentor
TEAL_PATH=~/.luarocks/bin/tl
rm -rf $OUTPUT_DIR
mkdir $OUTPUT_DIR
cp "$DOCS_DIR/tlconfig.lua" "$OUTPUT_DIR/tlconfig.lua"
build_path() {
for file in $1
do
mkdir -p $OUTPUT_DIR/$(dirname $file)
$DOCUMENTOR_PATH -f teal -d "$OUTPUT_DIR" $file
done
}
cd $FILES_DIR
build_path lua_api/openmw/*lua
data_paths=$($DOCS_DIR/source/luadoc_data_paths.sh)
for path in $data_paths
do
build_path data/$path
done
cd $OUTPUT_DIR
mv lua_api/openmw ./
rm -r lua_api
mv data/* ./
rm -r data
"$TEAL_PATH" check **/*.d.tl

@ -20,13 +20,12 @@ fi
rm -f $OUTPUT_DIR/*.html rm -f $OUTPUT_DIR/*.html
data_paths=$($DOCS_SOURCE_DIR/luadoc_data_paths.sh)
cd $FILES_DIR/lua_api cd $FILES_DIR/lua_api
$DOCUMENTOR_PATH -f doc -d $OUTPUT_DIR openmw/*lua $DOCUMENTOR_PATH -f doc -d $OUTPUT_DIR openmw/*lua
cd $FILES_DIR/data cd $FILES_DIR/data
$DOCUMENTOR_PATH -f doc -d $OUTPUT_DIR openmw_aux/*lua for path in $data_paths
$DOCUMENTOR_PATH -f doc -d $OUTPUT_DIR scripts/omw/ai.lua do
$DOCUMENTOR_PATH -f doc -d $OUTPUT_DIR scripts/omw/playercontrols.lua $DOCUMENTOR_PATH -f doc -d $OUTPUT_DIR $path
$DOCUMENTOR_PATH -f doc -d $OUTPUT_DIR scripts/omw/camera/camera.lua done
$DOCUMENTOR_PATH -f doc -d $OUTPUT_DIR scripts/omw/mwui/init.lua
$DOCUMENTOR_PATH -f doc -d $OUTPUT_DIR scripts/omw/settings/player.lua

@ -0,0 +1,9 @@
paths=(
openmw_aux/*lua
scripts/omw/ai.lua
scripts/omw/playercontrols.lua
scripts/omw/camera/camera.lua
scripts/omw/mwui/init.lua
scripts/omw/settings/player.lua
)
printf '%s\n' "${paths[@]}"

@ -0,0 +1,6 @@
-- used for checking generated declarations
return {
gen_target = '5.1',
gen_compat = 'off',
include_dir = { '.', },
}
Loading…
Cancel
Save