blob: 26638d4cf158f6a99537def6a102115869690018 [file] [log] [blame]
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -07001load("//tools/build/bazel:generate_workspace.bzl", "ONOS_VERSION")
2
3KARAF = "@apache_karaf//file"
4PATCHES = "@apache_karaf_patches//file"
5BRANDING = "//tools/package/branding:onos-tools-package-branding"
6
Thomas Vachuska0f956032018-06-12 10:41:12 -07007BRANDED_KARAF_REQUIREMENTS = [
8 KARAF,
9 PATCHES,
10 BRANDING,
11]
12
13# Generates auxiliary karaf.zip file; branded and augmented with ONOS runtime tools
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070014genrule(
15 name = "onos-karaf",
Thomas Vachuska0f956032018-06-12 10:41:12 -070016 srcs = BRANDED_KARAF_REQUIREMENTS + glob(["bin/*", "etc/*", "init/*", "runtime/bin/*"]),
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070017 outs = ["karaf.zip"],
Thomas Vachuska0f956032018-06-12 10:41:12 -070018 cmd = "$(location onos-prep-karaf) $(location karaf.zip) $(location %s) %s $(location %s) $(location %s) tools/package" \
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070019 % (KARAF, ONOS_VERSION, BRANDING, PATCHES),
20 tools = ["onos-prep-karaf"],
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070021)
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070022
Thomas Vachuska0f956032018-06-12 10:41:12 -070023# FIXME: Move /features to under tools/package/features
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070024PACKAGING_REQUIREMENTS = [
25 "//features:onos-features",
26 ":onos-karaf",
27]
28
Thomas Vachuska0f956032018-06-12 10:41:12 -070029# FIXME: Need to add OAR files as dependencies
30# Generates the principal distributable onos.tar.gz file
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070031genrule(
32 name = "onos-package",
33 srcs = PACKAGING_REQUIREMENTS + glob(["bin/*", "etc/*", "init/*", "config/*", "runtime/bin/*"]),
34 outs = ["onos.tar.gz"],
Thomas Vachuska0f956032018-06-12 10:41:12 -070035 cmd = "$(location onos_stage.py) $(location onos.tar.gz) %s $(location :onos-karaf) $(SRCS)" % ONOS_VERSION,
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070036 visibility = ["//visibility:public"],
37 tools = ["onos_stage.py"],
38)
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070039
Thomas Vachuska0f956032018-06-12 10:41:12 -070040# Generates auxiliary tar file with ONOS runtime tools
41filegroup(
42 name = "onos-runtime-tools",
43 srcs = glob(["runtime/bin/*"]),
44)
45
46# Generates the onos-admin.tar.gz file with remote admin tools
47genrule(
48 name = "onos-package-admin",
49 srcs = ["//tools/dev:onos-admin", "//tools/test:onos-admin", ":onos-runtime-tools"],
50 outs = ["onos-admin.tar.gz"],
51 cmd = "mkdir onos-admin-%s; cp $(SRCS) onos-admin-%s; tar zcf $(location onos-admin.tar.gz) onos-admin-%s"\
52 % (ONOS_VERSION, ONOS_VERSION, ONOS_VERSION),
53 visibility = ["//visibility:public"],
54)
55
56genrule(
57 name = "onos-package-test",
58 srcs = ["//tools/dev:onos-test", "//tools/test:onos-test", ":onos-runtime-tools", "//:onos-env-defaults"],
59 outs = ["onos-test.tar.gz"],
60 cmd = "mkdir onos-test-%s; cp -r tools onos-test-%s; tar zcf $(location onos-test.tar.gz) onos-test-%s"\
61 % (ONOS_VERSION, ONOS_VERSION, ONOS_VERSION),
62 visibility = ["//visibility:public"],
63)
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070064
65#staged_repos = ['$(location %s-repo)' % f for f in FEATURES]
66#staged_apps = ['$(location %s)' % a for a in APPS]
67#
68## feature_coords = 'foo:bar:1.3'
69#sources = [ '$(location :onos-features)', ]
70#sources += staged_repos + staged_apps
71#
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070072#genrule(
73# name = 'onos-run',
74# out = 'onos-run',
75# srcs = [ 'onos-run-karaf' ],
76# bash = 'sed "s#ONOS_TAR=#ONOS_TAR=$(location :onos-package)#" $SRCS > $OUT; chmod +x $OUT',
77# executable = True,
78# visibility = [ 'PUBLIC' ],
79#)