Skip to content

Commit d2469c6

Browse files
ggzgliAbySwifter
authored andcommitted
Update documentation
1 parent 81ef664 commit d2469c6

File tree

3,711 files changed

+3996
-2870
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,711 files changed

+3996
-2870
lines changed

build_docs.sh

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
#!/bin/bash
2+
3+
# Swift-DocC 文档生成脚本
4+
# 用于生成 AtomicXCore 的完整 API 文档并配置正确的 hosting base path
5+
# 注意:此脚本会临时禁用 .docc 目录以生成完整的 API 文档(类似 Xcode Build Documentation)
6+
7+
set -e
8+
9+
# 配置
10+
SCHEME_NAME="AtomicXCore" # Scheme 名称
11+
WORKSPACE_OR_PROJECT="../tuikit_engine/atomicx/swift/AtomicXCore.xcworkspace" # workspace 路径
12+
HOSTING_BASE_PATH="TUIKit_iOS"
13+
OUTPUT_DIR="./docs"
14+
TARGET_MODULE="AtomicXCore" # 目标模块名称
15+
DOCC_DIR="../tuikit_engine/atomicx/swift/AtomicXCore/AtomicXCore.docc" # .docc 目录路径
16+
17+
# 颜色输出
18+
GREEN='\033[0;32m'
19+
YELLOW='\033[1;33m'
20+
BLUE='\033[0;34m'
21+
RED='\033[0;31m'
22+
NC='\033[0m' # No Color
23+
24+
# 清理函数
25+
cleanup() {
26+
# 恢复 .docc 目录
27+
if [ -n "$DOCC_BACKUP" ] && [ -d "$DOCC_BACKUP" ]; then
28+
echo -e "${BLUE}恢复 .docc 目录...${NC}"
29+
mv "$DOCC_BACKUP" "$DOCC_DIR"
30+
fi
31+
32+
# 清理临时文件
33+
if [ -d "./DerivedData" ]; then
34+
rm -rf ./DerivedData
35+
fi
36+
}
37+
38+
# 捕获错误和退出信号
39+
trap cleanup EXIT INT TERM
40+
41+
echo -e "${GREEN}=== AtomicXCore 文档生成工具 ===${NC}"
42+
echo -e "${BLUE}模式: 完整 API 文档(自动生成所有 public 符号)${NC}"
43+
echo ""
44+
45+
# 清理旧文档
46+
if [ -d "$OUTPUT_DIR" ]; then
47+
echo -e "${YELLOW}清理旧文档目录...${NC}"
48+
rm -rf "$OUTPUT_DIR"
49+
fi
50+
51+
# 临时重命名 .docc 目录以生成完整的 API 文档
52+
DOCC_BACKUP=""
53+
if [ -d "$DOCC_DIR" ]; then
54+
echo -e "${BLUE}临时禁用 .docc 目录以生成完整 API 文档...${NC}"
55+
echo -e "${BLUE}(这样可以让 DocC 自动包含所有 public 类、结构体、枚举等)${NC}"
56+
DOCC_BACKUP="${DOCC_DIR}.backup"
57+
mv "$DOCC_DIR" "$DOCC_BACKUP"
58+
fi
59+
60+
# 查找 .xcodeproj 或 .xcworkspace
61+
if [ -n "$WORKSPACE_OR_PROJECT" ]; then
62+
# 使用指定的 workspace/project
63+
if [[ "$WORKSPACE_OR_PROJECT" == *.xcworkspace ]]; then
64+
BUILD_FLAG="-workspace"
65+
else
66+
BUILD_FLAG="-project"
67+
fi
68+
else
69+
# 自动检测
70+
if [ -f "*.xcworkspace" ]; then
71+
WORKSPACE_OR_PROJECT=$(find . -maxdepth 2 -name "*.xcworkspace" | head -1)
72+
BUILD_FLAG="-workspace"
73+
else
74+
WORKSPACE_OR_PROJECT=$(find . -maxdepth 2 -name "*.xcodeproj" | head -1)
75+
BUILD_FLAG="-project"
76+
fi
77+
fi
78+
79+
echo -e "${GREEN}使用项目: $WORKSPACE_OR_PROJECT${NC}"
80+
echo ""
81+
82+
# 构建文档(设置 hosting base path)
83+
echo -e "${GREEN}开始构建文档...${NC}"
84+
xcodebuild docbuild \
85+
$BUILD_FLAG "$WORKSPACE_OR_PROJECT" \
86+
-scheme "$SCHEME_NAME" \
87+
-destination 'generic/platform=iOS' \
88+
-derivedDataPath ./DerivedData \
89+
DOCC_HOSTING_BASE_PATH="/$HOSTING_BASE_PATH"
90+
91+
echo ""
92+
echo -e "${GREEN}查找生成的文档归档...${NC}"
93+
94+
# 查找生成的 .doccarchive(优先查找目标模块的文档)
95+
DOCC_ARCHIVE=$(find ./DerivedData -path "*/AtomicXCore/AtomicXCore.doccarchive" | head -1)
96+
97+
# 如果没找到,尝试其他路径
98+
if [ -z "$DOCC_ARCHIVE" ]; then
99+
echo -e "${YELLOW}未在标准路径找到,搜索所有 ${TARGET_MODULE}.doccarchive...${NC}"
100+
DOCC_ARCHIVE=$(find ./DerivedData -name "${TARGET_MODULE}.doccarchive" | head -1)
101+
fi
102+
103+
if [ -z "$DOCC_ARCHIVE" ]; then
104+
echo -e "${RED}错误: 未找到 .doccarchive 文件${NC}"
105+
echo -e "${YELLOW}可用的 .doccarchive 文件:${NC}"
106+
find ./DerivedData -name "*.doccarchive"
107+
exit 1
108+
fi
109+
110+
echo -e "${GREEN}✓ 找到文档归档: $DOCC_ARCHIVE${NC}"
111+
echo ""
112+
113+
# 转换为静态网站,设置 hosting-base-path
114+
echo -e "${GREEN}转换文档为静态网站...${NC}"
115+
xcrun docc process-archive transform-for-static-hosting \
116+
"$DOCC_ARCHIVE" \
117+
--output-path "$OUTPUT_DIR" \
118+
--hosting-base-path "/$HOSTING_BASE_PATH"
119+
120+
# 添加 .nojekyll 文件
121+
touch "$OUTPUT_DIR/.nojekyll"
122+
123+
echo ""
124+
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
125+
echo -e "${GREEN}✅ 文档生成完成!${NC}"
126+
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
127+
echo ""
128+
echo -e "${BLUE}输出目录:${NC} $OUTPUT_DIR"
129+
echo -e "${BLUE}Hosting Base Path:${NC} /$HOSTING_BASE_PATH/"
130+
echo -e "${BLUE}文档数量:${NC} $(find $OUTPUT_DIR/data/documentation -name "*.json" | wc -l | tr -d ' ') 个 JSON 文件"
131+
echo ""
132+
echo -e "${YELLOW}📚 GitHub Pages URL:${NC}"
133+
echo -e " https://tencent-rtc.github.io/$HOSTING_BASE_PATH/documentation/atomicxcore"
134+
echo ""
135+
echo -e "${YELLOW}🔍 本地预览:${NC}"
136+
echo -e " 运行: ${GREEN}./local_preview.sh${NC}"
137+
echo -e " 访问: http://localhost:8080/$HOSTING_BASE_PATH/documentation/atomicxcore"
138+
echo ""

docs/.nojekyll

Whitespace-only changes.
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/css/topic.4be8f56d.css

Lines changed: 0 additions & 9 deletions
This file was deleted.

docs/css/topic.59e2bdb7.css

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/css/tutorials-overview.7942d777.css

Lines changed: 0 additions & 9 deletions
This file was deleted.

docs/css/tutorials-overview.9c2b2457.css

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/data/documentation/atomicxcore.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)