博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
简陋的swift carthage copy-frameworks 辅助脚本
阅读量:6800 次
发布时间:2019-06-26

本文共 4275 字,大约阅读时间需要 14 分钟。

在看 carthage 时,其中需要配置一个 copy-frameworks 脚本,此脚本特殊的地方,需要手动填写 Input Files 和 Output Files.一个一个填写,很糟心~

观察了下,对应修改的是 xxx.xcodeproj/project.pbxproj 中这个文本文件的特定位置的字段,类似于:

/* Begin PBXShellScriptBuildPhase section */        750D68EC2000817C006235CD /* ShellScript */ = {            isa = PBXShellScriptBuildPhase;            buildActionMask = 2147483647;            files = (            );            inputPaths = (                "$(SRCROOT)/Carthage/Build/iOS/Alamofire.framework",            );            outputPaths = (                "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Alamofire.framework",            );            runOnlyForDeploymentPostprocessing = 0;            shellPath = /bin/sh;            shellScript = "/usr/local/bin/carthage copy-frameworks";        };/* End PBXShellScriptBuildPhase section */

所以,就像着,自动生成 inputPathsoutputPaths ,然后直接手动修改 project.pbxproj 文件,试了下,可行.简单 nodejs 脚本如下:

var glob = require("glob")// options is optionallet frameWorks = glob.sync("**/*.framework", {  cwd: "path/to/Carthage/Build/iOS/",})console.log(frameWorks)let inputPaths = frameWorks.filter(p=>!p.includes("test")&&!p.includes("Test")).map((p)=>`$(SRCROOT)/Carthage/Build/iOS/${p}`)let outputPaths = frameWorks.filter(p=>!p.includes("test")&&!p.includes("Test")).map((p)=>`$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/${p}`)console.log(inputPaths)console.log(outputPaths)/*控制台的单引号,要手动全局替换为双引号.[ "$(SRCROOT)/Carthage/Build/iOS/Alamofire.framework",  "$(SRCROOT)/Carthage/Build/iOS/Bond.framework",  "$(SRCROOT)/Carthage/Build/iOS/Differ.framework",  "$(SRCROOT)/Carthage/Build/iOS/HEXColor.framework",  "$(SRCROOT)/Carthage/Build/iOS/KeychainAccess.framework",  "$(SRCROOT)/Carthage/Build/iOS/Kingfisher.framework",  "$(SRCROOT)/Carthage/Build/iOS/Lottie.framework",  "$(SRCROOT)/Carthage/Build/iOS/Moya.framework",  "$(SRCROOT)/Carthage/Build/iOS/ObjectMapper.framework",  "$(SRCROOT)/Carthage/Build/iOS/PKHUD.framework",  "$(SRCROOT)/Carthage/Build/iOS/ReactiveKit.framework",  "$(SRCROOT)/Carthage/Build/iOS/ReactiveMoya.framework",  "$(SRCROOT)/Carthage/Build/iOS/ReactiveSwift.framework",  "$(SRCROOT)/Carthage/Build/iOS/Realm.framework",  "$(SRCROOT)/Carthage/Build/iOS/RealmSwift.framework",  "$(SRCROOT)/Carthage/Build/iOS/Result.framework",  "$(SRCROOT)/Carthage/Build/iOS/RxBlocking.framework",  "$(SRCROOT)/Carthage/Build/iOS/RxCocoa.framework",  "$(SRCROOT)/Carthage/Build/iOS/RxMoya.framework",  "$(SRCROOT)/Carthage/Build/iOS/RxSwift.framework",  "$(SRCROOT)/Carthage/Build/iOS/SideMenu.framework",  "$(SRCROOT)/Carthage/Build/iOS/SnapKit.framework",  "$(SRCROOT)/Carthage/Build/iOS/SwiftyTimer.framework" ][ "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Alamofire.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Bond.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Differ.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/HEXColor.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/KeychainAccess.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Kingfisher.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Lottie.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Moya.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/ObjectMapper.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/PKHUD.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/ReactiveKit.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/ReactiveMoya.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/ReactiveSwift.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Realm.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/RealmSwift.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Result.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/RxBlocking.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/RxCocoa.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/RxMoya.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/RxSwift.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/SideMenu.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/SnapKit.framework",  "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/SwiftyTimer.framework" ]*/

参考:

转载地址:http://viywl.baihongyu.com/

你可能感兴趣的文章
【设计模式】代理模式
查看>>
linux脚本获取系统信息(选自实验楼实验)
查看>>
俄罗斯游戏软件:C语言应用初步感受
查看>>
PHP5.4+内置webserver,Yii中如何隐藏index.php,让URL rewrite
查看>>
linux开机启动服务设置
查看>>
Rtree实现多维空间搜索
查看>>
awk详解
查看>>
j2ee 简单网站搭建:(九)jquery datatables + jquery ui dialog 插件使用入门
查看>>
决心书
查看>>
异步8月书讯:重磅新书《人工智能(第2版)》不可错过
查看>>
软件评测-信息安全-应用安全-资源控制-用户登录限制(上)
查看>>
sudo
查看>>
11月机房技术指标
查看>>
功能表单之人员构造器字段类型详解——JEPLUS软件快速开发平台
查看>>
全球积分宝:混币圈需要怎么样的活法?
查看>>
李开复:人工智能对人类真正的威胁是什么?
查看>>
CentOS 6.*/7 防火墙放行端口
查看>>
docker pipework 实现跨宿主主机容器互联
查看>>
Hutool之正则表达式工具类——ReUtil
查看>>
execute、executeQuery和executeUpdate之间的区别
查看>>