blob: 027d4fe8cd355da30bfecbcca9809f6228459758 [file] [log] [blame]
Brian O'Connor1f165982016-04-06 21:36:09 -07001ONOS_ORIGIN = 'ON.Lab'
2ONOS_VERSION = '1.6.0-SNAPSHOT'
3DEFAULT_APP_CATEGORY = 'Utility'
4
5def onos_app(
6 app_name,
7 title,
8 version = ONOS_VERSION,
9 origin = ONOS_ORIGIN,
10 category = DEFAULT_APP_CATEGORY,
11 url = None,
12 description = None, #TODO make this a file
13 #TODO icon,
14 feature_name = None,
15 required_features = [ 'onos-api' ],
16 required_apps = [],
17 included_bundles = [],
18 excluded_bundles = [],
19 **kwargs):
20
21 if not feature_name and len(included_bundles) == 1:
22 feature_name = included_bundles[0][1]
23
24 args = [ '-n %s' % feature_name,
25 '-v %s' % version,
26 '-t "%s"' % title,
27 '-o "%s"' % origin,
28 '-c "%s"' % category,
29 '-a "%s"' % app_name,
30 '-u %s' % url,
31 ]
32 args += [ '-f %s' % f for f in required_features ]
33 args += [ '-b %s' % b for (t, b) in included_bundles ]
34 args += [ '-e %s' % b for (t, b) in excluded_bundles ]
35 args += [ '-d %s' % a for a in required_apps ]
36
37 cmd = '$(exe //buck-tools:onos-app-writer) -F ' + ' '.join(args) + ' > $OUT'
38 genrule(
39 name = 'app-features',
40 bash = cmd,
41 out = '%s-%s-features.xml' % (feature_name.split(':')[1], version),
42 visibility = [],
43 )
44 cmd = '$(exe //buck-tools:onos-app-writer) -A ' + ' '.join(args) + ' > $OUT'
45 genrule(
46 name = 'app-xml',
47 bash = cmd,
48 out = 'app.xml',
49 visibility = [],
50 )
51
52 sources = [
53 '$(location :app-features) %s' % feature_name,
54 '$(location :app-xml) NONE',
55 ]
56 sources += ['$(location %s) %s' % i for i in included_bundles]
57 genrule(
58 name = 'app-oar',
59 out = 'app.oar',
60 bash = '$(exe //buck-tools:onos-app-oar) $OUT ' + ' '.join(sources)
61 )