This repository has been archived by the owner on Mar 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.py
executable file
·67 lines (49 loc) · 2.42 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
59
60
61
62
63
64
65
66
67
#!/usr/bin/python
import sys
import os
import argparse
sys.path.insert(0, os.path.abspath('.%ssrc' % os.sep))
from AppSvcsBuilder import AppSvcsBuilder
parser = argparse.ArgumentParser(description='Build script for the App Service Integration iApp template')
parser.add_argument("-a", "--append", default="", help="A string to append to the base template name")
parser.add_argument("-b", "--bundledir", default="bundled"+os.sep, help="The directory to use for bundled resources")
parser.add_argument("-d", "--docsdir", default="docs"+os.sep, help="The root directory for documentation")
parser.add_argument("-D", "--debug", default=False, action="store_true", help="Enable debug output")
parser.add_argument("-nd", "--nodocs", default=False, action="store_true", help="Do not build the documentation")
parser.add_argument("-o", "--outfile", help="The name of the output file")
parser.add_argument("-p", "--preso", default="src"+os.sep+"presentation_layer.json", help="The presentation layer JSON schema")
parser.add_argument("-r", "--roottmpl", default="src"+os.sep+"master.template", help="The root template file to use (default: <basedir>/src/master.template")
parser.add_argument("-w", "--workingdir", default=os.getcwd(), help="The root directory of source tree")
parser.add_argument("-x", "--extended", default=False, action="store_true", help="Enable extended build output")
args = parser.parse_args()
b = AppSvcsBuilder(**vars(args))
if not os.path.isdir(args.workingdir + os.sep + 'tmp'):
os.mkdir('tmp')
if not os.path.isdir(args.workingdir + os.sep + 'parts'):
os.mkdir('parts')
if len(args.append) > 0:
print "Appending \"%s\" to template name" % args.append
print "Generating APL..."
b.buildAPL()
print "Assembling main template..."
b.buildTemplate()
if not args.extended:
null = open(os.devnull, 'w')
sys.stdout = null
print "Assembling TCL only template..."
args.outfile = 'parts' + os.sep + 'iapp.tcl'
args.roottmpl = 'src' + os.sep + 'implementation_only.template'
b.buildTemplate(**vars(args))
print "Assembling APL only template..."
args.outfile = 'parts' + os.sep + 'iapp.apl'
args.roottmpl = 'tmp' + os.sep + 'apl.build'
b.buildTemplate(**vars(args))
if not args.extended:
sys.stdout = sys.__stdout__
if not args.nodocs:
print "Generating docs..."
os.system("cd docs && make clean && make html && cd ..")
os.remove(os.path.join('tmp','apl.build'))
os.remove(os.path.join('tmp','bundler.build'))
os.rmdir('tmp')
print "Finished building"