You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.0 KiB

  1. """Build QMK documentation locally
  2. """
  3. import shutil
  4. import subprocess
  5. from pathlib import Path
  6. from milc import cli
  7. DOCS_PATH = Path('docs/')
  8. BUILD_PATH = Path('.build/docs/')
  9. @cli.subcommand('Build QMK documentation.', hidden=False if cli.config.user.developer else True)
  10. def generate_docs(cli):
  11. """Invoke the docs generation process
  12. TODO(unclaimed):
  13. * [ ] Add a real build step... something static docs
  14. """
  15. if BUILD_PATH.exists():
  16. shutil.rmtree(BUILD_PATH)
  17. shutil.copytree(DOCS_PATH, BUILD_PATH)
  18. # When not verbose we want to hide all output
  19. args = {'check': True}
  20. if not cli.args.verbose:
  21. args.update({'stdout': subprocess.DEVNULL, 'stderr': subprocess.STDOUT})
  22. cli.log.info('Generating internal docs...')
  23. # Generate internal docs
  24. subprocess.run(['doxygen', 'Doxyfile'], **args)
  25. subprocess.run(['moxygen', '-q', '-a', '-g', '-o', BUILD_PATH / 'internals_%s.md', 'doxygen/xml'], **args)
  26. cli.log.info('Successfully generated internal docs to %s.', BUILD_PATH)