生成tbd文件 - ShenYj/ShenYj.github.io GitHub Wiki
tbd
格式文件,本身是通过 Xcode 内置工具 tapi-installapi
专门来生成的,具体路径为:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/tapi installapi
- 可以使用
man tapi
查看帮助文档
-
准备一个
framework
动态库的项目 -
Build Settings - Text-Based API
下将Supports Text-Based InstallAPI
设置为YES
-
然后,通过
Other Text-Based InstallAPI Flags
给tapi-installapi
工具传递参数-
常用的参数有:
-
-ObjC
:将输入文件视为Objective-C文件(默认) -
-ObjC++
:将输入文件视为Objective-C++文件 -
-x<语言>
:值为c、c++、Objective-c和Objective-c++ -
-Xparser <arg>
:传递参数给clang parser。常用参数有:-Wno-deprecated-declarations、-Wno-unavailable-declarations -
-exclude-public-header <path>
:引入的需要解析的public头文件路径
-
-
e.g.
如果使用
.modulemap
文件,也是使用-exclude-public-header <path>
配置 -
-
再次编译运行就会生成
.tbd
文件--- !tapi-tbd tbd-version: 4 targets: [ x86_64-ios-simulator ] uuids: - target: x86_64-ios-simulator value: 52503CB6-0A05-36B7-830D-1BA2C9DD1CC1 flags: [ not_app_extension_safe ] install-name: '@rpath/TBDFramework.framework/TBDFramework' exports: - targets: [ x86_64-ios-simulator ] symbols: [ _TBDFrameworkVersionNumber, _TBDFrameworkVersionString ] ...
tbd
本质上就是一个YAML 描述的文本文件。
YAML是一个可读性高,用来表达数据序列化的格式。
tbd
的作用是用于记录链接动态库的必要信息,包括动态库导出符号、动态库的架构信息、动态库的依赖信息、动态库的链接路径等。
这里只是演示了如何生成一份
tbd
文件