Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate sphinx to read .xml documentation from Visual Studio #785

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ crest/[Oo]bj/
crest/[Bb]uild/
crest/[Bb]uilds/
crest/[Ll]ogs/
crest/[Pp]ackages/*/
crest/Assets/AssetStoreTools*

# Visual Studio 2015 cache directory
Expand Down
4 changes: 4 additions & 0 deletions crest/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Vsxmd" version="1.4.5" targetFramework="net471" developmentDependency="true" />
</packages>
3 changes: 3 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ pythonenv*
# Rope project settings
.ropeproject

# Visual Studio Code project settings
.vscode

# mkdocs documentation
/site

Expand Down
1,824 changes: 1,824 additions & 0 deletions docs/api/Crest.md

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import os
import sys

sys.path.insert(0, os.path.abspath('./extensions'))

# -- Project information -----------------------------------------------------
Expand All @@ -20,6 +21,37 @@
copyright = '2021, Wave Harmonic & Contributors'
author = 'Wave Harmonic & Contributors'

# -- Create API copy DefaultDocumentation -----------------------------------

import subprocess

if not (os.path.exists('api/') and os.path.isdir('api/')):
os.mkdir('api/')

try:
vswhere_cmd = subprocess.run(['vswhere', '-latest', '-requires', 'Microsoft.Component.MSBuild', '-find', 'MSBuild\\**\\Bin\\MsBuild.exe'], check=True, stdout=subprocess.PIPE)
msbuild_path = vswhere_cmd.stdout.strip()
csproj_path = os.path.abspath('../crest/Crest.csproj')
xml_path = os.path.abspath('./api/api.xml')
print(xml_path)

msbuild_cmd = subprocess.run([msbuild_path, '-p:DocumentationFile=' + xml_path, csproj_path], stdout=subprocess.DEVNULL)
except:
print("Unable to build API from source. Continuing...")
# try:
# files = [file for file in os.listdir("../crest/Temp/bin/Debug") if file.endswith('.md')]
# if not (os.path.exists('api/') and os.path.isdir('api/')):
# os.mkdir('api/')
# if len(files) == 0:
# raise FileNotFoundError("No .md files were found in ../crest/Temp/bin/Debug/")

# import shutil
# for file_name in files:
# shutil.copyfile(os.path.abspath('../crest/Temp/bin/Debug/' + file_name), os.path.abspath('api/' + file_name))
# except FileNotFoundError as e:
# print(e)
# print('Assuming .md files are already present in docs/api/')


# -- General configuration ---------------------------------------------------

Expand All @@ -34,6 +66,9 @@

"furo",

"recommonmark",
"sphinx_markdown_tables",

# Local packages
"youtube",
"variables",
Expand All @@ -45,6 +80,11 @@
"sphinx_search.extension",
]

source_suffix = {
'.rst': 'restructuredtext',
'.md': 'markdown',
}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ User Guide
user/performance
user/technical-information
user/faq
api/Crest

.. user/quickstart
.. user/support
Expand Down
2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Pygments==2.8.0
pyparsing==2.4.7
pytz==2021.1
readthedocs-sphinx-search==0.1.0
recommonmark==0.7.1
requests==2.25.1
six==1.15.0
snowballstemmer==2.1.0
Expand All @@ -24,6 +25,7 @@ sphinx-autobuild==2020.9.1
sphinx-hoverxref==0.5b1
sphinx-inline-tabs @ git+https://github.com/daleeidd/sphinx-inline-tabs@e70a7d08f11df10df1011c575d73d6f296b62cfc
sphinx-issues==1.2.0
sphinx-markdown-tables==0.0.15
sphinx-panels==0.5.2
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
Expand Down
Binary file added docs/vswhere.exe
Binary file not shown.