onos_app.bucklet
1.85 KB
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
ONOS_ORIGIN = 'ON.Lab'
ONOS_VERSION = '1.6.0-SNAPSHOT'
DEFAULT_APP_CATEGORY = 'Utility'
def onos_app(
app_name,
title,
version = ONOS_VERSION,
origin = ONOS_ORIGIN,
category = DEFAULT_APP_CATEGORY,
url = None,
description = None, #TODO make this a file
#TODO icon,
feature_coords = None,
required_features = [ 'onos-api' ],
required_apps = [],
included_bundles = [],
excluded_bundles = [],
**kwargs):
if not feature_coords and len(included_bundles) == 1:
feature_coords = '$(maven_coords %s)' % included_bundles[0]
args = [ '-n %s' % feature_coords,
'-v %s' % version,
'-t "%s"' % title,
'-o "%s"' % origin,
'-c "%s"' % category,
'-a "%s"' % app_name,
'-u %s' % url,
]
args += [ '-f %s' % f for f in required_features ]
args += [ '-b $(maven_coords %s)' % b for b in included_bundles ]
args += [ '-e $(maven_coords %s)' % b for b in excluded_bundles ]
args += [ '-d %s' % a for a in required_apps ]
cmd = '$(exe //buck-tools:onos-app-writer) -F ' + ' '.join(args) + ' > $OUT'
genrule(
name = 'app-features',
bash = cmd,
out = 'features.xml',
visibility = [],
)
cmd = '$(exe //buck-tools:onos-app-writer) -A ' + ' '.join(args) + ' > $OUT'
genrule(
name = 'app-xml',
bash = cmd,
out = 'app.xml',
visibility = [],
)
sources = [
'$(location :app-features) %s' % feature_coords,
'$(location :app-xml) NONE',
]
sources += ['$(location %s) $(maven_coords %s)' % (i, i) for i in included_bundles]
genrule(
name = 'app-oar',
out = 'app.oar',
bash = '$(exe //buck-tools:onos-app-oar) $OUT ' + ' '.join(sources)
)