-
Notifications
You must be signed in to change notification settings - Fork 30
/
build.py
executable file
·60 lines (49 loc) · 1.8 KB
/
build.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
#!/usr/bin/env python
import optparse
import os
import re
import shutil
# Location of compiler
MXMLC_PATH = 'mxmlc -debug -verbose-stacktraces -incremental=true -compiler.strict -compiler.show-actionscript-warnings -static-link-runtime-shared-libraries=true'
# For replacing .as with .swf
as_re = re.compile('\.as$|\.mxml$')
def flex_pilot():
cmd = MXMLC_PATH + ' -source-path=./src ./src/org/flex_pilot/FlexPilot.as -o ./org/flex_pilot/FlexPilot.swf'
os.system(cmd)
def bootstrap():
cmd = MXMLC_PATH + ' -source-path=./src ./src/org/flex_pilot/FPBootstrap.as -o ./org/flex_pilot/FPBootstrap.swf'
os.system(cmd)
def clean():
for root, dirs, file_list in os.walk('./'):
for file in file_list:
if file.endswith('.swf') or file.endswith('.swc') or file.endswith('.swf.cache'):
path = root + '/' + file
cmd = 'rm ' + path
#print cmd
os.system(cmd)
def parse_opts():
parser = optparse.OptionParser()
parser.add_option('-t', '--target', dest='target',
help='build TARGET (flex_pilot/bootstrap/all/clean, default is all)',
metavar='TARGET', choices=('flex_pilot', 'bootstrap', 'all', 'clean'), default='all')
opts, args = parser.parse_args()
return opts, args
def main(o, a):
target = o.target
# Build only the AS tests into loadable swfs
if target == 'flex_pilot':
flex_pilot()
# Build only the test app we use to run the tests against
elif target == 'bootstrap':
bootstrap()
# Build everything, natch
elif target == 'all':
flex_pilot()
bootstrap()
# Clean out any swfs in the directory
elif target == 'clean':
clean()
else:
print 'Not a valid target.'
if __name__ == "__main__":
main(*parse_opts())