forked from answer-huang/dSYMTools
-
Notifications
You must be signed in to change notification settings - Fork 1
/
RunScript.py
48 lines (36 loc) · 1.3 KB
/
RunScript.py
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
#coding=utf-8
"""
* User: answer.huang
* Email: [email protected]
* Date: 14-7-28
* Time: 23:36
* Blog: answerhuang.duapp.com
"""
import os
import sys
import time
import shutil
import sqlite3
print os.environ["EFFECTIVE_PLATFORM_NAME"]
print os.environ["DWARF_DSYM_FOLDER_PATH"]
if os.environ["BUILD_STYLE"] == "Debug":
print "跳过debug模式"
sys.exit()
if os.environ["EFFECTIVE_PLATFORM_NAME"] == "-iphonesimulator":
print "跳过模拟器编译情况"
sys.exit()
dsym_folder_path = os.environ["DWARF_DSYM_FOLDER_PATH"]
dsym_file_name = os.environ["DWARF_DSYM_FILE_NAME"]
src_path = os.path.join(dsym_folder_path, dsym_file_name)
executable_name = os.environ["EXECUTABLE_NAME"]
relative_dest_path = "dSYM/%s.%s.app.dSYM" % (executable_name, time.strftime('%Y%m%d%H%M%S', time.localtime(time.time())))
dest_path = os.path.join(os.environ["PROJECT_DIR"], relative_dest_path)
print "moving %s to %s" % (src_path, dest_path)
shutil.move(src_path, dest_path)
if os.path.exists(dest_path):
sqlitedb = "/Applications/dSYM.app/Contents/Resources/dsym.db"
cx = sqlite3.connect(sqlitedb)
cu = cx.cursor()
cu.execute("""create table if not exists archives (file_path varchar(10) unique)""")
cu.execute("insert into archives values (?)", (dest_path, ))
cx.commit()