BUCK 1.5 KB
KARAF = '//lib:apache-karaf'
BRANDING = '//tools/package/branding:onos-tools-package-branding'

FEATURES = [
  '//features:onos-thirdparty-base',
  '//features:onos-thirdparty-web',
  '//features:onos-api',
  '//features:onos-core',
  '//features:onos-incubator',
  '//features:onos-rest',
  '//features:onos-gui',
  '//features:onos-cli',
#'//features:onos-security',
]

#TODO move to buck-tools
export_file (
  name = 'onos-prep-karaf',
)

genrule(
  name = 'onos-karaf',
  srcs = glob(['bin/*', 'etc/*', 'init/*']),
  bash = '$(location :onos-prep-karaf) $OUT $(location %s) %s $(location %s)'\
            % (KARAF, ONOS_VERSION, BRANDING),
  out = 'karaf.zip',
)

compile_features(
  name = 'onos-features',
  features = FEATURES,
  maven_coords = 'org.onosproject:onos-features:xml:features:' + ONOS_VERSION,
)

staged_repos = ['$(location %s-repo)' % f for f in FEATURES]
staged_apps = ['$(location %s)' % a for a in APPS]

# feature_coords = 'foo:bar:1.3'
sources = [ '$(location :onos-features)', ]
sources += staged_repos + staged_apps

genrule(
  name = 'onos-package',
  srcs = glob(['bin/*', 'etc/*', 'init/*', 'config/*']),
  out = 'onos.tar.gz',
  bash = '$(exe //buck-tools:onos-stage) $OUT ' + ONOS_VERSION + ' $(location :onos-karaf) ' + ' '.join(sources),
  visibility = [ 'PUBLIC' ],
)

genrule(
  name = 'onos-run',
  out = 'onos-run',
  srcs = [ 'onos-run-karaf' ],
  bash = 'sed "s#ONOS_TAR=#ONOS_TAR=$(location :onos-package)#" $SRCS > $OUT; chmod +x $OUT',
  executable = True,
  visibility = [ 'PUBLIC' ],
)