jazzy_generate_objc.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/bash
  2. # Copyright 2024 Google LLC
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. set -ex
  16. if [[ "$#" != 4 ]]
  17. then
  18. echo -e "Usage: ./jazzy_generate.sh output_dir xcworkspace_path umbrella_header_path module_name"
  19. exit 1
  20. fi
  21. output_dir=$1
  22. workspace_path=$2
  23. umbrella_header_path=$3
  24. module_name=$4
  25. SWIFT_VERSION="$(xcrun swift -version | cut -d " " -f 4)"
  26. # Generate temporary sourcekitten files.
  27. mkdir -p "$output_dir"
  28. sourcekitten \
  29. doc --objc "$umbrella_header_path" \
  30. -- -x objective-c -isysroot "$(xcrun --show-sdk-path --sdk iphonesimulator)" \
  31. -I "$workspace_path" -fmodules > "$output_dir"/objcDoc.json
  32. # Generates reference docs using jazzy
  33. jazzy \
  34. --author "Firebase" \
  35. --module "$module_name" \
  36. --output "$output_dir" \
  37. --sourcekitten-sourcefile "$output_dir"/objcDoc.json