blob: 9c15a5170664f0cd3b91c82456019f549472a3c0 [file] [log] [blame]
Ray Milkeye88d69b2016-12-16 17:09:13 -08001include_defs('//onos.defs')
2
3def _get_name():
4 base_path = get_base_path()
5 return ONOS_ARTIFACT_BASE + base_path.replace('/', '-') #TODO Unix-separator
6
7def yang_osgi_jar(
8 name = None,
9 srcs = None,
10 group_id = ONOS_GROUP_ID,
11 version = ONOS_VERSION,
12 deps = [],
13 visibility = ['PUBLIC'],
14 license = 'NONE',
15 **kwargs
16 ):
17
18 if name is None:
19 name = _get_name()
20
21 yang_jar = name + '-yang'
22 bnd_jar = name + '-bnd'
23
24 args = { 'group':group_id, 'artifact':name, 'version':version }
25
26 yang_library(
27 deps = deps,
28 name = yang_jar,
29 srcs = srcs,
30 visibility = [ ],
31 )
32
33 cmd = 'java -jar $(location //lib:bndexe) wrap -o $OUT '
34 cmd += '-b %(group)s.%(artifact)s ' % args
35 cmd += '-v ' + version.replace('-', '.') + ' '
36 cmd += '$(location :%s) ' % yang_jar
37 cmd += ' >/dev/null 2>&1'
38
39 genrule(
40 name = bnd_jar,
41 bash = cmd,
42 out = name + '.jar',
43 visibility = [],
44 )
45
46 prebuilt_jar(
47 name = name,
48 binary_jar = ':' + bnd_jar,
49 maven_coords = '%(group)s:%(artifact)s:%(version)s'%args,
50 visibility = visibility,
51 )