Skip to content

Commit dd93da3

Browse files
author
no4mular
committed
第一次提交
0 parents  commit dd93da3

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

autoPkg.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/usr/bin/python
2+
3+
'''
4+
@date 2016-12-30
5+
'''
6+
7+
'''scheme default is the workspace prefix '''
8+
9+
import os
10+
import shutil
11+
12+
def createPlist(isEnterprise, method):
13+
fp = os.open("/Users/wanghe/Desktop/AutoPkg.plist",os.O_CREAT|os.O_RDWR|os.O_APPEND)
14+
if fp != None:
15+
os.write(fp,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
16+
os.write(fp,"<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n")
17+
os.write(fp,"<plist version=\"1.0\">\n")
18+
os.write(fp,"<dict>\n")
19+
# method
20+
os.write(fp,"<key>method</key>\n")
21+
os.write(fp,"<string>%s</string>\n" % method)
22+
# uploadSymbols
23+
os.write(fp,"<key>uploadSymbols</key>\n")
24+
os.write(fp,"<false/>\n")
25+
# uploadBitcode
26+
os.write(fp,"<key>uploadBitcode</key>\n")
27+
os.write(fp,"<false/>\n")
28+
# compileBitcode
29+
os.write(fp,"<key>compileBitcode</key>\n")
30+
os.write(fp,"<true/>\n")
31+
# embedOnDemandResourcesAssetPacksInBundle
32+
os.write(fp,"<key>embedOnDemandResourcesAssetPacksInBundle</key>\n")
33+
os.write(fp,"<true/>\n")
34+
# iCloudContainnerEnvironment
35+
os.write(fp,"<key>iCloudContainnerEnvironment</key>\n")
36+
os.write(fp,"<true/>\n")
37+
os.write(fp,"</dict>\n")
38+
os.write(fp,"</plist>\n")
39+
os.close(fp)
40+
return "~/Desktop/AutoPkg.plist"
41+
42+
43+
44+
workPath = "/Users/wanghe/Documents/ADPlatform/"
45+
try:
46+
os.system("cd %s" % workPath)
47+
except IOError:
48+
print("no such directory")
49+
sys.exit()
50+
51+
52+
workFiles = os.listdir(workPath)
53+
print(workFiles)
54+
workspaceName = None
55+
projectName = None
56+
57+
for eachFile in workFiles:
58+
if "xcworkspace" in eachFile:
59+
workspaceName = eachFile
60+
break
61+
62+
if workspaceName != None:
63+
scheme = workspaceName.split(".")[0]
64+
xcarchiveFilePath = "%sbuild/%s.xcarchive" % (workPath, scheme)
65+
ret = os.system("cd %s; xcodebuild clean; xcodebuild -workspace %s -scheme %s -configuration Release -archivePath %s archive" % (workPath, workspaceName, scheme, xcarchiveFilePath))
66+
if ret == 0:
67+
os.system("cd %s; xcodebuild -configuration Release -archivePath %s -exportArchive -exportPath ~/Desktop/ExportPath/ -exportOptionsPlist %s" % (workPath, xcarchiveFilePath, createPlist(True,"development"))) #if error with no applicable device , you can run shell 'rvm system'

0 commit comments

Comments
 (0)