doxygen.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/usr/bin/env bash
  2. #
  3. # Copyright (c) 2020 Project CHIP Authors
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. CHIP_ROOT="$(dirname "$0")/../.."
  18. CHIP_NAME="Connected Home over IP"
  19. CHIP_VERSION="$(git rev-parse --short HEAD)"
  20. die() {
  21. echo " *** ERROR: $*"
  22. exit 1
  23. }
  24. install_doxygen() {
  25. if ! doxygen --version >/dev/null 2>&1; then
  26. echo "doxygen not installed. Installing..."
  27. case "$(uname)" in
  28. "Darwin")
  29. brew install doxygen
  30. ;;
  31. "Linux")
  32. sudo apt-get update
  33. sudo apt-get install -y doxygen
  34. ;;
  35. *)
  36. die
  37. ;;
  38. esac
  39. fi
  40. }
  41. install_graphviz() {
  42. if ! dot -V >/dev/null 2>&1; then
  43. echo "graphviz not installed. Installing..."
  44. case "$(uname)" in
  45. "Darwin")
  46. brew install graphviz
  47. ;;
  48. "Linux")
  49. sudo apt-get update
  50. sudo apt-get install -y graphviz
  51. ;;
  52. *)
  53. die
  54. ;;
  55. esac
  56. fi
  57. }
  58. install_doxygen
  59. install_graphviz
  60. cd "$CHIP_ROOT" || exit 1
  61. CHIP_NAME=$CHIP_NAME CHIP_VERSION=$CHIP_VERSION doxygen docs/Doxyfile || die "doxygen failed"
  62. exit 0