开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
1 Star 3 Fork 0

raychow-python/iosMixTools

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (1)
master
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
项目仓库所选许可证以仓库主分支所使用许可证为准
master
分支 (1)
master
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (1)
master
iosMixTools
/
python_rebuild_link.py
iosMixTools
/
python_rebuild_link.py
python_rebuild_link.py 8.09 KB
一键复制 编辑 原始数据 按行查看 历史
周启睿 提交于 2021年11月15日 14:38 +08:00 . no message
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
#! /usr/bin/python
# -*- coding: UTF-8 -*-
import os, sys
import shutil
import time
import codecs
import argparse
import shutil
reload(sys)
sys.setdefaultencoding("utf-8")
class RebuildBase(object):
def __init__(self):
pass
def runTask(self, curPath):
pass
class RebuildHeaderTool(RebuildBase):
def runTask(self, curPath):
headersPath = curPath + os.sep + 'Headers'
if os.path.exists(headersPath):
shutil.rmtree(headersPath)
os.mkdir(headersPath)
list = []
self.listDir(curPath, list)
list = self.filterExtName(list, '.h')
cmd = ''
for path in list:
# path = ''
fileName = path[path.rfind(os.sep) + 1:]
linkPath = headersPath + os.sep + fileName
srcPath = path
self.makeCmdLink(linkPath, srcPath, curPath, headersPath)
print("重置主工程索引成功")
return [headersPath]
# oneCmd = "ln" + " " + "-s" + " " + srcPath + " " + linkPath
# cmd = cmd + " " + oneCmd
# print(cmd)
# os.system(cmd)
# 生成替身
def makeCmdLink(self, tarPath, srcPath, curPath, headersPath):
srcPath = ".." + srcPath.replace(curPath, "")
oneCmd = "ln" + " " + "-s" + " " + srcPath + " " + tarPath
cdCmd = "cd " + headersPath
cmd = cdCmd + "&&" + oneCmd
# print(cmd)
os.system(oneCmd)
pass
# 过滤指定后缀名
def filterExtName(self, list, extName):
rstList = []
for text in list:
if text.lower().rfind(extName.lower()) > 0:
rstList.append(text)
return rstList
# 递归文件
def listDir(self, path, list_name): # 传入存储的list
for file in os.listdir(path):
file_path = os.path.join(path, file)
if os.path.isdir(file_path):
self.listDir(file_path, list_name)
else:
list_name.append(file_path)
class RebuildPodTool(RebuildBase):
def runTask(self, curPath):
list = []
self.listDir(curPath, list)
headersPath = []
for path in list:
folder_path = path[0:path.rfind(os.sep)]
if folder_path in headersPath or folder_path == path:
pass
else:
headersPath.append(folder_path)
print("获取POD引用路径成功")
return headersPath
def listDir(self, path, list_name):
for file in os.listdir(path):
file_path = os.path.join(path, file)
if os.path.isdir(file_path):
self.listDir(file_path, list_name)
else:
list_name.append(file_path)
class RebuildProject(RebuildBase):
def runTask(self, sub_module_path, headersPathList):
# cmd = "/usr/libexec/Plistbuddy - c 'Set :Software:Gallery:Version "1.1"' ~/Desktop/com.sample.plist"
text = ''
for path in headersPathList:
text = text + "\"" + path + "\"" + ',' + "\n"
# text = text + path + ','
# cmd = "/usr/libexec/Plistbuddy - c 'Set:0B9F2A9E1D24EC9A00136C8B:buildSettings:HEADER_SEARCH_PATHS " + "\"" + text + "\" \' " + sub_module_path
# print(cmd)
# os.system(cmd)
file_object = open(sub_module_path,"r+")
try:
file_context = file_object.read()
list = file_context.split("HEADER_SEARCH_PATHS");
if len(list) > 2:
startText = list[0]
debugText = list[1]
releaseText = list[2]
debugText = debugText[debugText.find(");"):]
debugText = "HEADER_SEARCH_PATHS = (\n" + text + debugText
releaseText = releaseText[releaseText.find(");"):]
releaseText = "HEADER_SEARCH_PATHS = (\n" + text + releaseText
rstText = startText + debugText + releaseText
file_object.close()
os.remove(sub_module_path)
file_object = open(sub_module_path, "w")
file_object.seek(0)
file_object.write(rstText);
file_object.close()
else:
list = file_context.split("CODE_SIGN_STYLE");
startText = list[0]
debugText = list[1]
releaseText = list[2]
search_path = "HEADER_SEARCH_PATHS = (\n" + text + "\n)"
debugText = "CODE_SIGN_STYLE " + debugText[debugText.find("="):]
debugText = debugText[:debugText.find(";")] + ";\n" + search_path + debugText[debugText.find(";"):]
releaseText = "CODE_SIGN_STYLE " + releaseText[releaseText.find("="):]
releaseText = releaseText[:releaseText.find(";")] + ";\n" + search_path + releaseText[releaseText.find(";"):]
rstText = startText + debugText + releaseText
file_object.close()
os.remove(sub_module_path)
file_object = open(sub_module_path, "w")
file_object.seek(0)
file_object.write(rstText);
file_object.close()
print("重建索引成功" + sub_module_path)
except:
print("重建索引失败" + sub_module_path)
finally:
pass
# ----------------------------------------------------main------------------------------------------------
def parse_args():
global script_path, proj_ios_path
parser = argparse.ArgumentParser(description='模块重建索引脚本.\n')
parser.add_argument('--rebuild_folder_name', dest='rebuild_folder_name', type=str, required=False, default="",
help='需要重建索引的文件夹名字,该文件夹必须与脚本在同级目录')
parser.add_argument('--main_project_dir', dest='main_project_dir', type=str, required=False, default="",
help='主项目相对于工程路径')
args = parser.parse_args()
return args
def main():
startTime = time.time()
global headersPathList
app_args = parse_args()
rebuild_folder_name = app_args.rebuild_folder_name
main_project_dir = app_args.main_project_dir
rebuild_folder_name = "TouchTV-Report"
main_project_dir = 'TouchTV-Report.xcodeproj/project.pbxproj'
pod_public_folder_name = "Pods/Headers/Public"
pod_private_folder_name = "Pods/Headers/Private"
sub_module_list = ['ModuleMine/ModuleMine.xcodeproj/project.pbxproj','ModuleSquare/ModuleSquare.xcodeproj/project.pbxproj']
workSpacePath = os.getcwd()
# sub_module_path = workSpacePath + os.sep + sub_module_list[0]
# projectTool = RebuildProject()
# projectTool.runTask(sub_module_path, [])
# 执行重建索引脚本
if len(rebuild_folder_name) > 0:
indexTool = RebuildHeaderTool()
curPath = workSpacePath + os.sep + rebuild_folder_name
if os.path.exists(curPath):
headersPathList = indexTool.runTask(curPath)
# 重建POD public索引
podPath = workSpacePath + os.sep + pod_public_folder_name
if os.path.exists(podPath):
podTool = RebuildPodTool()
list = podTool.runTask(podPath)
for tmp in list:
if tmp != podPath:
headersPathList.append(tmp)
# 重建POD private索引
podPath = workSpacePath + os.sep + pod_private_folder_name
if os.path.exists(podPath):
podTool = RebuildPodTool()
list = podTool.runTask(podPath)
for tmp in list:
if tmp != podPath:
headersPathList.append(tmp)
# 获取重建列表
rebuildList = []
for tmp in headersPathList:
aa = tmp.replace(workSpacePath, '$(SRCROOT)/..')
rebuildList.append(aa)
print("\"" + aa + "\"" + ',')
# 重建项目
for sub_module_path in sub_module_list:
sub_module_path = workSpacePath + os.sep + sub_module_path
if os.path.exists(sub_module_path):
projectTool = RebuildProject()
projectTool.runTask(sub_module_path, rebuildList)
endTime = time.time()
print("总耗时: %0.2f" % (endTime - startTime))
if __name__ == "__main__":
main()
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/raycho-python/iosMixTools.git
git@gitee.com:raycho-python/iosMixTools.git
raycho-python
iosMixTools
iosMixTools
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /