Vulkan-Docs/gen-script-docs.sh

79 lines
2.4 KiB
Bash
Raw Normal View History

Change log for September 8, 2019 Vulkan 1.1.122 spec update: * Update release number to 122. Internal Issues: * Add style guide language on not using standalone `+` signs (internal issue 736); not using leading whitespace for markup (internal issue 747); and on keeping descriptions of a single API in a contiguous block of markup (internal issue 949), and apply them to the specification. * Add a glossary definition of "`constant integral expression`", pointing to the SPIR-V "`constant instruction`" definition (internal issue 1225). * Many minor edits to improve writing style consistency and capture additional style guidelines (internal issue 1553). * Clarify that <<fragops-depth-write, depth writes are not performed>> if there is no depth framebuffer attachment (internal issue 1771). * Allow implementations to use rectangular line style of interpolation for <<primsrast-lines-bresenham, wide Bresenham lines>>, though replicating attributes is still preferred. Clarify that code:FragCoord is not replicated (internal issue 1772). * Resolve a contradiction in valid usage statements for slink:VkImageCreateInfo and slink:VkImageStencilUsageCreateInfoEXT (internal issue 1773). * Add style guide discussion of markup for indented equations, and use markup workaround for asciidoctor 2 compatibility (internal issue 1793). * Deprecate the `<<VK_EXT_validation_flags>>` extension in `vk.xml` and the extension appendix (internal issue 1801). * Add a new checker script `scripts/xml_consistency.py`. This is not currently run as part of internal CI (internal merge request 3285). * Correct "`an`" -> "`a`" prepositions where needed (internal merge request 3334). * Clarify that the <<features-uniformBufferStandardLayout, pname:uniformBufferStandardLayout>> feature is only required when the extension defining it is supported (internal merge request 3341). * Bring scripts into closer sync with OpenXR, mainly through conversion of comments to docstrings where appropriate, and add gen-scripts-docs.sh (internal merge request 3324). * Correct pname:maxDrawMeshTasksCount to 2^16^-1 in the <<limits-required, Required Limits>> table (internal merge requests 3361). New Extensions * `<<VK_IMG_format_pvrtc>>` (public issue 512).
2019-09-08 20:41:02 -07:00
#!/bin/sh
# Copyright (c) 2019 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# Generate documentation for the python scripts in this repo, using pdoc3:
# https://pdoc3.github.io/pdoc/
#
# Output is under out/python-docs
set -e
# Pipe in some paths. We'll convert them to module names and document them.
pathsToDocs() {
grep -v "test_" | \
grep -v "__init__.py" | \
sed -e 's/[.]py//' -e 's:/:.:g' | \
xargs --verbose pdoc3 --html --force --output-dir $1
}
# Main body of script
(
cd $(dirname $0)
# Needed to complete the build - can't import genRef.py without it.
make scripts/vkapi.py
SPECDIR=$(pwd)
OUTDIR=$(pwd)/out/python-docs
INDEX=$OUTDIR/index.html
mkdir -p $OUTDIR
cp scripts/__init__.py.docs scripts/__init__.py
export PYTHONPATH=${SPECDIR}/scripts
(
# # scripts under specification
cd $SPECDIR/scripts
ls *.py
# Generate the index files
# echo "scripts"
echo "scripts.spec_tools"
) | pathsToDocs $OUTDIR
# Generate a simple index file, since generating one with pdoc3 chokes on the Retired directory.
echo "<html><body><h1>Python modules</h2><ul>" > $INDEX
(
cd $SPECDIR/scripts
ls *.py
) | while read -r fn; do
MODNAME=$(echo $fn | sed -r 's/([a-zA-Z_]+)([.]py)?/\1/')
if [ -f $OUTDIR/$MODNAME.html ]; then
# Only make non-dead links
echo "<li><a href=$MODNAME.html>$MODNAME</a></li>" >> $INDEX
fi
done
echo "<li><a href=spec_tools/index.html>spec_tools</a></li>" >> $INDEX
echo "</ul></body></html>" >> $INDEX
# Move index files to a more useful place
rm -rf $OUTDIR/spec_tools
mv $OUTDIR/scripts/spec_tools $OUTDIR/spec_tools
# delete duplicate generated files
rm -rf $OUTDIR/scripts
rm -f scripts/__init__.py
)