-
Notifications
You must be signed in to change notification settings - Fork 5
/
jenkins.py
executable file
·121 lines (109 loc) · 2.61 KB
/
jenkins.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
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
#!/usr/bin/env python3
import argparse
import os
import shutil
import subprocess
import sys
parser = argparse.ArgumentParser(description="Testing script")
parser.add_argument('--toolchain', help='Toolchain', required=True)
parser.add_argument(
'--export-file',
action='store_true',
help='Use extra file with exports symbols'
)
parser.add_argument(
'--static',
action='store_true',
help='Build static libraries'
)
cmd_args = parser.parse_args()
top_dir = os.getcwd()
install_dir = os.path.join(top_dir, '_install')
def do_call(args, working_dir=top_dir):
os.chdir(working_dir)
oneline = ''
for i in args:
oneline += ' "{}"'.format(i)
print('[{}]>{}'.format(os.getcwd(), oneline))
try:
subprocess.check_call(args, env=os.environ)
os.chdir(top_dir)
except subprocess.CalledProcessError as error:
print(error)
print(error.output)
sys.exit(1)
if os.name == 'nt':
do_call(['where', 'cmake'])
else:
do_call(['which', 'cmake'])
do_call(['cmake', '--version'])
do_call([
'polly.py',
'--toolchain',
cmd_args.toolchain,
'--verbose',
'--install',
'--ios-combined',
'--ios-multiarch',
'--config',
'Release',
'--fwd',
'CMAKE_CONFIGURATION_TYPES=Release',
'CMAKE_INSTALL_PREFIX={}'.format(install_dir)
],
working_dir='foo'
)
do_call([
'polly.py',
'--toolchain',
cmd_args.toolchain,
'--verbose',
'--install',
'--ios-combined',
'--ios-multiarch',
'--config',
'Release',
'--fwd',
'CMAKE_CONFIGURATION_TYPES=Release',
'CMAKE_INSTALL_PREFIX={}'.format(install_dir)
],
working_dir='boo'
)
export_file = 'NO'
if cmd_args.export_file:
export_file = 'YES'
shared_libs = 'YES'
if cmd_args.static:
shared_libs = 'NO'
do_call([
'polly.py',
'--toolchain',
cmd_args.toolchain,
'--verbose',
'--install',
'--ios-combined',
'--ios-multiarch',
'--config',
'Release',
'--fwd',
'CMAKE_CONFIGURATION_TYPES=Release',
'BUILD_SHARED_LIBS={}'.format(shared_libs),
'EXPORT_FILE={}'.format(export_file),
'CMAKE_INSTALL_PREFIX={}'.format(install_dir)
],
working_dir='bar'
)
do_call([
'polly.py',
'--toolchain',
cmd_args.toolchain,
'--verbose',
'--config',
'Release',
'--fwd',
'BUILD_SHARED_LIBS={}'.format(shared_libs),
'CMAKE_CONFIGURATION_TYPES=Release',
'CMAKE_PREFIX_PATH={}'.format(install_dir)
],
working_dir='baz'
)