| include_defs('//onos.defs') |
| |
| def _get_name(): |
| base_path = get_base_path() |
| return ONOS_ARTIFACT_BASE + base_path.replace('/', '-') #TODO Unix-separator |
| |
| def yang_osgi_jar( |
| name = None, |
| srcs = None, |
| group_id = ONOS_GROUP_ID, |
| version = ONOS_VERSION, |
| deps = [], |
| visibility = ['PUBLIC'], |
| license = 'NONE', |
| **kwargs |
| ): |
| |
| if name is None: |
| name = _get_name() |
| |
| yang_jar = name + '-yang' |
| bnd_jar = name + '-bnd' |
| |
| args = { 'group':group_id, 'artifact':name, 'version':version } |
| |
| yang_library( |
| deps = deps, |
| name = yang_jar, |
| srcs = srcs, |
| visibility = [ ], |
| ) |
| |
| cmd = 'java -jar $(location //lib:bndexe) wrap -o $OUT ' |
| cmd += '-b %(group)s.%(artifact)s ' % args |
| cmd += '-v ' + version.replace('-', '.') + ' ' |
| cmd += '$(location :%s) ' % yang_jar |
| cmd += ' >/dev/null 2>&1' |
| |
| genrule( |
| name = bnd_jar, |
| bash = cmd, |
| out = name + '.jar', |
| visibility = [], |
| ) |
| |
| prebuilt_jar( |
| name = name, |
| binary_jar = ':' + bnd_jar, |
| maven_coords = '%(group)s:%(artifact)s:%(version)s'%args, |
| visibility = visibility, |
| ) |