Skip to content

Commit ab94252

Browse files
authored
add docsgen invocations to scripts (#13892)
1 parent e1d1ad9 commit ab94252

File tree

3 files changed

+130
-0
lines changed

3 files changed

+130
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
3+
# Copyright 2024 Google LLC
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+
set -ex
18+
19+
if [[ "$#" != 4 ]]
20+
then
21+
echo -e "Usage: ./jazzy_generate.sh output_dir xcworkspace_path umbrella_header_path module_name"
22+
exit 1
23+
fi
24+
25+
output_dir=$1
26+
workspace_path=$2
27+
umbrella_header_path=$3
28+
module_name=$4
29+
30+
SWIFT_VERSION="$(xcrun swift -version | cut -d " " -f 4)"
31+
32+
# Generate temporary sourcekitten files.
33+
mkdir -p "$output_dir"
34+
sourcekitten \
35+
doc --objc "$umbrella_header_path" \
36+
-- -x objective-c -isysroot "$(xcrun --show-sdk-path --sdk iphonesimulator)" \
37+
-I "$workspace_path" -fmodules > "$output_dir"/objcDoc.json
38+
sourcekitten \
39+
doc -- -workspace "$workspace_path" \
40+
-scheme "$module_name" > "$output_dir"/swiftDoc.json
41+
42+
# Generates reference docs using jazzy
43+
jazzy \
44+
--author "Firebase" \
45+
--module "$module_name" \
46+
--output "$output_dir" \
47+
--sourcekitten-sourcefile "$output_dir/swiftDoc.json,$output_dir/objcDoc.json"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
# Copyright 2024 Google LLC
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+
set -ex
18+
19+
if [[ "$#" != 4 ]]
20+
then
21+
echo -e "Usage: ./jazzy_generate.sh output_dir xcworkspace_path umbrella_header_path module_name"
22+
exit 1
23+
fi
24+
25+
output_dir=$1
26+
workspace_path=$2
27+
umbrella_header_path=$3
28+
module_name=$4
29+
30+
SWIFT_VERSION="$(xcrun swift -version | cut -d " " -f 4)"
31+
32+
# Generate temporary sourcekitten files.
33+
mkdir -p "$output_dir"
34+
sourcekitten \
35+
doc --objc "$umbrella_header_path" \
36+
-- -x objective-c -isysroot "$(xcrun --show-sdk-path --sdk iphonesimulator)" \
37+
-I "$workspace_path" -fmodules > "$output_dir"/objcDoc.json
38+
39+
# Generates reference docs using jazzy
40+
jazzy \
41+
--author "Firebase" \
42+
--module "$module_name" \
43+
--output "$output_dir" \
44+
--sourcekitten-sourcefile "$output_dir"/objcDoc.json
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
# Copyright 2024 Google LLC
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+
set -ex
18+
19+
if [[ "$#" != 3 ]]
20+
then
21+
echo -e "Usage: ./jazzy_generate.sh output_dir xcworkspace_path module_name"
22+
exit 1
23+
fi
24+
25+
output_dir=$1
26+
workspace_path=$2
27+
module_name=$3
28+
29+
SWIFT_VERSION="$(xcrun swift -version | cut -d " " -f 4)"
30+
31+
jazzy \
32+
--clean \
33+
--author "Firebase" \
34+
--swift-version "${SWIFT_VERSION}" \
35+
--sdk iphonesimulator \
36+
--build-tool-arguments -workspace,"$workspace_path",-scheme,"$module_name" \
37+
--module "$module_name" \
38+
--output "$output_dir" \
39+
--swift-build-tool xcodebuild

0 commit comments

Comments
 (0)